diff --git a/CHANGELOG.md b/CHANGELOG.md
index 21345ce5818212..9f4f63ed3f5606 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,48 @@
# Node.js ChangeLog
+## 2016-04-05, Version 5.10.1 (Stable), @thealphanerd
+
+### Notable changes
+
+**http**:
+ * Enclose IPv6 Host header in square brackets. This will enable proper seperation of the host adress from any port reference (Mihai Potra) [#5314](https://github.com/nodejs/node/pull/5314)
+
+**path**:
+ * Make win32.isAbsolute more consistent (Brian White) [#6028](https://github.com/nodejs/node/pull/6028)
+
+### Commits
+
+* [[`0f5a51ae4b`](https://github.com/nodejs/node/commit/0f5a51ae4b)] - **assert**: Check typed array view type in deepEqual (Anna Henningsen) [#5910](https://github.com/nodejs/node/pull/5910)
+* [[`e966d1f5db`](https://github.com/nodejs/node/commit/e966d1f5db)] - **buffer**: don't set `kNoZeroFill` flag in allocUnsafe (Vladimir Kurchatkin) [#6007](https://github.com/nodejs/node/pull/6007)
+* [[`3f75751c2e`](https://github.com/nodejs/node/commit/3f75751c2e)] - **build**: introduce ci targets for lint/benchmark (Johan Bergström) [#5921](https://github.com/nodejs/node/pull/5921)
+* [[`781290b61d`](https://github.com/nodejs/node/commit/781290b61d)] - **doc**: refine child_process detach behaviour (Robert Jefe Lindstaedt) [#5330](https://github.com/nodejs/node/pull/5330)
+* [[`aa9fb03202`](https://github.com/nodejs/node/commit/aa9fb03202)] - **doc**: use HTTPS for links where possible (Rich Trott) [#6019](https://github.com/nodejs/node/pull/6019)
+* [[`dd25984838`](https://github.com/nodejs/node/commit/dd25984838)] - **doc**: note assert.throws() pitfall (Rich Trott) [#6029](https://github.com/nodejs/node/pull/6029)
+* [[`f879f5e68a`](https://github.com/nodejs/node/commit/f879f5e68a)] - **doc**: document unspecified behavior for buf.write* methods (James M Snell) [#5925](https://github.com/nodejs/node/pull/5925)
+* [[`f12c3861e0`](https://github.com/nodejs/node/commit/f12c3861e0)] - **doc**: clarify stdout/stderr arguments to callback (James M Snell) [#6015](https://github.com/nodejs/node/pull/6015)
+* [[`ce173716be`](https://github.com/nodejs/node/commit/ce173716be)] - **doc**: add 'Command Line Options' to 'View on single page' (firedfox) [#6011](https://github.com/nodejs/node/pull/6011)
+* [[`7337ef6422`](https://github.com/nodejs/node/commit/7337ef6422)] - **doc**: minor argument formatting in stream.markdown (James M Snell) [#6016](https://github.com/nodejs/node/pull/6016)
+* [[`0ae5d027c6`](https://github.com/nodejs/node/commit/0ae5d027c6)] - **doc**: clarify that __dirname is module local (James M Snell) [#6018](https://github.com/nodejs/node/pull/6018)
+* [[`8bec8aa41f`](https://github.com/nodejs/node/commit/8bec8aa41f)] - **doc**: consolidate timers docs in timers.markdown (Bryan English) [#5837](https://github.com/nodejs/node/pull/5837)
+* [[`0a13099c42`](https://github.com/nodejs/node/commit/0a13099c42)] - **etw**: add event messages (João Reis) [#5936](https://github.com/nodejs/node/pull/5936)
+* [[`c6ac6f2ea1`](https://github.com/nodejs/node/commit/c6ac6f2ea1)] - **http**: Corrects IPv6 address in Host header (Mihai Potra) [#5314](https://github.com/nodejs/node/pull/5314)
+* [[`8317778925`](https://github.com/nodejs/node/commit/8317778925)] - **meta**: add "joining a wg" section to WORKING_GROUPS.md (Matteo Collina) [#5488](https://github.com/nodejs/node/pull/5488)
+* [[`f3f19ee5e2`](https://github.com/nodejs/node/commit/f3f19ee5e2)] - **net**: refactor self=this to arrow functions (Benjamin Gruenbaum) [#5857](https://github.com/nodejs/node/pull/5857)
+* [[`1c4007927d`](https://github.com/nodejs/node/commit/1c4007927d)] - **path**: fix win32.isAbsolute() inconsistency (Brian White) [#6028](https://github.com/nodejs/node/pull/6028)
+* [[`059b607a4f`](https://github.com/nodejs/node/commit/059b607a4f)] - **test**: make use of globals explicit (Rich Trott) [#6014](https://github.com/nodejs/node/pull/6014)
+* [[`cc8fcc5a07`](https://github.com/nodejs/node/commit/cc8fcc5a07)] - **test**: be explicit about polluting of `global` (Rich Trott) [#6017](https://github.com/nodejs/node/pull/6017)
+* [[`7db7a820b9`](https://github.com/nodejs/node/commit/7db7a820b9)] - **test**: make arch available in status files (Santiago Gimeno) [#5997](https://github.com/nodejs/node/pull/5997)
+* [[`02f2ebd9b4`](https://github.com/nodejs/node/commit/02f2ebd9b4)] - **test**: explicitly set global in test-repl (Rich Trott) [#6026](https://github.com/nodejs/node/pull/6026)
+* [[`2ab1237137`](https://github.com/nodejs/node/commit/2ab1237137)] - **test**: fix flaky test-net-socket-timeout-unref (Rich Trott) [#6003](https://github.com/nodejs/node/pull/6003)
+* [[`0127c2bd39`](https://github.com/nodejs/node/commit/0127c2bd39)] - **test**: fix test-dns.js flakiness (Rich Trott) [#5996](https://github.com/nodejs/node/pull/5996)
+* [[`6052ced37f`](https://github.com/nodejs/node/commit/6052ced37f)] - **test**: fix error message checks in test-module-loading (James M Snell) [#5986](https://github.com/nodejs/node/pull/5986)
+* [[`a40b0cb673`](https://github.com/nodejs/node/commit/a40b0cb673)] - **test**: refactor http-end-throw-socket-handling (Santiago Gimeno) [#5676](https://github.com/nodejs/node/pull/5676)
+* [[`96bb315262`](https://github.com/nodejs/node/commit/96bb315262)] - **test**: ensure _handle property existence (Rich Trott) [#5916](https://github.com/nodejs/node/pull/5916)
+* [[`4f1fa2adeb`](https://github.com/nodejs/node/commit/4f1fa2adeb)] - **test**: fix offending max-len linter error (Sakthipriyan Vairamani) [#5980](https://github.com/nodejs/node/pull/5980)
+* [[`f14d71ccea`](https://github.com/nodejs/node/commit/f14d71ccea)] - **test**: stdin is not always a net.Socket (Jeremiah Senkpiel) [#5935](https://github.com/nodejs/node/pull/5935)
+* [[`50a062e691`](https://github.com/nodejs/node/commit/50a062e691)] - **tools**: remove obsolete lint config file (Rich Trott) [#5959](https://github.com/nodejs/node/pull/5959)
+* [[`7491fdcfe9`](https://github.com/nodejs/node/commit/7491fdcfe9)] - **tools**: remove disabling of already-disabled rule (Rich Trott) [#6013](https://github.com/nodejs/node/pull/6013)
+
## 2016-03-31, Version 5.10.0 (Stable), @evanlucas
### Notable changes
diff --git a/Makefile b/Makefile
index 93aedc8c2722f1..b4edaee1bf29ba 100644
--- a/Makefile
+++ b/Makefile
@@ -581,6 +581,8 @@ bench-all: bench bench-misc bench-array bench-buffer bench-url bench-events benc
bench: bench-net bench-http bench-fs bench-tls
+bench-ci: bench
+
bench-http-simple:
benchmark/http_simple_bench.sh
@@ -620,10 +622,12 @@ cpplint:
lint: jslint cpplint
+lint-ci: lint
+
.PHONY: lint cpplint jslint bench clean docopen docclean doc dist distclean \
check uninstall install install-includes install-bin all staticlib \
dynamiclib test test-all test-addons build-addons website-upload pkg \
blog blogclean tar binary release-only bench-http-simple bench-idle \
bench-all bench bench-misc bench-array bench-buffer bench-net \
bench-http bench-fs bench-tls cctest run-ci test-v8 test-v8-intl \
- test-v8-benchmarks test-v8-all v8
+ test-v8-benchmarks test-v8-all v8 lint-ci bench-ci
diff --git a/README.md b/README.md
index 5e805ca55d2a95..64264f7c40d983 100644
--- a/README.md
+++ b/README.md
@@ -114,8 +114,8 @@ Node.js from source.
* [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md)
* [CONTRIBUTING.md](./CONTRIBUTING.md)
* [GOVERNANCE.md](./GOVERNANCE.md)
-* IRC (general questions): [#node.js on Freenode.net](http://webchat.freenode.net?channels=node.js&uio=d4)
-* IRC (node core development): [#node-dev on Freenode.net](http://webchat.freenode.net?channels=node-dev&uio=d4)
+* IRC (general questions): [#node.js on Freenode.net](https://webchat.freenode.net?channels=node.js&uio=d4)
+* IRC (node core development): [#node-dev on Freenode.net](https://webchat.freenode.net?channels=node-dev&uio=d4)
* [nodejs/node on Gitter](https://gitter.im/nodejs/node)
## Security
diff --git a/WORKING_GROUPS.md b/WORKING_GROUPS.md
index 4ae845c3960114..79632c4fd8a4fb 100644
--- a/WORKING_GROUPS.md
+++ b/WORKING_GROUPS.md
@@ -300,6 +300,11 @@ It's responsibilities are:
* Working with the Build Working Group to improve continuous integration.
* Improving tooling for testing.
+## Joining a WG
+
+To find out how to join a working group, consult the GOVERNANCE.md in
+the working group's repository, or simply open an issue there.
+
## Starting a WG
A Working Group is established by first defining a charter that can be
diff --git a/doc/api/all.markdown b/doc/api/all.markdown
index 8bac0103c88da7..93c7a300a162e9 100644
--- a/doc/api/all.markdown
+++ b/doc/api/all.markdown
@@ -5,6 +5,7 @@
@include buffer
@include child_process
@include cluster
+@include cli
@include console
@include crypto
@include debugger
diff --git a/doc/api/assert.markdown b/doc/api/assert.markdown
index 6bbbf6bd629e22..35dbc3d2192209 100644
--- a/doc/api/assert.markdown
+++ b/doc/api/assert.markdown
@@ -361,8 +361,13 @@ If the values are not strictly equal, an `AssertionError` is thrown with a
## assert.throws(block[, error][, message])
-Expects the function `block` to throw an error. If specified, `error` can be a
-constructor, [`RegExp`][], or validation function.
+Expects the function `block` to throw an error.
+
+If specified, `error` can be a constructor, [`RegExp`][], or validation
+function.
+
+If specified, `message` will be the message provided by the `AssertionError` if
+the block fails to throw.
Validate instanceof using constructor:
@@ -402,6 +407,18 @@ assert.throws(
);
```
+Note that `error` can not be a string. If a string is provided as the second
+argument, then `error` is assumed to be omitted and the string will be used for
+`message` instead. This can lead to easy-to-miss mistakes:
+
+```js
+// THIS IS A MISTAKE! DO NOT DO THIS!
+assert.throws(myFunction, 'missing foo', 'did not throw with expected message');
+
+// Do this instead.
+assert.throws(myFunction, /missing foo/, 'did not throw with expected message');
+```
+
[Locked]: documentation.html#documentation_stability_index
[`assert.deepEqual()`]: #assert_assert_deepequal_actual_expected_message
[`assert.deepStrictEqual()`]: #assert_assert_deepstrictequal_actual_expected_message
diff --git a/doc/api/buffer.markdown b/doc/api/buffer.markdown
index 88891c68a42ac3..a5251fe7ee3be8 100644
--- a/doc/api/buffer.markdown
+++ b/doc/api/buffer.markdown
@@ -1384,7 +1384,8 @@ console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`);
Writes `value` to the Buffer at the specified `offset` with specified endian
format (`writeDoubleBE()` writes big endian, `writeDoubleLE()` writes little
-endian). The `value` argument must be a valid 64-bit double.
+endian). The `value` argument *should* be a valid 64-bit double. Behavior is
+not defined when `value` is anything other than a 64-bit double.
Set `noAssert` to true to skip validation of `value` and `offset`. This means
that `value` may be too large for the specific function and `offset` may be
@@ -1416,7 +1417,7 @@ console.log(buf);
Writes `value` to the Buffer at the specified `offset` with specified endian
format (`writeFloatBE()` writes big endian, `writeFloatLE()` writes little
-endian). Behavior is unspecified if `value` is anything other than a 32-bit
+endian). Behavior is not defined when `value` is anything other than a 32-bit
float.
Set `noAssert` to true to skip validation of `value` and `offset`. This means
@@ -1446,8 +1447,9 @@ console.log(buf);
* `noAssert` {Boolean} Default: false
* Return: {Number} The offset plus the number of written bytes
-Writes `value` to the Buffer at the specified `offset`. The `value` must be a
-valid signed 8-bit integer.
+Writes `value` to the Buffer at the specified `offset`. The `value` should be a
+valid signed 8-bit integer. Behavior is not defined when `value` is anything
+other than a signed 8-bit integer.
Set `noAssert` to true to skip validation of `value` and `offset`. This means
that `value` may be too large for the specific function and `offset` may be
@@ -1474,7 +1476,8 @@ console.log(buf);
Writes `value` to the Buffer at the specified `offset` with specified endian
format (`writeInt16BE()` writes big endian, `writeInt16LE()` writes little
-endian). The `value` must be a valid signed 16-bit integer.
+endian). The `value` should be a valid signed 16-bit integer. Behavior is
+not defined when `value` is anything other than a signed 16-bit integer.
Set `noAssert` to true to skip validation of `value` and `offset`. This means
that `value` may be too large for the specific function and `offset` may be
@@ -1501,7 +1504,8 @@ console.log(buf);
Writes `value` to the Buffer at the specified `offset` with specified endian
format (`writeInt32BE()` writes big endian, `writeInt32LE()` writes little
-endian). The `value` must be a valid signed 32-bit integer.
+endian). The `value` should be a valid signed 32-bit integer. Behavior is
+not defined when `value` is anything other than a signed 32-bit integer.
Set `noAssert` to true to skip validation of `value` and `offset`. This means
that `value` may be too large for the specific function and `offset` may be
@@ -1547,6 +1551,8 @@ that `value` may be too large for the specific function and `offset` may be
beyond the end of the Buffer leading to the values being silently dropped. This
should not be used unless you are certain of correctness.
+Behavior is not defined when `value` is anything other than an integer.
+
### buf.writeUInt8(value, offset[, noAssert])
* `value` {Number} Bytes to be written to Buffer
@@ -1554,8 +1560,9 @@ should not be used unless you are certain of correctness.
* `noAssert` {Boolean} Default: false
* Return: {Number} The offset plus the number of written bytes
-Writes `value` to the Buffer at the specified `offset`. The `value` must be a
-valid unsigned 8-bit integer.
+Writes `value` to the Buffer at the specified `offset`. The `value` should be a
+valid unsigned 8-bit integer. Behavior is not defined when `value` is anything
+other than an unsigned 8-bit integer.
Set `noAssert` to true to skip validation of `value` and `offset`. This means
that `value` may be too large for the specific function and `offset` may be
@@ -1585,7 +1592,8 @@ console.log(buf);
Writes `value` to the Buffer at the specified `offset` with specified endian
format (`writeUInt16BE()` writes big endian, `writeUInt16LE()` writes little
-endian). The `value` must be a valid unsigned 16-bit integer.
+endian). The `value` should be a valid unsigned 16-bit integer. Behavior is
+not defined when `value` is anything other than an unsigned 16-bit integer.
Set `noAssert` to true to skip validation of `value` and `offset`. This means
that `value` may be too large for the specific function and `offset` may be
@@ -1619,7 +1627,8 @@ console.log(buf);
Writes `value` to the Buffer at the specified `offset` with specified endian
format (`writeUInt32BE()` writes big endian, `writeUInt32LE()` writes little
-endian). The `value` must be a valid unsigned 32-bit integer.
+endian). The `value` should be a valid unsigned 32-bit integer. Behavior is
+not defined when `value` is anything other than an unsigned 32-bit integer.
Set `noAssert` to true to skip validation of `value` and `offset`. This means
that `value` may be too large for the specific function and `offset` may be
@@ -1665,6 +1674,8 @@ that `value` may be too large for the specific function and `offset` may be
beyond the end of the Buffer leading to the values being silently dropped. This
should not be used unless you are certain of correctness.
+Behavior is not defined when `value` is anything other than an unsigned integer.
+
## buffer.INSPECT_MAX_BYTES
* {Number} Default: 50
diff --git a/doc/api/child_process.markdown b/doc/api/child_process.markdown
index 5f17b435e6ea87..ae0b8ac9ed0afb 100644
--- a/doc/api/child_process.markdown
+++ b/doc/api/child_process.markdown
@@ -131,8 +131,8 @@ exec('my.bat', (err, stdout, stderr) => {
* `gid` {Number} Sets the group identity of the process. (See setgid(2).)
* `callback` {Function} called with the output when process terminates
* `error` {Error}
- * `stdout` {Buffer}
- * `stderr` {Buffer}
+ * `stdout` {String|Buffer}
+ * `stderr` {String|Buffer}
* Return: {ChildProcess}
Spawns a shell then executes the `command` within that shell, buffering any
@@ -157,6 +157,13 @@ the exit code of the child process while `error.signal` will be set to the
signal that terminated the process. Any exit code other than `0` is considered
to be an error.
+The `stdout` and `stderr` arguments passed to the callback will contain the
+stdout and stderr output of the child process. By default, Node.js will decode
+the output as UTF-8 and pass strings to the callback. The `encoding` option
+can be used to specify the character encoding used to decode the stdout and
+stderr output. If `encoding` is `'buffer'`, `Buffer` objects will be passed to
+the callback instead.
+
The `options` argument may be passed as the second argument to customize how
the process is spawned. The default options are:
@@ -198,8 +205,8 @@ replace the existing process and uses a shell to execute the command.*
* `gid` {Number} Sets the group identity of the process. (See setgid(2).)
* `callback` {Function} called with the output when process terminates
* `error` {Error}
- * `stdout` {Buffer}
- * `stderr` {Buffer}
+ * `stdout` {String|Buffer}
+ * `stderr` {String|Buffer}
* Return: {ChildProcess}
The `child_process.execFile()` function is similar to [`child_process.exec()`][]
@@ -220,6 +227,13 @@ const child = execFile('node', ['--version'], (error, stdout, stderr) => {
});
```
+The `stdout` and `stderr` arguments passed to the callback will contain the
+stdout and stderr output of the child process. By default, Node.js will decode
+the output as UTF-8 and pass strings to the callback. The `encoding` option
+can be used to specify the character encoding used to decode the stdout and
+stderr output. If `encoding` is `'buffer'`, `Buffer` objects will be passed to
+the callback instead.
+
### child_process.fork(modulePath[, args][, options])
* `modulePath` {String} The module to run in the child
@@ -391,8 +405,27 @@ Doing so will cause the parent's event loop to not include the child in its
reference count, allowing the parent to exit independently of the child, unless
there is an established IPC channel between the child and parent.
-Example of detaching a long-running process and redirecting its output to a
-file:
+When using the `detached` option to start a long-running process, the process
+will not stay running in the background after the parent exits unless it is
+provided with a `stdio` configuration that is not connected to the parent.
+If the parent's `stdio` is inherited, the child will remain attached to the
+controlling terminal.
+
+Example of a long-running process, by detaching and also ignoring its parent
+`stdio` file descriptors, in order to ignore the parent's termination:
+
+```js
+const spawn = require('child_process').spawn;
+
+const child = spawn(process.argv[0], ['child_program.js'], {
+ detached: true,
+ stdio: ['ignore']
+});
+
+child.unref();
+```
+
+Alternatively one can redirect the child process' output into files:
```js
const fs = require('fs');
@@ -408,12 +441,6 @@ const child = spawn('prg', [], {
child.unref();
```
-When using the `detached` option to start a long-running process, the process
-will not stay running in the background after the parent exits unless it is
-provided with a `stdio` configuration that is not connected to the parent.
-If the parent's `stdio` is inherited, the child will remain attached to the
-controlling terminal.
-
#### options.stdio
The `options.stdio` option is used to configure the pipes that are established
diff --git a/doc/api/globals.markdown b/doc/api/globals.markdown
index 9ee5e48983730a..1bee7d0cf988c2 100644
--- a/doc/api/globals.markdown
+++ b/doc/api/globals.markdown
@@ -30,6 +30,16 @@ console.log(__dirname);
`__dirname` isn't actually a global but rather local to each module.
+For instance, given two modules: `a` and `b`, where `b` is a dependency of
+`a` and there is a directory structure of:
+
+* `/Users/mjr/app/a.js`
+* `/Users/mjr/app/node_modules/b/b.js`
+
+References to `__dirname` within `b.js` will return
+`/Users/mjr/app/node_modules/b` while references to `__dirname` within `a.js`
+will return `/Users/mj/app`.
+
## \_\_filename
@@ -50,19 +60,23 @@ console.log(__filename);
`__filename` isn't actually a global but rather local to each module.
-## clearInterval(t)
+## clearImmediate(immediateObject)
+
+
+
+[`clearImmediate`] is described in the [timers][] section.
-Stop a timer that was previously created with [`setInterval()`][]. The callback
-will not execute.
+## clearInterval(intervalObject)
-The timer functions are global variables. See the [timers][] section.
+[`clearInterval`] is described in the [timers][] section.
-## clearTimeout(t)
+## clearTimeout(timeoutObject)
-Stop a timer that was previously created with [`setTimeout()`][]. The callback will
-not execute.
+
+
+[`clearTimeout`] is described in the [timers][] section.
## console
@@ -162,34 +176,33 @@ left untouched.
Use the internal `require()` machinery to look up the location of a module,
but rather than loading the module, just return the resolved filename.
-## setInterval(cb, ms)
+## setImmediate(callback[, arg][, ...])
+
+
-Run callback `cb` repeatedly every `ms` milliseconds. Note that the actual
-interval may vary, depending on external factors like OS timer granularity and
-system load. It's never less than `ms` but it may be longer.
+[`setImmediate`] is described in the [timers][] section.
-The interval must be in the range of 1-2,147,483,647 inclusive. If the value is
-outside that range, it's changed to 1 millisecond. Broadly speaking, a timer
-cannot span more than 24.8 days.
+## setInterval(callback, delay[, arg][, ...])
-Returns an opaque value that represents the timer.
+
-## setTimeout(cb, ms)
+[`setInterval`] is described in the [timers][] section.
-Run callback `cb` after *at least* `ms` milliseconds. The actual delay depends
-on external factors like OS timer granularity and system load.
+## setTimeout(callback, delay[, arg][, ...])
-The timeout must be in the range of 1-2,147,483,647 inclusive. If the value is
-outside that range, it's changed to 1 millisecond. Broadly speaking, a timer
-cannot span more than 24.8 days.
+
-Returns an opaque value that represents the timer.
+[`setTimeout`] is described in the [timers][] section.
[`console`]: console.html
[`process` object]: process.html#process_process
-[`setInterval()`]: #globals_setinterval_cb_ms
-[`setTimeout()`]: #globals_settimeout_cb_ms
[buffer section]: buffer.html
[module system documentation]: modules.html
[Modules]: modules.html#modules_modules
[timers]: timers.html
+[`clearImmediate`]: timers.html#timers_clearimmediate_immediateobject
+[`clearInterval`]: timers.html#timers_clearinterval_intervalobject
+[`clearTimeout`]: timers.html#timers_cleartimeout_timeoutobject
+[`setImmediate`]: timers.html#timers_setimmediate_callback_arg
+[`setInterval`]: timers.html#timers_setinterval_callback_delay_arg
+[`setTimeout`]: timers.html#timers_settimeout_callback_delay_arg
diff --git a/doc/api/stream.markdown b/doc/api/stream.markdown
index cdab6e82ab2cdc..d2d0c4487ed9bf 100644
--- a/doc/api/stream.markdown
+++ b/doc/api/stream.markdown
@@ -201,7 +201,7 @@ readable.on('end', () => {
#### Event: 'error'
-* {Error Object}
+* {Error}
Emitted if there was an error receiving data.
diff --git a/doc/api/timers.markdown b/doc/api/timers.markdown
index 7859e7fecd6273..3990ab6c1d391d 100644
--- a/doc/api/timers.markdown
+++ b/doc/api/timers.markdown
@@ -27,7 +27,7 @@ Returns the timer.
## setImmediate(callback[, arg][, ...])
-To schedule the "immediate" execution of `callback` after I/O events'
+Schedules "immediate" execution of `callback` after I/O events'
callbacks and before timers set by [`setTimeout`][] and [`setInterval`][] are
triggered. Returns an `immediateObject` for possible use with
[`clearImmediate`][]. Additional optional arguments may be passed to the
@@ -40,7 +40,7 @@ until the next event loop iteration.
## setInterval(callback, delay[, arg][, ...])
-To schedule the repeated execution of `callback` every `delay` milliseconds.
+Schedules repeated execution of `callback` every `delay` milliseconds.
Returns a `intervalObject` for possible use with [`clearInterval`][]. Additional
optional arguments may be passed to the callback.
@@ -50,7 +50,7 @@ milliseconds (approximately 25 days) or less than 1, Node.js will use 1 as the
## setTimeout(callback, delay[, arg][, ...])
-To schedule execution of a one-time `callback` after `delay` milliseconds.
+Schedules execution of a one-time `callback` after `delay` milliseconds.
Returns a `timeoutObject` for possible use with [`clearTimeout`][]. Additional
optional arguments may be passed to the callback.
diff --git a/lib/_http_client.js b/lib/_http_client.js
index cd4ce0e9cd3426..e051ebe5fdb01c 100644
--- a/lib/_http_client.js
+++ b/lib/_http_client.js
@@ -87,6 +87,17 @@ function ClientRequest(options, cb) {
}
if (host && !this.getHeader('host') && setHost) {
var hostHeader = host;
+ var posColon = -1;
+
+ // For the Host header, ensure that IPv6 addresses are enclosed
+ // in square brackets, as defined by URI formatting
+ // https://tools.ietf.org/html/rfc3986#section-3.2.2
+ if (-1 !== (posColon = hostHeader.indexOf(':')) &&
+ -1 !== (posColon = hostHeader.indexOf(':', posColon)) &&
+ '[' !== hostHeader[0]) {
+ hostHeader = `[${hostHeader}]`;
+ }
+
if (port && +port !== defaultPort) {
hostHeader += ':' + port;
}
diff --git a/lib/assert.js b/lib/assert.js
index b33dbfa6cd1d4c..a9bea747f03352 100644
--- a/lib/assert.js
+++ b/lib/assert.js
@@ -29,6 +29,7 @@ const compare = process.binding('buffer').compare;
const util = require('util');
const Buffer = require('buffer').Buffer;
const pSlice = Array.prototype.slice;
+const pToString = (obj) => Object.prototype.toString.call(obj);
// 1. The assert module provides functions that throw
// AssertionError's when particular conditions are not met. The
@@ -170,10 +171,18 @@ function _deepEqual(actual, expected, strict) {
(expected === null || typeof expected !== 'object')) {
return strict ? actual === expected : actual == expected;
- // If both values are instances of typed arrays, wrap them in
- // a Buffer each to increase performance
- } else if (ArrayBuffer.isView(actual) && ArrayBuffer.isView(expected)) {
- return compare(new Buffer(actual), new Buffer(expected)) === 0;
+ // If both values are instances of typed arrays, wrap their underlying
+ // ArrayBuffers in a Buffer each to increase performance
+ // This optimization requires the arrays to have the same type as checked by
+ // Object.prototype.toString (aka pToString). Never perform binary
+ // comparisons for Float*Arrays, though, since e.g. +0 === -0 but their
+ // bit patterns are not identical.
+ } else if (ArrayBuffer.isView(actual) && ArrayBuffer.isView(expected) &&
+ pToString(actual) === pToString(expected) &&
+ !(actual instanceof Float32Array ||
+ actual instanceof Float64Array)) {
+ return compare(Buffer(actual.buffer),
+ Buffer(expected.buffer)) === 0;
// 7.5 For all other Object pairs, including Array objects, equivalence is
// determined by having the same number of owned properties (as verified
diff --git a/lib/net.js b/lib/net.js
index 6731380d002b6b..f93691c3fbce94 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -444,9 +444,7 @@ Socket.prototype.destroySoon = function() {
Socket.prototype._destroy = function(exception, cb) {
debug('destroy');
- var self = this;
-
- function fireErrorCallbacks() {
+ function fireErrorCallbacks(self) {
if (cb) cb(exception);
if (exception && !self._writableState.errorEmitted) {
process.nextTick(emitErrorNT, self, exception);
@@ -456,11 +454,11 @@ Socket.prototype._destroy = function(exception, cb) {
if (this.destroyed) {
debug('already destroyed, fire error callbacks');
- fireErrorCallbacks();
+ fireErrorCallbacks(this);
return;
}
- self._connecting = false;
+ this._connecting = false;
this.readable = this.writable = false;
@@ -472,9 +470,9 @@ Socket.prototype._destroy = function(exception, cb) {
if (this !== process.stderr)
debug('close handle');
var isException = exception ? true : false;
- this._handle.close(function() {
+ this._handle.close(() => {
debug('emit close');
- self.emit('close', isException);
+ this.emit('close', isException);
});
this._handle.onread = noop;
this._handle = null;
@@ -485,7 +483,7 @@ Socket.prototype._destroy = function(exception, cb) {
// to make it re-entrance safe in case Socket.prototype.destroy()
// is called within callbacks
this.destroyed = true;
- fireErrorCallbacks();
+ fireErrorCallbacks(this);
if (this._server) {
COUNTER_NET_SERVER_CONNECTION_CLOSE(this);
@@ -1078,33 +1076,31 @@ function Server(options, connectionListener) {
EventEmitter.call(this);
- var self = this;
-
if (typeof options === 'function') {
connectionListener = options;
options = {};
- self.on('connection', connectionListener);
+ this.on('connection', connectionListener);
} else {
options = options || {};
if (typeof connectionListener === 'function') {
- self.on('connection', connectionListener);
+ this.on('connection', connectionListener);
}
}
this._connections = 0;
Object.defineProperty(this, 'connections', {
- get: internalUtil.deprecate(function() {
+ get: internalUtil.deprecate(() => {
- if (self._usingSlaves) {
+ if (this._usingSlaves) {
return null;
}
- return self._connections;
+ return this._connections;
}, 'Server.connections property is deprecated. ' +
'Use Server.getConnections method instead.'),
- set: internalUtil.deprecate(function(val) {
- return (self._connections = val);
+ set: internalUtil.deprecate((val) => {
+ return (this._connections = val);
}, 'Server.connections property is deprecated.'),
configurable: true, enumerable: false
});
diff --git a/lib/path.js b/lib/path.js
index 7571918b906fdd..cc1d6e9618d92e 100644
--- a/lib/path.js
+++ b/lib/path.js
@@ -439,57 +439,17 @@ const win32 = {
if (len === 0)
return false;
var code = path.charCodeAt(0);
- if (len > 1) {
- if (code === 47/*/*/ || code === 92/*\*/) {
- // Possible UNC root
-
- code = path.charCodeAt(1);
- if (code === 47/*/*/ || code === 92/*\*/) {
- // Matched double path separator at beginning
- var j = 2;
- var last = j;
- // Match 1 or more non-path separators
- for (; j < len; ++j) {
- code = path.charCodeAt(j);
- if (code === 47/*/*/ || code === 92/*\*/)
- break;
- }
- if (j < len && j !== last) {
- // Matched!
- last = j;
- // Match 1 or more path separators
- for (; j < len; ++j) {
- code = path.charCodeAt(j);
- if (code !== 47/*/*/ && code !== 92/*\*/)
- break;
- }
- if (j < len && j !== last) {
- // Matched!
- last = j;
- // Match 1 or more non-path separators
- for (; j < len; ++j) {
- code = path.charCodeAt(j);
- if (code === 47/*/*/ || code === 92/*\*/)
- break;
- }
- if (j !== last)
- return true;
- }
- }
- }
- } else if ((code >= 65/*A*/ && code <= 90/*Z*/) ||
- (code >= 97/*a*/ && code <= 122/*z*/)) {
- // Possible device root
-
- code = path.charCodeAt(1);
- if (path.charCodeAt(1) === 58/*:*/ && len > 2) {
- code = path.charCodeAt(2);
- if (code === 47/*/*/ || code === 92/*\*/)
- return true;
- }
- }
- } else if (code === 47/*/*/ || code === 92/*\*/) {
+ if (code === 47/*/*/ || code === 92/*\*/) {
return true;
+ } else if ((code >= 65/*A*/ && code <= 90/*Z*/) ||
+ (code >= 97/*a*/ && code <= 122/*z*/)) {
+ // Possible device root
+
+ if (len > 2 && path.charCodeAt(1) === 58/*:*/) {
+ code = path.charCodeAt(2);
+ if (code === 47/*/*/ || code === 92/*\*/)
+ return true;
+ }
}
return false;
},
diff --git a/src/.eslintrc b/src/.eslintrc
deleted file mode 100644
index c3331b1c652dea..00000000000000
--- a/src/.eslintrc
+++ /dev/null
@@ -1,4 +0,0 @@
-rules:
- # ECMAScript-6
- # http://eslint.org/docs/rules/#ecmascript-6
- prefer-template: 2
diff --git a/src/node_version.h b/src/node_version.h
index 071ad69d614716..69389caa2c03d2 100644
--- a/src/node_version.h
+++ b/src/node_version.h
@@ -5,7 +5,7 @@
#define NODE_MINOR_VERSION 10
#define NODE_PATCH_VERSION 1
-#define NODE_VERSION_IS_RELEASE 0
+#define NODE_VERSION_IS_RELEASE 1
#ifndef NODE_STRINGIFY
#define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n)
diff --git a/src/res/node_etw_provider.man b/src/res/node_etw_provider.man
index efdc26d3dee722..46ad2e38fccad7 100644
--- a/src/res/node_etw_provider.man
+++ b/src/res/node_etw_provider.man
@@ -7,6 +7,7 @@
@@ -90,64 +91,95 @@
opcode="NODE_HTTP_SERVER_REQUEST"
template="node_http_server_request"
symbol="NODE_HTTP_SERVER_REQUEST_EVENT"
+ message="$(string.NodeJS-ETW-provider.event.1.message)"
level="win:Informational"/>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/test/.eslintrc b/test/.eslintrc
index 5d77a660f88762..68b358740f5e3e 100644
--- a/test/.eslintrc
+++ b/test/.eslintrc
@@ -3,8 +3,6 @@
rules:
## allow undeclared variables
no-undef: 0
- ## allow global Buffer usage
- require-buffer: 0
## common module is mandatory in tests
required-modules: [2, "common"]
diff --git a/test/known_issues/test-stdin-is-always-net.socket.js b/test/known_issues/test-stdin-is-always-net.socket.js
new file mode 100644
index 00000000000000..78c1a7d2eac20e
--- /dev/null
+++ b/test/known_issues/test-stdin-is-always-net.socket.js
@@ -0,0 +1,19 @@
+'use strict';
+// Refs: https://github.com/nodejs/node/pull/5916
+
+const common = require('../common');
+const assert = require('assert');
+const spawn = require('child_process').spawn;
+const net = require('net');
+
+if (process.argv[2] === 'child') {
+ assert(process.stdin instanceof net.Socket);
+ return;
+}
+
+const proc = spawn(process.execPath, [__filename, 'child'], {stdio: 'ignore'});
+// To double-check this test, set stdio to 'pipe' and uncomment the line below.
+// proc.stderr.pipe(process.stderr);
+proc.on('exit', common.mustCall(function(exitCode) {
+ process.exitCode = exitCode;
+}));
diff --git a/test/parallel/test-assert-typedarray-deepequal.js b/test/parallel/test-assert-typedarray-deepequal.js
index 68edefdc175317..be4462de5dff77 100644
--- a/test/parallel/test-assert-typedarray-deepequal.js
+++ b/test/parallel/test-assert-typedarray-deepequal.js
@@ -20,13 +20,25 @@ const equalArrayPairs = [
[new Int16Array(1e5), new Int16Array(1e5)],
[new Int32Array(1e5), new Int32Array(1e5)],
[new Float32Array(1e5), new Float32Array(1e5)],
- [new Float64Array(1e5), new Float64Array(1e5)]
+ [new Float64Array(1e5), new Float64Array(1e5)],
+ [new Int16Array(256), new Uint16Array(256)],
+ [new Int16Array([256]), new Uint16Array([256])],
+ [new Float32Array([+0.0]), new Float32Array([-0.0])],
+ [new Float64Array([+0.0]), new Float32Array([-0.0])],
+ [new Float64Array([+0.0]), new Float64Array([-0.0])]
];
const notEqualArrayPairs = [
[new Uint8Array(2), new Uint8Array(3)],
[new Uint8Array([1, 2, 3]), new Uint8Array([4, 5, 6])],
- [new Uint8ClampedArray([300, 2, 3]), new Uint8Array([300, 2, 3])]
+ [new Uint8ClampedArray([300, 2, 3]), new Uint8Array([300, 2, 3])],
+ [new Uint16Array([2]), new Uint16Array([3])],
+ [new Uint16Array([0]), new Uint16Array([256])],
+ [new Int16Array([0]), new Uint16Array([256])],
+ [new Int16Array([-256]), new Uint16Array([0xff00])], // same bits
+ [new Int32Array([-256]), new Uint32Array([0xffffff00])], // ditto
+ [new Float32Array([0.1]), new Float32Array([0.0])],
+ [new Float64Array([0.1]), new Float64Array([0.0])]
];
equalArrayPairs.forEach((arrayPair) => {
diff --git a/test/parallel/test-dns.js b/test/parallel/test-dns.js
index 04264907d308d4..9a2577ec90de78 100644
--- a/test/parallel/test-dns.js
+++ b/test/parallel/test-dns.js
@@ -1,8 +1,8 @@
'use strict';
require('../common');
-var assert = require('assert');
+const assert = require('assert');
-var dns = require('dns');
+const dns = require('dns');
var existing = dns.getServers();
assert(existing.length);
@@ -121,27 +121,27 @@ assert.doesNotThrow(function() {
});
assert.doesNotThrow(function() {
- dns.lookup('www.google.com', {
+ dns.lookup('', {
family: 4,
hints: 0
}, noop);
});
assert.doesNotThrow(function() {
- dns.lookup('www.google.com', {
+ dns.lookup('', {
family: 6,
hints: dns.ADDRCONFIG
}, noop);
});
assert.doesNotThrow(function() {
- dns.lookup('www.google.com', {
+ dns.lookup('', {
hints: dns.V4MAPPED
}, noop);
});
assert.doesNotThrow(function() {
- dns.lookup('www.google.com', {
+ dns.lookup('', {
hints: dns.ADDRCONFIG | dns.V4MAPPED
}, noop);
});
diff --git a/test/parallel/test-domain-crypto.js b/test/parallel/test-domain-crypto.js
index e76e8d08791c87..4dd979dafeab73 100644
--- a/test/parallel/test-domain-crypto.js
+++ b/test/parallel/test-domain-crypto.js
@@ -6,8 +6,9 @@ try {
return;
}
-// the missing var keyword is intentional
-domain = require('domain');
+// Pollution of global is intentional as part of test.
+// See https://github.com/nodejs/node/commit/d1eff9ab
+global.domain = require('domain');
// should not throw a 'TypeError: undefined is not a function' exception
crypto.randomBytes(8);
diff --git a/test/parallel/test-http-end-throw-socket-handling.js b/test/parallel/test-http-end-throw-socket-handling.js
index 204c0f73335480..d6cc81d98a8fb9 100644
--- a/test/parallel/test-http-end-throw-socket-handling.js
+++ b/test/parallel/test-http-end-throw-socket-handling.js
@@ -1,6 +1,6 @@
'use strict';
-var common = require('../common');
-var assert = require('assert');
+const common = require('../common');
+const assert = require('assert');
// Make sure that throwing in 'end' handler doesn't lock
// up the socket forever.
@@ -8,40 +8,32 @@ var assert = require('assert');
// This is NOT a good way to handle errors in general, but all
// the same, we should not be so brittle and easily broken.
-var http = require('http');
+const http = require('http');
-var n = 0;
-var server = http.createServer(function(req, res) {
+let n = 0;
+const server = http.createServer((req, res) => {
if (++n === 10) server.close();
res.end('ok');
});
-server.listen(common.PORT, function() {
- for (var i = 0; i < 10; i++) {
- var options = { port: common.PORT };
-
- var req = http.request(options, function(res) {
+server.listen(common.PORT, common.mustCall(() => {
+ for (let i = 0; i < 10; i++) {
+ const options = { port: common.PORT };
+ const req = http.request(options, (res) => {
res.resume();
- res.on('end', function() {
+ res.on('end', common.mustCall(() => {
throw new Error('gleep glorp');
- });
+ }));
});
req.end();
}
-});
+}));
-setTimeout(function() {
- process.removeListener('uncaughtException', catcher);
- throw new Error('Taking too long!');
-}, common.platformTimeout(1000)).unref();
-
-process.on('uncaughtException', catcher);
-var errors = 0;
-function catcher() {
+let errors = 0;
+process.on('uncaughtException', () => {
errors++;
-}
+});
-process.on('exit', function() {
+process.on('exit', () => {
assert.equal(errors, 10);
- console.log('ok');
});
diff --git a/test/parallel/test-http-host-header-ipv6-fail.js b/test/parallel/test-http-host-header-ipv6-fail.js
new file mode 100644
index 00000000000000..8a1a9a61afe5af
--- /dev/null
+++ b/test/parallel/test-http-host-header-ipv6-fail.js
@@ -0,0 +1,40 @@
+'use strict';
+/*
+ * When using the object form of http.request and using an IPv6 address
+ * as a hostname, and using a non-standard port, the Host header
+ * is improperly formatted.
+ * Issue: https://github.com/nodejs/node/issues/5308
+ * As per https://tools.ietf.org/html/rfc7230#section-5.4 and
+ * https://tools.ietf.org/html/rfc3986#section-3.2.2
+ * the IPv6 address should be enclosed in square brackets
+ */
+
+const common = require('../common');
+const assert = require('assert');
+const http = require('http');
+
+const hostname = '::1';
+const port = common.PORT;
+
+function httpreq() {
+ var req = http.request({
+ host: hostname,
+ port: port,
+ path: '/',
+ method: 'GET'
+ });
+ req.end();
+}
+
+if (!common.hasIPv6) {
+ console.error('Skipping test, no IPv6 support');
+ return;
+}
+
+const server = http.createServer(common.mustCall(function(req, res) {
+ assert.ok(req.headers.host, `[${hostname}]`);
+ res.end();
+ server.close(true);
+}));
+
+server.listen(port, hostname, () => httpreq());
diff --git a/test/parallel/test-net-socket-timeout-unref.js b/test/parallel/test-net-socket-timeout-unref.js
index b7ed0ec344a996..bbc2dffcc15336 100644
--- a/test/parallel/test-net-socket-timeout-unref.js
+++ b/test/parallel/test-net-socket-timeout-unref.js
@@ -1,39 +1,35 @@
'use strict';
-var common = require('../common');
-var assert = require('assert');
-var net = require('net');
-var server = net.createServer(function(c) {
+// Test that unref'ed sockets with timeouts do not prevent exit.
+
+const common = require('../common');
+const net = require('net');
+
+const server = net.createServer(function(c) {
c.write('hello');
c.unref();
});
server.listen(common.PORT);
server.unref();
-var timedout = false;
var connections = 0;
-var sockets = [];
-var delays = [8, 5, 3, 6, 2, 4];
+const sockets = [];
+const delays = [8, 5, 3, 6, 2, 4];
delays.forEach(function(T) {
- var socket = net.createConnection(common.PORT, 'localhost');
- socket.on('connect', function() {
+ const socket = net.createConnection(common.PORT, 'localhost');
+ socket.on('connect', common.mustCall(function() {
if (++connections === delays.length) {
sockets.forEach(function(s) {
- s[0].setTimeout(s[1] * 1000, function() {
- timedout = true;
- s[0].destroy();
+ s.socket.setTimeout(s.timeout, function() {
+ s.socket.destroy();
+ throw new Error('socket timed out unexpectedly');
});
- s[0].unref();
+ s.socket.unref();
});
}
- });
-
- sockets.push([socket, T]);
-});
+ }));
-process.on('exit', function() {
- assert.strictEqual(timedout, false,
- 'Socket timeout should not hold loop open');
+ sockets.push({socket: socket, timeout: T * 1000});
});
diff --git a/test/parallel/test-path.js b/test/parallel/test-path.js
index eb49360defd169..f8fb94348d4d75 100644
--- a/test/parallel/test-path.js
+++ b/test/parallel/test-path.js
@@ -443,8 +443,18 @@ assert.equal(failures.length, 0, failures.join(''));
// path.isAbsolute tests
+assert.equal(path.win32.isAbsolute('/'), true);
+assert.equal(path.win32.isAbsolute('//'), true);
+assert.equal(path.win32.isAbsolute('//server'), true);
assert.equal(path.win32.isAbsolute('//server/file'), true);
assert.equal(path.win32.isAbsolute('\\\\server\\file'), true);
+assert.equal(path.win32.isAbsolute('\\\\server'), true);
+assert.equal(path.win32.isAbsolute('\\\\'), true);
+assert.equal(path.win32.isAbsolute('c'), false);
+assert.equal(path.win32.isAbsolute('c:'), false);
+assert.equal(path.win32.isAbsolute('c:\\'), true);
+assert.equal(path.win32.isAbsolute('c:/'), true);
+assert.equal(path.win32.isAbsolute('c://'), true);
assert.equal(path.win32.isAbsolute('C:/Users/'), true);
assert.equal(path.win32.isAbsolute('C:\\Users\\'), true);
assert.equal(path.win32.isAbsolute('C:cwd/another'), false);
diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js
index 2fa20eb75fd855..02ce8169caf3fe 100644
--- a/test/parallel/test-repl.js
+++ b/test/parallel/test-repl.js
@@ -24,7 +24,7 @@ var moduleFilename = require('path').join(common.fixturesDir, 'a');
console.error('repl test');
// function for REPL to run
-invoke_me = function(arg) {
+global.invoke_me = function(arg) {
return 'invoked ' + arg;
};
diff --git a/test/parallel/test-stdout-close-unref.js b/test/parallel/test-stdout-close-unref.js
index 37ab4987eebcaa..67c6141c963088 100644
--- a/test/parallel/test-stdout-close-unref.js
+++ b/test/parallel/test-stdout-close-unref.js
@@ -1,16 +1,30 @@
'use strict';
-require('../common');
-var assert = require('assert');
+const common = require('../common');
+const assert = require('assert');
+const spawn = require('child_process').spawn;
-var errs = 0;
+if (process.argv[2] === 'child') {
+ var errs = 0;
-process.stdin.resume();
-process.stdin._handle.close();
-process.stdin._handle.unref(); // Should not segfault.
-process.stdin.on('error', function(err) {
- errs++;
-});
+ process.stdin.resume();
+ process.stdin._handle.close();
+ process.stdin._handle.unref(); // Should not segfault.
+ process.stdin.on('error', function(err) {
+ errs++;
+ });
-process.on('exit', function() {
- assert.strictEqual(errs, 1);
-});
+ process.on('exit', function() {
+ assert.strictEqual(errs, 1);
+ });
+ return;
+}
+
+// Use spawn so that we can be sure that stdin has a _handle property.
+// Refs: https://github.com/nodejs/node/pull/5916
+const proc = spawn(process.execPath, [__filename, 'child'], { stdio: 'pipe' });
+
+proc.stderr.pipe(process.stderr);
+proc.on('exit', common.mustCall(function(exitCode) {
+ if (exitCode !== 0)
+ process.exitCode = exitCode;
+}));
diff --git a/test/parallel/test-vm-static-this.js b/test/parallel/test-vm-static-this.js
index a5f5ad9415a828..143e4e12216d5e 100644
--- a/test/parallel/test-vm-static-this.js
+++ b/test/parallel/test-vm-static-this.js
@@ -14,25 +14,25 @@ assert.throws(function() {
vm.runInThisContext('throw new Error(\'test\');');
}, /test/);
-hello = 5;
+global.hello = 5;
vm.runInThisContext('hello = 2');
-assert.equal(2, hello);
+assert.equal(2, global.hello);
console.error('pass values');
-code = 'foo = 1;' +
+var code = 'foo = 1;' +
'bar = 2;' +
'if (typeof baz !== \'undefined\') throw new Error(\'test fail\');';
-foo = 2;
-obj = { foo: 0, baz: 3 };
+global.foo = 2;
+global.obj = { foo: 0, baz: 3 };
/* eslint-disable no-unused-vars */
var baz = vm.runInThisContext(code);
/* eslint-enable no-unused-vars */
-assert.equal(0, obj.foo);
-assert.equal(2, bar);
-assert.equal(1, foo);
+assert.equal(0, global.obj.foo);
+assert.equal(2, global.bar);
+assert.equal(1, global.foo);
console.error('call a function');
-f = function() { foo = 100; };
+global.f = function() { global.foo = 100; };
vm.runInThisContext('f()');
-assert.equal(100, foo);
+assert.equal(100, global.foo);
diff --git a/test/sequential/test-module-loading.js b/test/sequential/test-module-loading.js
index a6f9488f5f8092..d4799691b4e5be 100644
--- a/test/sequential/test-module-loading.js
+++ b/test/sequential/test-module-loading.js
@@ -252,7 +252,7 @@ assert.throws(function() {
assert.throws(function() {
console.error('require empty string');
require('');
-}, 'missing path');
+}, /missing path/);
process.on('exit', function() {
assert.ok(a.A instanceof Function);
diff --git a/tools/test.py b/tools/test.py
index 9b5dcd735f892b..3cd2778930c8ab 100755
--- a/tools/test.py
+++ b/tools/test.py
@@ -1523,10 +1523,15 @@ def Main():
if not exists(vm):
print "Can't find shell executable: '%s'" % vm
continue
+ archEngineContext = Execute([vm, "-p", "process.arch"], context)
+ vmArch = archEngineContext.stdout.rstrip()
+ if archEngineContext.exit_code is not 0 or vmArch == "undefined":
+ print "Can't determine the arch of: '%s'" % vm
+ continue
env = {
'mode': mode,
'system': utils.GuessOS(),
- 'arch': arch,
+ 'arch': vmArch,
}
test_list = root.ListTests([], path, context, arch, mode)
unclassified_tests += test_list