summaryrefslogtreecommitdiff
path: root/test
AgeCommit message (Collapse)Author
2016-04-18node: make builtin libs available for `--eval`Anna Henningsen
Make the builtin libraries available for the `--eval` and `--print` CLI options, using the same mechanism that the REPL uses. This renders workarounds like `node -e 'require("fs").doStuff()'` unnecessary. As part of this, the list of builtin modules and the code for adding the corresponding properties to the target context is moved to `internal/module.js`, and the previously missing `repl` entry is added. PR-URL: https://github.com/nodejs/node/pull/6207 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-18test,repl: use deepStrictEqual for false-y valuesJeremiah Senkpiel
PR-URL: https://github.com/nodejs/node/pull/6196 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
2016-04-18test: move the debugger tests back to parallelSantiago Gimeno
Run the debugger with `--port=common.PORT` to avoid the use of the same port. PR-URL: https://github.com/nodejs/node/pull/6246 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-18src: don't set non-primitive values on templatesBen Noordhuis
V8 is going to disallow non-primitive values on v8::FunctionTemplate and v8::ObjectTemplate because those can't be shared across contexts. Fixes: https://github.com/nodejs/node/issues/6216 PR-URL: https://github.com/nodejs/node/pull/6228 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-04-17test,vm: enable strict mode for vm testsRich Trott
Some vm tests are not in strict mode because they need to create and use global variables. By using `global.foo` instead of just `foo`, we can still enable strict mode. PR-URL: https://github.com/nodejs/node/pull/6209 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
2016-04-17zlib: Make the finish flush flag configurableAnna Henningsen
Up to now, `Z_FINISH` was always the flushing flag that was used for the last chunk of input data. This patch makes this choice configurable so that advanced users can perform e.g. decompression of partial data using `Z_SYNC_FLUSH`, if that suits their needs. Add tests to make sure that an error is thrown upon encountering invalid `flush` or `finishFlush` flags. Fixes: https://github.com/nodejs/node/issues/5761 PR-URL: https://github.com/nodejs/node/pull/6069 Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-15buffer: add Buffer.allocUnsafeSlow(size)James M Snell
Aligns the functionality of SlowBuffer with the new Buffer constructor API. Next step is to docs-only deprecate SlowBuffer. Replace the internal uses of SlowBuffer with `Buffer.allocUnsafeSlow(size)` PR-URL: https://github.com/nodejs/node/pull/5833 Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2016-04-15fs: optimize realpath using uv_fs_realpath()Yuval Brik
Remove realpath() and realpathSync() cache. Use the native uv_fs_realpath() which is faster then the JS implementation by a few orders of magnitude. PR-URL: https://github.com/nodejs/node/pull/3594 Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2016-04-14test: move debugger tests to sequentialRich Trott
The debugger tests in parallel fail with `make test` sometimes (all the time?). This appears to be related to running in parallel, as it does not fail with `make test-ci`, when run via `tools/test.py` or directly from the command line with `./node test/parallel/test-debugger-util-regression.js`. A separate issue may be opened to find out why it is failing in parallel, but for now, I think it's important to fix `make test` promptly. I suspect the issue is that the tests are relying on a default port somewhere and so they are colliding when run in parallel. But that's just a guess for the moment. PR-URL: https://github.com/nodejs/node/pull/6205 Fixes: https://github.com/nodejs/node/issues/6201 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2016-04-14lib: improve module loading performanceBrian White
This commit improves module loading performance by at least ~25-35% in the module-loader benchmarks. Some optimization strategies include: * Try-finally/try-catch isolation * Replacing regular expressions with manual parsing * Avoiding unnecessary string and array creation * Avoiding constant recompilation of anonymous functions and function definitions within functions PR-URL: https://github.com/nodejs/node/pull/5172 Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-14debugger: run last command on presssing enterRich Trott
PR-URL: https://github.com/nodejs/node/pull/6090 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Fixes: https://github.com/nodejs/node/issues/2895
2016-04-14test: update error message for JSON.parseMichaël Zasso
V8 5.0 introduced a small modification for the unexpected end of input error. PR-URL: https://github.com/nodejs/node/pull/5945 Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com>
2016-04-14repl: don’t complete non-simple expressionsAnna Henningsen
Change the regular expression that recognizes “simple” JS expressions to requiring that the full line needs to match it. Previously, in terms like `a().b.`, `b.` would be a partial match. This meant that completion would evaluate `b` and either fail with a `ReferenceError` or, if `b` was some global, return the properties of the global `b` object. PR-URL: https://github.com/nodejs/node/pull/6192 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-04-14streams: support unlimited synchronous cork/uncork cyclesMatteo Collina
net streams can request multiple chunks to be written in a synchronous fashion. If this is combined with cork/uncork, en error is currently thrown because of a regression introduced in: https://github.com/nodejs/node/commit/89aeab901ac9e34c79be3854f1aa41f2a4fb6888 (https://github.com/nodejs/node/pull/4354). Fixes: https://github.com/nodejs/node/issues/6154 PR-URL: https://github.com/nodejs/node/pull/6164 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Mathias Buus <mathiasbuus@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-12os: add userInfo() methodcjihrig
os.userInfo() calls libuv's uv_os_get_passwd() function. It returns an object containing the current effective user's username, uid, gid, shell, and home directory. On Windows, the uid and gid are -1, and the shell is null. Refs: https://github.com/nodejs/node/issues/5582 PR-URL: https://github.com/nodejs/node/pull/6104 Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-12test: fix flaky test-child-process-fork-netRich Trott
Reduce client connections from 10 to 4 in a test that is causing issues on Raspberry Pi 2 devices in CI. Fixes: https://github.com/nodejs/node/issues/5122 PR-URL: https://github.com/nodejs/node/pull/6138 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
2016-04-11stream: Fix readableState.awaitDrain mechanismAnna Henningsen
In 68990948fe4 (https://github.com/nodejs/node/pull/2325), the conditions for increasing `readableState.awaitDrain` when writing to a piping destination returns false were changed so that they could not actually be met, effectively leaving `readableState.awaitDrain` with a constant value of 0. This patch changes the conditions to testing whether the stream for which `.write()` returned false is still a piping destination, which was likely the intention of the original patch. Fixes: https://github.com/nodejs/node/issues/5820 Fixes: https://github.com/nodejs/node/issues/5257 PR-URL: https://github.com/nodejs/node/pull/6023 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-11querystring: using toString for objects on querystring.escapeIgor Kalashnikov
This commit fixes an inconsistency in querystring.escape objects handling compared to native encodeURIComponent function. Fixes: https://github.com/nodejs/node/issues/5309 PR-URL: https://github.com/nodejs/node/pull/5341 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
2016-04-10test: fix issues for ESLint 2.7.0silverwind
PR-URL: https://github.com/nodejs/node/pull/6132 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: thefourtheye <thechargingvolcano@gmail.com>
2016-04-08buffer: add Buffer.prototype.compare by offsetJames M Snell
Adds additional `targetStart`, `targetEnd`, `sourceStart, and `sourceEnd` arguments to `Buffer.prototype.compare` to allow comparison of sub-ranges of two Buffers without requiring Buffer.prototype.slice() Fixes: https://github.com/nodejs/node/issues/521 PR-URL: https://github.com/nodejs/node/pull/5880 Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-04-08test: move some test from sequential to parallelSantiago Gimeno
The only test with modifications is `test-stdin-child-proc` that was passing when it should not because the exit code of the child process was not being checked. PR-URL: https://github.com/nodejs/node/pull/6087 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com>
2016-04-08test: fix flaky test-http-client-abortRich Trott
Fixes: https://github.com/nodejs/node/issues/6080 PR-URL: https://github.com/nodejs/node/pull/6124 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-08path: fixing a test that breaks on some machines.Mike Kaufman
A win32-only test was verifying that path.win32._makeLong('C:') would return the current working directory. This would only work if current working directory was also on the C: device. Fix is to grab the device letter for current working directory, and pass that to _makeLong(). PR-URL: https://github.com/nodejs/node/pull/6067 Reviewed-By: Trott - Rich Trott <rtrott@gmail.com> Reviewed-By: Joao Reis <reis@janeasystems.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2016-04-08repl: refactor repl.jsRich Trott
There is some unnecessary logic in repl.js. Remove it. PR-URL: https://github.com/nodejs/node/pull/6071 Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-08buffer: standardize array index checkTrevor Norris
ParseArrayIndex() was requesting a Uint32Value(), but assigning it to an in32_t. This caused slight differences in error message reported in edge cases of argument parsing. Fixed by getting the IntegerValue() before checking if the value is < 0. Added test of API that was affected. PR-URL: https://github.com/nodejs/node/pull/6084 Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-07test: refactor test-file-write-stream3Rich Trott
* use common.mustCall() to verify all tests have run * eliminate unneeded removeTestFile() * eliminate unneeded var leaking into global scope * var -> const * remove instance of let PR-URL: https://github.com/nodejs/node/pull/6050 Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-07handle_wrap: expose an `isRefed()` check to JSJeremiah Senkpiel
This allows third-party tools to check whether or not a handle that can be unreferenced is unreferenced at a particular time. Notably, this should be helpful for inspection via AsyncWrap. Also, this is useful even to node's internals, particularly timers. Refs: https://github.com/nodejs/node/pull/5828 Refs: https://github.com/nodejs/node/pull/5827 PR-URL: https://github.com/nodejs/node/pull/5834 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2016-04-06test: enforce strict mode for test-domain-cryptoRich Trott
The last change to this test landed before a nit about strict mode was addressed, so this change addresses that. PR-URL: https://github.com/nodejs/node/pull/6047 Refs: https://github.com/nodejs/node/pull/6017 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
2016-04-06test: fix another flaky stringbytes testAli Ijaz Sheikh
Avoid depending on precise timing of when an object will be collected by GC. This test was missed by #6039 as it happened to be in a different directory than the rest. Ref: https://github.com/nodejs/node/pull/6039 PR-URL: https://github.com/nodejs/node/pull/6073 Reviewed-By: Trott - Rich Trott <rtrott@gmail.com>
2016-04-05test: fix flakiness of stringbytes-externalAli Ijaz Sheikh
The tests used to rely on precise timing of when a JavaScript object would be garbage collected to ensure that there is enough memory available on the system. Switch the test to use a malloc/free pair instead. Ref: https://github.com/nodejs/node/pull/5945 PR-URL: https://github.com/nodejs/node/pull/6039 Reviewed-By: jasnell - James M Snell <jasnell@gmail.com> Reviewed-By: evanlucas - Evan Lucas <evanlucas@me.com> Reviewed-By: Trott - Rich Trott <rtrott@gmail.com>
2016-04-05zlib: detect gzip files when using unzip*Anna Henningsen
Detect whether a gzip file is being passed to `unzip*` by testing the first bytes for the gzip magic bytes, and setting the decompression mode to `GUNZIP` or `INFLATE` according to the result. This enables gzip-only features like multi-member support to be used together with the `unzip*` autodetection support and thereby makes `gunzip*` and `unzip*` return identical results for gzip input again. Add a simple test for checking that features specific to `zlib.gunzip`, notably support for multiple members, also work when using `zlib.unzip`. PR-URL: https://github.com/nodejs/node/pull/5884 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-05readline: emit key info unconditionallycjihrig
Currently, 'keypress' events include the sequence and key info for named keys, but only the sequence for unnamed keys. This commit causes the key info to be included in both cases. PR-URL: https://github.com/nodejs/node/pull/6024 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2016-04-05readline: document emitKeypressEvents()cjihrig
This commit adds documentation to the already publicly available readline.emitKeypressEvents() method. PR-URL: https://github.com/nodejs/node/pull/6024 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
2016-04-04test: make use of globals explicitRich Trott
Use `global` to be explicit that a global variable is intended. PR-URL: https://github.com/nodejs/node/pull/6014 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-04test: be explicit about polluting of `global`Rich Trott
There was a comment in `test-domain-crypto.js` indicating that the pollution of the `global` object with a `domain` property was intentional. Provide more information in the comment so someone may easily determine why. Use `global.domain` rather than declaring `domain` without the `var` keyword to more clearly signal that the pollution is intentional. PR-URL: https://github.com/nodejs/node/pull/6017 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-04test: explicitly set global in test-replRich Trott
The test intentionally assigns a global. Use `global` namespace to make it clear that it is intentional and not an accidental leak. PR-URL: https://github.com/nodejs/node/pull/6026 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-04path: fix win32.isAbsolute() inconsistencyBrian White
This commit fixes an inconsistency in absolute path checking compared to the absolute path detection used by the other path.win32 functions. Fixes: https://github.com/nodejs/node/issues/6027 PR-URL: https://github.com/nodejs/node/pull/6028 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-04test: fix pummel test failuresRich Trott
A handful of tests in `test/pummel` were failing due to undefined variables. The tests in pummel are not run in CI or otherwise exercised regularly so these failures can go unnoticed for a long time. PR-URL: https://github.com/nodejs/node/pull/6012 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-04-04test: fix flaky test-net-socket-timeout-unrefRich Trott
Throw immediately on socket timeout rather than checking boolean in exit handler. PR-URL: https://github.com/nodejs/node/pull/6003 Fixes: https://github.com/nodejs/node/issues/5128 Reviewed-By: Myles Borins <myles.borins@gmail.com>
2016-04-03test: fix test-dns.js flakinessRich Trott
Use empty string instead of `www.google.com` for tests where we are just doing parameter evaluation. This will avoid DNS lookups which appear to be causing flakiness on Raspberry Pi devices in CI. PR-URL: https://github.com/nodejs/node/pull/5996 Fixes: https://github.com/nodejs/node/issues/5554 Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-03test: fix error message checks in test-module-loadingJames M Snell
PR-URL: https://github.com/nodejs/node/pull/5986 Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-02tools: remove disabling of already-disabled ruleRich Trott
`require-buffer` is only enabled in the `lib` directory. There is no need to disable it in `test`. PR-URL: https://github.com/nodejs/node/pull/6013 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2016-04-02test: refactor http-end-throw-socket-handlingSantiago Gimeno
Remove timer to avoid the test timing out occasionally. PR-URL: https://github.com/nodejs/node/pull/5676 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com>
2016-04-01buffer: don't set `kNoZeroFill` flag in allocUnsafeVladimir Kurchatkin
If `kNoZeroFill` is set here, it won't be reset in case of pooled allocation. In case of "slow" allocation it will be set later anyway. Fixes: https://github.com/nodejs/node/issues/6006 PR-URL: https://github.com/nodejs/node/pull/6007 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Myles Borins <myles.borins@gmail.com>
2016-04-01net: support DNS hints in createConnection()Colin Ihrig
This commit adds support for passing DNS lookup hints to createConnection(). PR-URL: https://github.com/nodejs/node/pull/6000 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-01net: improve socket.write() error messagePhillip Johnsen
Informative error messages are very important for developers and could possibly save hours of debugging and frustration. This improves the error message thrown when writing invalid data into a socket, by communicating what's expected compared to what the developer just tried to write. PR-URL: https://github.com/nodejs/node/pull/5981 Reviewed-By: Brian White <mscdex@mscdex.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-04-01http: Corrects IPv6 address in Host headerMihai Potra
IPv6 addresses in Host header (URI), must be enclosed within square brackets, in order to properly separate the host address from any port reference. PR-URL: https://github.com/nodejs/node/pull/5314 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com>
2016-03-31test: ensure _handle property existenceRich Trott
`test-stdtout-close-unref.js` will fail if `process.stdin._handle` does not exist. On UNIX-like operating systems, you can see this failure this way: ./node test/parallel/test-stdout-close-unref.js < /dev/null This issue has been experienced by @bengl and @drewfish in a Docker container. I'm not sure why they are experiencing it in their environment, but since it is possible that the `_handle` property does not exist, let's use `child_process.spawn()` to make sure it exists. PR-URL: https://github.com/nodejs/node/pull/5916 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-04-01test: fix offending max-len linter errorSakthipriyan Vairamani
Refer: https://github.com/nodejs/node/pull/5935 PR-URL: https://github.com/nodejs/node/pull/5980 Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Phillip Johnsen <johphi@gmail.com>
2016-03-31assert: Check typed array view type in deepEqualAnna Henningsen
Do not convert typed arrays to `Buffer` for deepEqual since their values may not be accurately represented by 8-bit ints. Instead perform binary comparison of underlying `ArrayBuffer`s, but only when the array types match. Never apply any kind of optimization for floating-point typed arrays since bit pattern equality is not the right kind of check for them. PR-URL: https://github.com/nodejs/node/pull/5910 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Fixes: https://github.com/nodejs/node/issues/5907