From f3861c200dfa9d7f050117df870ae8df410100f2 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 5 Nov 2016 19:08:31 -0700 Subject: [PATCH 001/313] lib,test: remove unneeded escaping of / The `/` character does not need to be escaped when occurring inside a character class in a regular expression. Remove such instances of escaping in the code base. PR-URL: https://github.com/nodejs/node/pull/9485 Reviewed-By: Prince John Wesley Reviewed-By: Colin Ihrig Reviewed-By: Teddy Katz Reviewed-By: James M Snell Reviewed-By: Roman Reiss --- lib/fs.js | 8 ++++---- lib/url.js | 2 +- test/debugger/test-debugger-repl-break-in-module.js | 6 +++--- test/parallel/test-require-json.js | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index fd088d97caa144..a49a7d2e86ccad 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -1566,13 +1566,13 @@ fs.unwatchFile = function(filename, listener) { // Regexp that finds the next portion of a (partial) path // result is [base_with_slash, base], e.g. ['somedir/', 'somedir'] const nextPartRe = isWindows ? - /(.*?)(?:[\/\\]+|$)/g : - /(.*?)(?:[\/]+|$)/g; + /(.*?)(?:[/\\]+|$)/g : + /(.*?)(?:[/]+|$)/g; // Regex to find the device root, including trailing slash. E.g. 'c:\\'. const splitRootRe = isWindows ? - /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/ : - /^[\/]*/; + /^(?:[a-zA-Z]:|[\\/]{2}[^\\/]+[\\/][^\\/]+)?[\\/]*/ : + /^[/]*/; function encodeRealpathResult(result, options, err) { if (!options || !options.encoding || options.encoding === 'utf8' || err) diff --git a/lib/url.js b/lib/url.js index 9cfcb54dd3f8ad..d620b9bc71b655 100644 --- a/lib/url.js +++ b/lib/url.js @@ -200,7 +200,7 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { // user@server is *always* interpreted as a hostname, and url // resolution will treat //foo/bar as host=foo,path=bar because that's // how the browser resolves relative URLs. - if (slashesDenoteHost || proto || /^\/\/[^@\/]+@[^@\/]+/.test(rest)) { + if (slashesDenoteHost || proto || /^\/\/[^@/]+@[^@/]+/.test(rest)) { var slashes = rest.charCodeAt(0) === 47/*/*/ && rest.charCodeAt(1) === 47/*/*/; if (slashes && !(proto && hostlessProtocol[proto])) { diff --git a/test/debugger/test-debugger-repl-break-in-module.js b/test/debugger/test-debugger-repl-break-in-module.js index d855dc64f4aa25..91782ae6e3ef28 100644 --- a/test/debugger/test-debugger-repl-break-in-module.js +++ b/test/debugger/test-debugger-repl-break-in-module.js @@ -20,7 +20,7 @@ repl.addTest('sb(")^$*+?}{|][(.js\\\\", 1)', [ // continue - the breakpoint should be triggered repl.addTest('c', [ - /break in .*[\\\/]mod\.js:2/, + /break in .*[\\/]mod\.js:2/, /1/, /2/, /3/, /4/ ]); @@ -42,7 +42,7 @@ repl.addTest('restart', [].concat( // continue - the breakpoint should be triggered repl.addTest('c', [ - /break in .*[\\\/]mod\.js:2/, + /break in .*[\\/]mod\.js:2/, /1/, /2/, /3/, /4/ ]); @@ -53,7 +53,7 @@ repl.addTest('cb("mod.js", 2)', [ ]); repl.addTest('c', [ - /break in .*[\\\/]main\.js:4/, + /break in .*[\\/]main\.js:4/, /2/, /3/, /4/, /5/, /6/ ]); diff --git a/test/parallel/test-require-json.js b/test/parallel/test-require-json.js index be9f5f0aaad19e..75cdb98855e6ee 100644 --- a/test/parallel/test-require-json.js +++ b/test/parallel/test-require-json.js @@ -6,7 +6,7 @@ var assert = require('assert'); try { require(path.join(common.fixturesDir, 'invalid.json')); } catch (err) { - var re = /test[\/\\]fixtures[\/\\]invalid.json: Unexpected string/; + var re = /test[/\\]fixtures[/\\]invalid.json: Unexpected string/; var i = err.message.match(re); assert.notStrictEqual(null, i, 'require() json error should include path'); } From e97c610850e68e7871db0aefc50142e7c605ba8e Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 5 Nov 2016 19:20:17 -0700 Subject: [PATCH 002/313] test: fix helper-debugger-repl.js The test `debugger/test-debugger-repl-break-in-module` (and probably others) was failing because the handshake message for debugging is no longer `listening on port ` but is instead `listening on
:`. This change makes the check less strict so as to hopefully future-proof it at least a little bit against subsequent changes. This test failure is not caught in CI because currently debugger tests are not run in CI. PR-URL: https://github.com/nodejs/node/pull/9486 Reviewed-By: Colin Ihrig Reviewed-By: Santiago Gimeno Reviewed-By: James M Snell Reviewed-By: Minwoo Jung Reviewed-By: Prince John Wesley --- test/debugger/helper-debugger-repl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/debugger/helper-debugger-repl.js b/test/debugger/helper-debugger-repl.js index d7a5e745de0ebd..602ab1c05e53d6 100644 --- a/test/debugger/helper-debugger-repl.js +++ b/test/debugger/helper-debugger-repl.js @@ -108,7 +108,7 @@ function addTest(input, output) { } var handshakeLines = [ - /listening on port \d+/, + /listening on /, /connecting.* ok/ ]; From 9808985689cdc533c4c909435fedec9b1e6135b3 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sat, 5 Nov 2016 20:45:16 -0700 Subject: [PATCH 003/313] test: move timer-dependent test to sequential `test-regress-GH-897` is dependent on a timer firing within a period of time. Especially on some of the FreeBSD hosts on CI, we have seen tests like that fail when run in parallel. (This may have nothing to do with FreeBSD and may just mean that the hosts are resource-constrained.) Move this test to sequential as we have done with several other timer-dependent tests recently. The test has also been refactored and documented via comments. PR-URL: https://github.com/nodejs/node/pull/9487 Reviewed-By: Colin Ihrig Reviewed-By: Santiago Gimeno Reviewed-By: Minwoo Jung --- test/parallel/test-regress-GH-897.js | 15 --------------- test/sequential/test-regress-GH-897.js | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 15 deletions(-) delete mode 100644 test/parallel/test-regress-GH-897.js create mode 100644 test/sequential/test-regress-GH-897.js diff --git a/test/parallel/test-regress-GH-897.js b/test/parallel/test-regress-GH-897.js deleted file mode 100644 index 1b46994dc37d94..00000000000000 --- a/test/parallel/test-regress-GH-897.js +++ /dev/null @@ -1,15 +0,0 @@ -'use strict'; -require('../common'); -var assert = require('assert'); - -var t = Date.now(); -var diff; -setTimeout(function() { - diff = Date.now() - t; - console.error(diff); -}, 0.1); - - -process.on('exit', function() { - assert.ok(diff < 100); -}); diff --git a/test/sequential/test-regress-GH-897.js b/test/sequential/test-regress-GH-897.js new file mode 100644 index 00000000000000..7b1297efd5a1b7 --- /dev/null +++ b/test/sequential/test-regress-GH-897.js @@ -0,0 +1,17 @@ +'use strict'; + +// Test for bug where a timer duration greater than 0 ms but less than 1 ms +// resulted in the duration being set for 1000 ms. The expected behavior is +// that the timeout would be set for 1 ms, and thus fire more-or-less +// immediately. +// +// Ref: https://github.com/nodejs/node-v0.x-archive/pull/897 + +const common = require('../common'); +const assert = require('assert'); + +const t = Date.now(); +setTimeout(common.mustCall(function() { + const diff = Date.now() - t; + assert.ok(diff < 100, `timer fired after ${diff} ms`); +}), 0.1); From 31a3328269ed4fafa327ed9c71f92582843a8d0e Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 6 Nov 2016 20:01:17 -0800 Subject: [PATCH 004/313] test: refactor make-callback-recurse test Move copy/pasted callback into its own function. PR-URL: https://github.com/nodejs/node/pull/9498 Reviewed-By: Colin Ihrig Reviewed-By: Jeremiah Senkpiel --- test/addons/make-callback-recurse/test.js | 36 ++++++----------------- 1 file changed, 9 insertions(+), 27 deletions(-) diff --git a/test/addons/make-callback-recurse/test.js b/test/addons/make-callback-recurse/test.js index 67cc479c5af474..0145a142e40f09 100644 --- a/test/addons/make-callback-recurse/test.js +++ b/test/addons/make-callback-recurse/test.js @@ -132,38 +132,20 @@ function checkDomains() { })); }), 1); - // Make sure nextTick, setImmediate and setTimeout can all recover properly - // after a thrown makeCallback call. - process.nextTick(common.mustCall(function() { + function testTimer(id) { + // Make sure nextTick, setImmediate and setTimeout can all recover properly + // after a thrown makeCallback call. const d = domain.create(); d.on('error', common.mustCall(function(e) { - assert.strictEqual(e.message, 'throw from domain 3'); + assert.strictEqual(e.message, `throw from domain ${id}`); })); makeCallback({domain: d}, function() { - throw new Error('throw from domain 3'); + throw new Error(`throw from domain ${id}`); }); throw new Error('UNREACHABLE'); - })); + } - setImmediate(common.mustCall(function() { - const d = domain.create(); - d.on('error', common.mustCall(function(e) { - assert.strictEqual(e.message, 'throw from domain 2'); - })); - makeCallback({domain: d}, function() { - throw new Error('throw from domain 2'); - }); - throw new Error('UNREACHABLE'); - })); - - setTimeout(common.mustCall(function() { - const d = domain.create(); - d.on('error', common.mustCall(function(e) { - assert.strictEqual(e.message, 'throw from domain 1'); - })); - makeCallback({domain: d}, function() { - throw new Error('throw from domain 1'); - }); - throw new Error('UNREACHABLE'); - })); + process.nextTick(common.mustCall(testTimer), 3); + setImmediate(common.mustCall(testTimer), 2); + setTimeout(common.mustCall(testTimer), 1, 1); } From 0db54ab98ed510cb30d5845dd9929658fcc355a5 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 6 Nov 2016 20:20:03 -0800 Subject: [PATCH 005/313] test: refactor inspector-helper.js There are two instances of `setTimeout()` called without a duration in `inspector-helper.js`. Change to `setImmediate()` for clarity that it isn't a mistake. PR-URL: https://github.com/nodejs/node/pull/9499 Reviewed-By: Colin Ihrig Reviewed-By: Jeremiah Senkpiel Reviewed-By: James M Snell Reviewed-By: Eugene Ostroukhov Reviewed-By: Prince John Wesley Reviewed-By: Luigi Pinca --- test/inspector/inspector-helper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/inspector/inspector-helper.js b/test/inspector/inspector-helper.js index 76fb33dba2be4d..a02b6b9a5bc506 100644 --- a/test/inspector/inspector-helper.js +++ b/test/inspector/inspector-helper.js @@ -259,7 +259,7 @@ TestSession.prototype.expectStderrOutput = function(regexp) { TestSession.prototype.runNext_ = function() { if (this.task_) { - setTimeout(() => { + setImmediate(() => { this.task_(() => { this.task_ = this.task_.next_; this.runNext_(); @@ -338,7 +338,7 @@ Harness.prototype.addStderrFilter = function(regexp, callback) { }; Harness.prototype.run_ = function() { - setTimeout(() => { + setImmediate(() => { this.task_(() => { this.task_ = this.task_.next_; if (this.task_) From d8eb4c2595d772ea370353d3721f93b8dca566f1 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 9 Nov 2016 21:02:14 -0800 Subject: [PATCH 006/313] test: refactor test-tls-inception MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * buffer-to-string comparison replaced with string-to-string comparison * equal -> strictEqual * var -> const * rename identifiers to avoid masking PR-URL: https://github.com/nodejs/node/pull/9536 Reviewed-By: Santiago Gimeno Reviewed-By: Michaël Zasso Reviewed-By: Michael Dawson Reviewed-By: Colin Ihrig --- test/parallel/test-tls-inception.js | 36 ++++++++++++++--------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/test/parallel/test-tls-inception.js b/test/parallel/test-tls-inception.js index ce6f60dc97a12e..760887d9f25264 100644 --- a/test/parallel/test-tls-inception.js +++ b/test/parallel/test-tls-inception.js @@ -1,34 +1,33 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); -var fs = require('fs'); -var path = require('path'); -var net = require('net'); +const assert = require('assert'); +const tls = require('tls'); -var options, a, b; +const fs = require('fs'); +const path = require('path'); +const net = require('net'); -var body = Buffer.alloc(400000, 'A'); - -options = { +const options = { key: fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem')), cert: fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem')) }; +const body = 'A'.repeat(40000); + // the "proxy" server -a = tls.createServer(options, function(socket) { - var options = { +const a = tls.createServer(options, function(socket) { + const myOptions = { host: '127.0.0.1', port: b.address().port, rejectUnauthorized: false }; - var dest = net.connect(options); + const dest = net.connect(myOptions); dest.pipe(socket); socket.pipe(dest); @@ -38,20 +37,19 @@ a = tls.createServer(options, function(socket) { }); // the "target" server -b = tls.createServer(options, function(socket) { +const b = tls.createServer(options, function(socket) { socket.end(body); }); a.listen(0, function() { b.listen(0, function() { - options = { + const myOptions = { host: '127.0.0.1', port: a.address().port, rejectUnauthorized: false }; - var socket = tls.connect(options); - var ssl; - ssl = tls.connect({ + const socket = tls.connect(myOptions); + const ssl = tls.connect({ socket: socket, rejectUnauthorized: false }); @@ -61,7 +59,7 @@ a.listen(0, function() { buf += data; }); ssl.on('end', common.mustCall(function() { - assert.equal(buf, body); + assert.strictEqual(buf, body); ssl.end(); a.close(); b.close(); From 64d7ea9ce484e35a13d612803a6aeaf7aaa531f3 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 9 Nov 2016 22:09:56 -0800 Subject: [PATCH 007/313] test: refactor test-next-tick-error-spin * use common.mustCall() * setTimeout() -> setImmediate() * assert() -> assert.strictEqual() * var -> const * remove unneeded console.log() * remove commented-out code PR-URL: https://github.com/nodejs/node/pull/9537 Reviewed-By: Michael Dawson Reviewed-By: Colin Ihrig --- test/sequential/test-next-tick-error-spin.js | 25 +++++++++----------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/test/sequential/test-next-tick-error-spin.js b/test/sequential/test-next-tick-error-spin.js index 7a76ab1e12df68..911d99d7416db5 100644 --- a/test/sequential/test-next-tick-error-spin.js +++ b/test/sequential/test-next-tick-error-spin.js @@ -1,24 +1,23 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); if (process.argv[2] !== 'child') { - var spawn = require('child_process').spawn; - var child = spawn(process.execPath, [__filename, 'child'], { + const spawn = require('child_process').spawn; + const child = spawn(process.execPath, [__filename, 'child'], { stdio: 'pipe'//'inherit' }); - var timer = setTimeout(function() { + const timer = setTimeout(function() { throw new Error('child is hung'); }, common.platformTimeout(3000)); - child.on('exit', function(code) { - console.error('ok'); - assert(!code); + child.on('exit', common.mustCall(function(code) { + assert.strictEqual(code, 0); clearTimeout(timer); - }); + })); } else { - var domain = require('domain'); - var d = domain.create(); + const domain = require('domain'); + const d = domain.create(); process.maxTickDepth = 10; // in the error handler, we trigger several MakeCallback events @@ -40,10 +39,8 @@ if (process.argv[2] !== 'child') { } f(); - setTimeout(function() { + setImmediate(function() { console.error('broke in!'); - //process.stdout.close(); - //process.stderr.close(); process.exit(0); }); } From 92f80738792de2006913c3645600d49fbce0b3a1 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Sat, 12 Nov 2016 16:26:52 +0900 Subject: [PATCH 008/313] test: improve test-stream2-objects.js This commit improves the test cases in test-stream2-objects.js by using assert.strictEqual instead of assert.equal. This is a part of Code And Learn at NodeFest 2016 Fixes: https://github.com/nodejs/code-and-learn/issues/58 PR-URL: https://github.com/nodejs/node/pull/9565 Reviewed-By: Shigeki Ohtsu Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca --- test/parallel/test-stream2-objects.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/parallel/test-stream2-objects.js b/test/parallel/test-stream2-objects.js index da0a8d3b41cde9..b18be26dc530fb 100644 --- a/test/parallel/test-stream2-objects.js +++ b/test/parallel/test-stream2-objects.js @@ -33,7 +33,7 @@ function run() { // ensure all tests have run process.on('exit', function() { - assert.equal(count, 0); + assert.strictEqual(count, 0); }); process.nextTick(run); @@ -210,16 +210,16 @@ test('high watermark _read', function(t) { var v = r.read(); - assert.equal(calls, 0); - assert.equal(v, '1'); + assert.strictEqual(calls, 0); + assert.strictEqual(v, '1'); var v2 = r.read(); - assert.equal(v2, '2'); + assert.strictEqual(v2, '2'); var v3 = r.read(); - assert.equal(v3, '3'); + assert.strictEqual(v3, '3'); - assert.equal(calls, 1); + assert.strictEqual(calls, 1); t.end(); }); @@ -232,7 +232,7 @@ test('high watermark push', function(t) { r._read = function(n) {}; for (var i = 0; i < 6; i++) { var bool = r.push(i); - assert.equal(bool, i === 5 ? false : true); + assert.strictEqual(bool, i !== 5); } t.end(); @@ -309,7 +309,7 @@ test('buffers finish until cb is called', function(t) { var called = false; w._write = function(chunk, encoding, cb) { - assert.equal(chunk, 'foo'); + assert.strictEqual(chunk, 'foo'); process.nextTick(function() { called = true; @@ -318,7 +318,7 @@ test('buffers finish until cb is called', function(t) { }; w.on('finish', function() { - assert.equal(called, true); + assert.strictEqual(called, true); t.end(); }); From 8a94c69c7934bcee310d417ef0886f580efdd259 Mon Sep 17 00:00:00 2001 From: MURAKAMI Masahiko Date: Sat, 12 Nov 2016 17:04:42 +0900 Subject: [PATCH 009/313] test: change from setTimeout to setImmediate This is a part of Code And Learn at NodeFest 2016 Challenge Fixes: https://github.com/nodejs/code-and-learn/issues/58 PR-URL: https://github.com/nodejs/node/pull/9578 Reviewed-By: Yosuke Furukawa Reviewed-By: Shigeki Ohtsu Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen --- test/parallel/test-stream-unshift-empty-chunk.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-stream-unshift-empty-chunk.js b/test/parallel/test-stream-unshift-empty-chunk.js index 99c2e8b7520144..477f5c4be56bac 100644 --- a/test/parallel/test-stream-unshift-empty-chunk.js +++ b/test/parallel/test-stream-unshift-empty-chunk.js @@ -11,7 +11,7 @@ var nChunks = 10; var chunk = Buffer.alloc(10, 'x'); r._read = function(n) { - setTimeout(function() { + setImmediate(function() { r.push(--nChunks === 0 ? null : chunk); }); }; From 7bd9ecdb144a4e67a1e7f09fcf52b8785931c293 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 10 Nov 2016 11:26:20 -0800 Subject: [PATCH 010/313] test: refactor test-zlib.js * minor layout changes for clarity * assert.equal() and assert.ok() swapped out for assert.strictEqual() * var -> const for modules included via require() PR-URL: https://github.com/nodejs/node/pull/9544 Reviewed-By: Evan Lucas Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Michael Dawson --- test/parallel/test-zlib.js | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/test/parallel/test-zlib.js b/test/parallel/test-zlib.js index 044b71db1bddd0..522916e45cf01a 100644 --- a/test/parallel/test-zlib.js +++ b/test/parallel/test-zlib.js @@ -3,13 +3,17 @@ const common = require('../common'); const assert = require('assert'); const zlib = require('zlib'); const path = require('path'); - -var zlibPairs = - [[zlib.Deflate, zlib.Inflate], - [zlib.Gzip, zlib.Gunzip], - [zlib.Deflate, zlib.Unzip], - [zlib.Gzip, zlib.Unzip], - [zlib.DeflateRaw, zlib.InflateRaw]]; +const fs = require('fs'); +const util = require('util'); +const stream = require('stream'); + +var zlibPairs = [ + [zlib.Deflate, zlib.Inflate], + [zlib.Gzip, zlib.Gunzip], + [zlib.Deflate, zlib.Unzip], + [zlib.Gzip, zlib.Unzip], + [zlib.DeflateRaw, zlib.InflateRaw] +]; // how fast to trickle through the slowstream var trickle = [128, 1024, 1024 * 1024]; @@ -36,8 +40,6 @@ if (!process.env.PUMMEL) { strategy = [0]; } -var fs = require('fs'); - var testFiles = ['person.jpg', 'elipses.txt', 'empty.txt']; if (process.env.FAST) { @@ -45,14 +47,11 @@ if (process.env.FAST) { testFiles = ['person.jpg']; } -var tests = {}; +const tests = {}; testFiles.forEach(function(file) { tests[file] = fs.readFileSync(path.resolve(common.fixturesDir, file)); }); -var util = require('util'); -var stream = require('stream'); - // stream that saves everything function BufferStream() { @@ -197,11 +196,16 @@ Object.keys(tests).forEach(function(file) { ss.pipe(def).pipe(inf).pipe(buf); ss.end(test); }); - }); }); }); }); }); }); // sad stallman is sad. + }); + }); + }); + }); + }); + }); }); process.on('exit', function(code) { console.log('1..' + done); - assert.equal(done, total, (total - done) + ' tests left unfinished'); - assert.ok(!failures, 'some test failures'); + assert.strictEqual(done, total, (total - done) + ' tests left unfinished'); + assert.strictEqual(failures, 0, 'some test failures'); }); From f7a2f75fa99cbfc46c62f36872630e0e3612f51d Mon Sep 17 00:00:00 2001 From: Jeremiah Senkpiel Date: Fri, 11 Nov 2016 15:57:18 -0500 Subject: [PATCH 011/313] test: increase coverage of process.emitWarning Previously our tests did not check these codepaths as seen at coverage.nodejs.org PR-URL: https://github.com/nodejs/node/pull/9556 Reviewed-By: Colin Ihrig Reviewed-By: Michael Dawson Reviewed-By: Anna Henningsen --- test/parallel/test-process-emitwarning.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-process-emitwarning.js b/test/parallel/test-process-emitwarning.js index 33547377bb901b..651bdbd1abc1ed 100644 --- a/test/parallel/test-process-emitwarning.js +++ b/test/parallel/test-process-emitwarning.js @@ -10,10 +10,12 @@ process.on('warning', common.mustCall((warning) => { assert(warning); assert(/^(Warning|CustomWarning)/.test(warning.name)); assert(warning.message, 'A Warning'); -}, 3)); +}, 7)); process.emitWarning('A Warning'); process.emitWarning('A Warning', 'CustomWarning'); +process.emitWarning('A Warning', CustomWarning); +process.emitWarning('A Warning', 'CustomWarning', CustomWarning); function CustomWarning() { Error.call(this); @@ -24,6 +26,16 @@ function CustomWarning() { util.inherits(CustomWarning, Error); process.emitWarning(new CustomWarning()); +const warningNoToString = new CustomWarning(); +warningNoToString.toString = null; +process.emitWarning(warningNoToString); + +const warningThrowToString = new CustomWarning(); +warningThrowToString.toString = function() { + throw new Error('invalid toString'); +}; +process.emitWarning(warningThrowToString); + // TypeError is thrown on invalid output assert.throws(() => process.emitWarning(1), TypeError); assert.throws(() => process.emitWarning({}), TypeError); From 2c5e6afd97fce23ed2440e99da95ffe25509b3de Mon Sep 17 00:00:00 2001 From: Jeremiah Senkpiel Date: Fri, 11 Nov 2016 15:28:18 -0500 Subject: [PATCH 012/313] test: ensure nextTick is not scheduled in exit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Previously our tests did not check this codepath as seen at coverage.nodejs.org PR-URL: https://github.com/nodejs/node/pull/9555 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Michaël Zasso --- test/parallel/test-next-tick-when-exiting.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 test/parallel/test-next-tick-when-exiting.js diff --git a/test/parallel/test-next-tick-when-exiting.js b/test/parallel/test-next-tick-when-exiting.js new file mode 100644 index 00000000000000..1bb4c914d01869 --- /dev/null +++ b/test/parallel/test-next-tick-when-exiting.js @@ -0,0 +1,14 @@ +'use strict'; + +const common = require('../common'); +const assert = require('assert'); + +process.on('exit', () => { + assert.strictEqual(process._exiting, true, 'process._exiting was not set!'); + + process.nextTick(() => { + common.fail('process is exiting, should not be called.'); + }); +}); + +process.exit(); From 14fead029967dbed4bc8ed214aa10e7b6181174d Mon Sep 17 00:00:00 2001 From: cjihrig Date: Wed, 9 Nov 2016 10:08:23 -0500 Subject: [PATCH 013/313] test: add test for broken child process stdio This commit adds a test for the scenario where a child process is spawned, but the stdio streams could not be created. PR-URL: https://github.com/nodejs/node/pull/9528 Reviewed-By: Daniel Bevenius Reviewed-By: Rich Trott Reviewed-By: Santiago Gimeno Reviewed-By: Michael Dawson --- test/parallel/test-child-process-bad-stdio.js | 63 +++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 test/parallel/test-child-process-bad-stdio.js diff --git a/test/parallel/test-child-process-bad-stdio.js b/test/parallel/test-child-process-bad-stdio.js new file mode 100644 index 00000000000000..e92bbcf11fbac8 --- /dev/null +++ b/test/parallel/test-child-process-bad-stdio.js @@ -0,0 +1,63 @@ +'use strict'; +// Flags: --expose_internals +const common = require('../common'); +const assert = require('assert'); +const cp = require('child_process'); + +if (process.argv[2] === 'child') { + setTimeout(() => {}, common.platformTimeout(100)); + return; +} + +// Monkey patch spawn() to create a child process normally, but destroy the +// stdout and stderr streams. This replicates the conditions where the streams +// cannot be properly created. +const ChildProcess = require('internal/child_process').ChildProcess; +const original = ChildProcess.prototype.spawn; + +ChildProcess.prototype.spawn = function() { + const err = original.apply(this, arguments); + + this.stdout.destroy(); + this.stderr.destroy(); + this.stdout = null; + this.stderr = null; + + return err; +}; + +function createChild(options, callback) { + const cmd = `${process.execPath} ${__filename} child`; + + return cp.exec(cmd, options, common.mustCall(callback)); +} + +// Verify that normal execution of a child process is handled. +{ + createChild({}, (err, stdout, stderr) => { + assert.strictEqual(err, null); + assert.strictEqual(stdout, ''); + assert.strictEqual(stderr, ''); + }); +} + +// Verify that execution with an error event is handled. +{ + const error = new Error('foo'); + const child = createChild({}, (err, stdout, stderr) => { + assert.strictEqual(err, error); + assert.strictEqual(stdout, ''); + assert.strictEqual(stderr, ''); + }); + + child.emit('error', error); +} + +// Verify that execution with a killed process is handled. +{ + createChild({ timeout: 1 }, (err, stdout, stderr) => { + assert.strictEqual(err.killed, true); + assert.strictEqual(stdout, ''); + assert.strictEqual(stderr, ''); + }); +} From 7e031170a6fc1dc458032f382e35ee0a5166cfce Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Fri, 21 Oct 2016 22:57:17 +0200 Subject: [PATCH 014/313] test: check that `process.execPath` is a realpath This test is only here to ensure consistent cross-platform behaviour. PR-URL: https://github.com/nodejs/node/pull/9229 Reviewed-By: Evan Lucas Reviewed-By: Ben Noordhuis --- test/parallel/test-process-execpath.js | 28 ++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 test/parallel/test-process-execpath.js diff --git a/test/parallel/test-process-execpath.js b/test/parallel/test-process-execpath.js new file mode 100644 index 00000000000000..5ac8a3f2238a7c --- /dev/null +++ b/test/parallel/test-process-execpath.js @@ -0,0 +1,28 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); +const child_process = require('child_process'); +const path = require('path'); +const fs = require('fs'); + +assert.strictEqual(process.execPath, fs.realpathSync(process.execPath)); + +if (common.isWindows) { + common.skip('symlinks are weird on windows'); + return; +} + +if (process.argv[2] === 'child') { + // The console.log() output is part of the test here. + console.log(process.execPath); +} else { + common.refreshTmpDir(); + + const symlinkedNode = path.join(common.tmpDir, 'symlinked-node'); + fs.symlinkSync(process.execPath, symlinkedNode); + + const proc = child_process.spawnSync(symlinkedNode, [__filename, 'child']); + assert.strictEqual(proc.stderr.toString(), ''); + assert.strictEqual(proc.stdout.toString(), `${process.execPath}\n`); + assert.strictEqual(proc.status, 0); +} From 70691e3c53677983020ff35335a258f0ae77c1c8 Mon Sep 17 00:00:00 2001 From: Yoshiya Hinosawa Date: Sat, 12 Nov 2016 17:16:03 +0900 Subject: [PATCH 015/313] test: add test case of PassThrough This commit adds the test case of PassThrough. This test case checks that PassThrough can construct without new operator. This is a part of Code And Learn at NodeFest 2016 Fixes: https://github.com/nodejs/code-and-learn/issues/58 PR-URL: https://github.com/nodejs/node/pull/9581 Reviewed-By: Yosuke Furukawa Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: Shigeki Ohtsu --- test/parallel/test-stream2-transform.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/parallel/test-stream2-transform.js b/test/parallel/test-stream2-transform.js index bc812ff30d6937..6a4036681f90b7 100644 --- a/test/parallel/test-stream2-transform.js +++ b/test/parallel/test-stream2-transform.js @@ -106,6 +106,14 @@ test('object passthrough', function(t) { t.end(); }); +test('passthrough constructor', function(t) { + const pt = PassThrough(); + + assert(pt instanceof PassThrough); + + t.end(); +}); + test('simple transform', function(t) { var pt = new Transform(); pt._transform = function(c, e, cb) { From 1bb626610af8505d77a1bedc707493d9b79736fd Mon Sep 17 00:00:00 2001 From: "masashi.g" Date: Sat, 12 Nov 2016 22:56:19 +0900 Subject: [PATCH 016/313] test: use setImmediate() in test of stream2 use setImmediate() insted of setTimeout() in test of stream2 push. The test is in test/parallel/test-stream2-push.js Fixes: https://github.com/nodejs/code-and-learn/issues/58 PR-URL: https://github.com/nodejs/node/pull/9583 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: Shigeki Ohtsu --- test/parallel/test-stream2-push.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-stream2-push.js b/test/parallel/test-stream2-push.js index a7ff95e7482015..445a186715b659 100644 --- a/test/parallel/test-stream2-push.js +++ b/test/parallel/test-stream2-push.js @@ -111,7 +111,7 @@ function end() { source.emit('end'); assert(!reading); writer.end(stream.read()); - setTimeout(function() { + setImmediate(function() { assert(ended); }); } From 333e5d1c499b2d5b39022171dbc3659720022f75 Mon Sep 17 00:00:00 2001 From: Bethany Griggs Date: Tue, 15 Nov 2016 11:14:16 +0000 Subject: [PATCH 017/313] test: run tests even if os.cpus() fails Currently if the os.cpus() call fails every test will fail. As there is already a test for os.cpus(), the other tests should run even if the os.cpus() call fails. PR-URL: https://github.com/nodejs/node/pull/9616 Reviewed-By: Gibson Fahnestock Reviewed-By: Colin Ihrig Reviewed-By: Michael Dawson Reviewed-By: Evan Lucas Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell --- test/common.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/common.js b/test/common.js index d1d9c7876faa5c..a428bd98032a02 100644 --- a/test/common.js +++ b/test/common.js @@ -32,7 +32,8 @@ exports.isOSX = process.platform === 'darwin'; exports.enoughTestMem = os.totalmem() > 0x40000000; /* 1 Gb */ const cpus = os.cpus(); -exports.enoughTestCpu = cpus.length > 1 || cpus[0].speed > 999; +exports.enoughTestCpu = Array.isArray(cpus) && + (cpus.length > 1 || cpus[0].speed > 999); exports.rootDir = exports.isWindows ? 'c:\\' : '/'; exports.buildType = process.config.target_defaults.default_configuration; From 31304144cdadf74415c7fa267b0ad3bdd7f6070c Mon Sep 17 00:00:00 2001 From: Aaron Petcoff Date: Thu, 17 Nov 2016 15:32:27 -0500 Subject: [PATCH 018/313] test: Use strictEqual in test-tls-writewrap-leak MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/9666 Reviewed-By: Myles Borins Reviewed-By: Gibson Fahnestock Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Sakthipriyan Vairamani Reviewed-By: James M Snell Reviewed-By: Luigi Pinca --- test/parallel/test-tls-writewrap-leak.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-tls-writewrap-leak.js b/test/parallel/test-tls-writewrap-leak.js index cc55192229531d..b1a6d6a1058a65 100644 --- a/test/parallel/test-tls-writewrap-leak.js +++ b/test/parallel/test-tls-writewrap-leak.js @@ -20,7 +20,7 @@ const server = net.createServer(common.mustCall((c) => { }); c.write('hello', common.mustCall((err) => { - assert.equal(err.code, 'ECANCELED'); + assert.strictEqual(err.code, 'ECANCELED'); server.close(); })); })); From 9e4ce6fc8ee511a8e885ee5c530f8ae12c0322e2 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 17 Nov 2016 10:25:57 -0800 Subject: [PATCH 019/313] test: refactor test-async-wrap-* * `assert.equal()` -> `assert.strictEqual()` * add duration to `setTimeout()` PR-URL: https://github.com/nodejs/node/pull/9663 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig Reviewed-By: Santiago Gimeno Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Prince John Wesley --- test/parallel/test-async-wrap-check-providers.js | 2 +- .../test-async-wrap-disabled-propagate-parent.js | 14 +++++++------- test/parallel/test-async-wrap-propagate-parent.js | 14 +++++++------- .../test-async-wrap-throw-from-callback.js | 6 +++--- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/test/parallel/test-async-wrap-check-providers.js b/test/parallel/test-async-wrap-check-providers.js index 28544538f1124a..a130e130e98a8e 100644 --- a/test/parallel/test-async-wrap-check-providers.js +++ b/test/parallel/test-async-wrap-check-providers.js @@ -41,7 +41,7 @@ async_wrap.setupHooks({ init }); async_wrap.enable(); -setTimeout(function() { }); +setTimeout(function() { }, 1); fs.stat(__filename, noop); diff --git a/test/parallel/test-async-wrap-disabled-propagate-parent.js b/test/parallel/test-async-wrap-disabled-propagate-parent.js index 5b6dd837de2774..4a6df7500956bf 100644 --- a/test/parallel/test-async-wrap-disabled-propagate-parent.js +++ b/test/parallel/test-async-wrap-disabled-propagate-parent.js @@ -18,12 +18,12 @@ function init(uid, type, parentUid, parentHandle) { cntr++; // Cannot assert in init callback or will abort. process.nextTick(() => { - assert.equal(providers[type], 'TCPWRAP'); - assert.equal(parentUid, server._handle[uidSymbol], - 'server uid doesn\'t match parent uid'); - assert.equal(parentHandle, server._handle, - 'server handle doesn\'t match parent handle'); - assert.equal(this, client._handle, 'client doesn\'t match context'); + assert.strictEqual(providers[type], 'TCPWRAP'); + assert.strictEqual(parentUid, server._handle[uidSymbol], + 'server uid doesn\'t match parent uid'); + assert.strictEqual(parentHandle, server._handle, + 'server handle doesn\'t match parent handle'); + assert.strictEqual(this, client._handle, 'client doesn\'t match context'); }); } } @@ -48,5 +48,5 @@ async_wrap.disable(); process.on('exit', function() { // init should have only been called once with a parent. - assert.equal(cntr, 1); + assert.strictEqual(cntr, 1); }); diff --git a/test/parallel/test-async-wrap-propagate-parent.js b/test/parallel/test-async-wrap-propagate-parent.js index a3902081ea7708..0968490f5975cc 100644 --- a/test/parallel/test-async-wrap-propagate-parent.js +++ b/test/parallel/test-async-wrap-propagate-parent.js @@ -18,12 +18,12 @@ function init(uid, type, parentUid, parentHandle) { cntr++; // Cannot assert in init callback or will abort. process.nextTick(() => { - assert.equal(providers[type], 'TCPWRAP'); - assert.equal(parentUid, server._handle[uidSymbol], - 'server uid doesn\'t match parent uid'); - assert.equal(parentHandle, server._handle, - 'server handle doesn\'t match parent handle'); - assert.equal(this, client._handle, 'client doesn\'t match context'); + assert.strictEqual(providers[type], 'TCPWRAP'); + assert.strictEqual(parentUid, server._handle[uidSymbol], + 'server uid doesn\'t match parent uid'); + assert.strictEqual(parentHandle, server._handle, + 'server handle doesn\'t match parent handle'); + assert.strictEqual(this, client._handle, 'client doesn\'t match context'); }); } } @@ -47,5 +47,5 @@ const server = net.createServer(function(c) { process.on('exit', function() { // init should have only been called once with a parent. - assert.equal(cntr, 1); + assert.strictEqual(cntr, 1); }); diff --git a/test/parallel/test-async-wrap-throw-from-callback.js b/test/parallel/test-async-wrap-throw-from-callback.js index e2e01e97ad6db9..93b5bee470ce3f 100644 --- a/test/parallel/test-async-wrap-throw-from-callback.js +++ b/test/parallel/test-async-wrap-throw-from-callback.js @@ -40,8 +40,8 @@ if (typeof process.argv[2] === 'string') { } else { process.on('exit', (code) => { - assert.equal(msgCalled, callbacks.length); - assert.equal(msgCalled, msgReceived); + assert.strictEqual(msgCalled, callbacks.length); + assert.strictEqual(msgCalled, msgReceived); }); callbacks.forEach((item) => { @@ -58,7 +58,7 @@ if (typeof process.argv[2] === 'string') { if (errstring.includes('Error: ' + item)) msgReceived++; - assert.equal(code, 1, `${item} closed with code ${code}`); + assert.strictEqual(code, 1, `${item} closed with code ${code}`); }); }); } From c5e806c89492d0775ea6f83942b95d48b86083aa Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 20 Nov 2016 21:12:09 -0800 Subject: [PATCH 020/313] test:refactor test-tls-hello-parser-failure * setTimeout() with no duration -> setImmediate() * add common.mustCall() where appropriate * var -> const * .on() -> .once() PR-URL: https://github.com/nodejs/node/pull/9715 Reviewed-By: Santiago Gimeno Reviewed-By: Colin Ihrig Reviewed-By: Michael Dawson Reviewed-By: Luigi Pinca --- .../parallel/test-tls-hello-parser-failure.js | 47 +++++++++---------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/test/parallel/test-tls-hello-parser-failure.js b/test/parallel/test-tls-hello-parser-failure.js index e5e43c408abfc6..f9c280f5e57a34 100644 --- a/test/parallel/test-tls-hello-parser-failure.js +++ b/test/parallel/test-tls-hello-parser-failure.js @@ -1,46 +1,43 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); + +const common = require('../common'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); -var net = require('net'); -var fs = require('fs'); +const assert = require('assert'); +const tls = require('tls'); + +const net = require('net'); +const fs = require('fs'); -var options = { +const options = { key: fs.readFileSync(common.fixturesDir + '/test_key.pem'), cert: fs.readFileSync(common.fixturesDir + '/test_cert.pem') }; -var bonkers = Buffer.alloc(1024 * 1024, 42); +const bonkers = Buffer.alloc(1024 * 1024, 42); -var server = tls.createServer(options, function(c) { +const server = tls.createServer(options, function(c) { -}).listen(0, function() { - var client = net.connect(this.address().port, function() { +}).listen(0, common.mustCall(function() { + const client = net.connect(this.address().port, common.mustCall(function() { client.write(bonkers); - }); + })); - var once = false; - - var writeAgain = setTimeout(function() { + const writeAgain = setImmediate(function() { client.write(bonkers); }); - client.on('error', function(err) { - if (!once) { - clearTimeout(writeAgain); - once = true; - client.destroy(); - server.close(); - } - }); + client.once('error', common.mustCall(function(err) { + clearImmediate(writeAgain); + client.destroy(); + server.close(); + })); - client.on('close', function(hadError) { + client.on('close', common.mustCall(function(hadError) { assert.strictEqual(hadError, true, 'Client never errored'); - }); -}); + })); +})); From 1296a689b69200110d770b63d24821e0d0d0447f Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 21 Nov 2016 13:13:58 -0800 Subject: [PATCH 021/313] test: fix flaky test-inspector Using `socket.destroy()` instead of `socket.end()` fixes more-than-intermittent ECONNRESET issues on Windows. PR-URL: https://github.com/nodejs/node/pull/9727 Fixes: https://github.com/nodejs/node/issues/8804 Reviewed-By: Gibson Fahnestock Reviewed-By: Eugene Ostroukhov --- test/inspector/inspector-helper.js | 2 +- test/inspector/inspector.status | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/test/inspector/inspector-helper.js b/test/inspector/inspector-helper.js index a02b6b9a5bc506..3e517123fe27f9 100644 --- a/test/inspector/inspector-helper.js +++ b/test/inspector/inspector-helper.js @@ -286,7 +286,7 @@ TestSession.prototype.disconnect = function(childDone) { this.expectClose_ = true; this.harness_.childInstanceDone = this.harness_.childInstanceDone || childDone; - this.socket_.end(); + this.socket_.destroy(); console.log('[test]', 'Connection terminated'); callback(); }); diff --git a/test/inspector/inspector.status b/test/inspector/inspector.status index 69865843c940fc..ed6a782b9031a7 100644 --- a/test/inspector/inspector.status +++ b/test/inspector/inspector.status @@ -7,4 +7,3 @@ prefix inspector [true] # This section applies to all platforms [$system==win32] -test-inspector : PASS,FLAKY From 75bebbf3a04ad495ce1569e0a671aa582f0ee098 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 21 Nov 2016 11:05:24 -0800 Subject: [PATCH 022/313] test: fix flaky test-dgram-empty-packet & friends * Liberal use of common.mustCall() * Rename test-dgram-empty-packet -> test-dgram-send-empty-packet * Remove use of timers to avoid CI failures like seen in the Ref below: ``` not ok 237 parallel/test-dgram-empty-packet --- duration_ms: 0.717 severity: fail stack: |- ... throw new Error('Timeout'); ^ Error: Timeout at Timeout._onTimeout ... at ontimeout (timers.js:365:14) at tryOnTimeout (timers.js:237:5) at Timer.listOnTimeout (timers.js:207:5) ``` Refs: https://ci.nodejs.org/job/node-test-commit-freebsd/5341/nodes=freebsd11-x64/console: PR-URL: https://github.com/nodejs/node/pull/9724 Reviewed-By: Santiago Gimeno --- test/parallel/test-dgram-empty-packet.js | 40 ------------------- test/parallel/test-dgram-send-empty-array.js | 16 +++++--- test/parallel/test-dgram-send-empty-buffer.js | 21 +++++----- test/parallel/test-dgram-send-empty-packet.js | 34 ++++++++++++++++ 4 files changed, 56 insertions(+), 55 deletions(-) delete mode 100644 test/parallel/test-dgram-empty-packet.js create mode 100644 test/parallel/test-dgram-send-empty-packet.js diff --git a/test/parallel/test-dgram-empty-packet.js b/test/parallel/test-dgram-empty-packet.js deleted file mode 100644 index 34bce4e07aede7..00000000000000 --- a/test/parallel/test-dgram-empty-packet.js +++ /dev/null @@ -1,40 +0,0 @@ -'use strict'; -const common = require('../common'); -const dgram = require('dgram'); - -let callbacks = 0; -let timer; - -if (common.isOSX) { - common.skip('because of 17894467 Apple bug'); - return; -} - -const client = dgram.createSocket('udp4'); - -client.bind(0, function() { - - function callback() { - callbacks++; - if (callbacks === 2) { - clearTimeout(timer); - client.close(); - } else if (callbacks > 2) { - throw new Error('the callbacks should be called only two times'); - } - } - - client.on('message', function(buffer, bytes) { - callback(); - }); - - const port = this.address().port; - client.send( - Buffer.allocUnsafe(1), 0, 0, port, '127.0.0.1', (err, len) => { - callback(); - }); - - timer = setTimeout(function() { - throw new Error('Timeout'); - }, 200); -}); diff --git a/test/parallel/test-dgram-send-empty-array.js b/test/parallel/test-dgram-send-empty-array.js index f9de345f112254..442803e6db8632 100644 --- a/test/parallel/test-dgram-send-empty-array.js +++ b/test/parallel/test-dgram-send-empty-array.js @@ -1,24 +1,30 @@ 'use strict'; const common = require('../common'); -const assert = require('assert'); -const dgram = require('dgram'); if (common.isOSX) { common.skip('because of 17894467 Apple bug'); return; } +const assert = require('assert'); +const dgram = require('dgram'); + const client = dgram.createSocket('udp4'); +var interval; + client.on('message', common.mustCall(function onMessage(buf, info) { const expected = Buffer.alloc(0); assert.ok(buf.equals(expected), 'message was received correctly'); + clearInterval(interval); client.close(); })); -client.on('listening', function() { - client.send([], this.address().port, common.localhostIPv4); -}); +client.on('listening', common.mustCall(function() { + interval = setInterval(function() { + client.send([], client.address().port, common.localhostIPv4); + }, 10); +})); client.bind(0); diff --git a/test/parallel/test-dgram-send-empty-buffer.js b/test/parallel/test-dgram-send-empty-buffer.js index ac541a9c243947..70e7e46e0a327e 100644 --- a/test/parallel/test-dgram-send-empty-buffer.js +++ b/test/parallel/test-dgram-send-empty-buffer.js @@ -1,26 +1,27 @@ 'use strict'; const common = require('../common'); -const dgram = require('dgram'); +const assert = require('assert'); if (common.isOSX) { common.skip('because of 17894467 Apple bug'); return; } +const dgram = require('dgram'); + const client = dgram.createSocket('udp4'); -client.bind(0, function() { +client.bind(0, common.mustCall(function() { const port = this.address().port; - client.on('message', common.mustCall(function onMessage(buffer, bytes) { - clearTimeout(timer); + client.on('message', common.mustCall(function onMessage(buffer) { + assert.strictEqual(buffer.length, 0); + clearInterval(interval); client.close(); })); const buf = Buffer.alloc(0); - client.send(buf, 0, 0, port, '127.0.0.1', function(err, len) { }); - - const timer = setTimeout(function() { - throw new Error('Timeout'); - }, common.platformTimeout(200)); -}); + var interval = setInterval(function() { + client.send(buf, 0, 0, port, '127.0.0.1', common.mustCall(function() {})); + }, 10); +})); diff --git a/test/parallel/test-dgram-send-empty-packet.js b/test/parallel/test-dgram-send-empty-packet.js new file mode 100644 index 00000000000000..131e808aec0b72 --- /dev/null +++ b/test/parallel/test-dgram-send-empty-packet.js @@ -0,0 +1,34 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); + +if (common.isOSX) { + common.skip('because of 17894467 Apple bug'); + return; +} + +const dgram = require('dgram'); + +const client = dgram.createSocket('udp4'); + +client.bind(0, common.mustCall(function() { + + client.on('message', common.mustCall(callback)); + + const port = this.address().port; + const buf = Buffer.alloc(1); + + const interval = setInterval(function() { + client.send(buf, 0, 0, port, '127.0.0.1', common.mustCall(callback)); + }, 10); + + function callback(firstArg) { + // If client.send() callback, firstArg should be null. + // If client.on('message') listener, firstArg should be a 0-length buffer. + if (firstArg instanceof Buffer) { + assert.strictEqual(firstArg.length, 0); + clearInterval(interval); + client.close(); + } + } +})); From 605c84f8d6e67c932e15dd1bac26de0bc3b30ae1 Mon Sep 17 00:00:00 2001 From: Michael Dawson Date: Wed, 23 Nov 2016 10:12:02 -0500 Subject: [PATCH 023/313] test: exclude no_interleaved_stdio test for AIX pseudo-tty/no_interleaved_stdio has hung a few times in the last couple of days on AIX. We believe it is not a Node.js issue but an issue with python on AIX. Its being investigated under: https://github.com/nodejs/node/issues/7973. Excluding this additional test until we can resolve the python issue. Fixes https://github.com/nodejs/node/issues/9765 PR-URL: https://github.com/nodejs/node/pull/9772 Reviewed-By: Sam Roberts Reviewed-By: Gibson Fahnestock --- test/pseudo-tty/pseudo-tty.status | 1 + 1 file changed, 1 insertion(+) diff --git a/test/pseudo-tty/pseudo-tty.status b/test/pseudo-tty/pseudo-tty.status index 27c6f75e10648c..e16bb28cd7be61 100644 --- a/test/pseudo-tty/pseudo-tty.status +++ b/test/pseudo-tty/pseudo-tty.status @@ -3,3 +3,4 @@ prefix pseudo-tty [$system==aix] # test issue only, covered under https://github.com/nodejs/node/issues/7973 no_dropped_stdio : SKIP +no_interleaved_stdio : SKIP From 0772984cb31547f12b2ca3ec6a58795203479c97 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 21 Nov 2016 21:25:37 -0800 Subject: [PATCH 024/313] test: refactor common.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * remove unused common.faketimeCli * remove mosly-unused common.testDir * assert.ok(false...) -> fail() * alphabetize list of known globals * .indexOf() -> .includes() PR-URL: https://github.com/nodejs/node/pull/9732 Reviewed-By: Santiago Gimeno Reviewed-By: Colin Ihrig Reviewed-By: Jeremiah Senkpiel Reviewed-By: Luigi Pinca Reviewed-By: Michael Dawson Reviewed-By: Michaël Zasso --- test/README.md | 11 -------- test/common.js | 47 ++++++++++++++----------------- test/parallel/test-npm-install.js | 3 +- 3 files changed, 23 insertions(+), 38 deletions(-) diff --git a/test/README.md b/test/README.md index 0971adac3452ed..ca4f515ced4407 100644 --- a/test/README.md +++ b/test/README.md @@ -194,11 +194,6 @@ Checks if there are multiple localhosts available. Throws an `AssertionError` with `msg` -### faketimeCli -* return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - -Return the path to the fake. - ### fileExists(pathname) * pathname [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) @@ -354,12 +349,6 @@ Synchronous version of `spawnCat`. Synchronous version of `spawnPwd`. -### testDir - -* return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) - -Path to the 'test' directory. - ### tmpDir * return [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) diff --git a/test/common.js b/test/common.js index a428bd98032a02..7224d878e88871 100644 --- a/test/common.js +++ b/test/common.js @@ -12,8 +12,7 @@ const Timer = process.binding('timer_wrap').Timer; const testRoot = process.env.NODE_TEST_DIR ? path.resolve(process.env.NODE_TEST_DIR) : __dirname; -exports.testDir = __dirname; -exports.fixturesDir = path.join(exports.testDir, 'fixtures'); +exports.fixturesDir = path.join(__dirname, 'fixtures'); exports.tmpDirName = 'tmp'; // PORT should match the definition in test/testpy/__init__.py. exports.PORT = +process.env.NODE_COMMON_PORT || 12346; @@ -195,13 +194,6 @@ if (exports.isWindows) { exports.PIPE = exports.tmpDir + '/test.sock'; } -if (exports.isWindows) { - exports.faketimeCli = false; -} else { - exports.faketimeCli = path.join(__dirname, '..', 'tools', 'faketime', 'src', - 'faketime'); -} - var ifaces = os.networkInterfaces(); exports.hasIPv6 = Object.keys(ifaces).some(function(name) { return /lo/.test(name) && ifaces[name].some(function(info) { @@ -285,17 +277,19 @@ exports.platformTimeout = function(ms) { return ms; // ARMv8+ }; -var knownGlobals = [setTimeout, - setInterval, - setImmediate, - clearTimeout, - clearInterval, - clearImmediate, - console, - constructor, // Enumerable in V8 3.21. - Buffer, - process, - global]; +var knownGlobals = [ + Buffer, + clearImmediate, + clearInterval, + clearTimeout, + console, + constructor, // Enumerable in V8 3.21. + global, + process, + setImmediate, + setInterval, + setTimeout +]; if (global.gc) { knownGlobals.push(global.gc); @@ -360,7 +354,7 @@ function leakedGlobals() { var leaked = []; for (var val in global) - if (-1 === knownGlobals.indexOf(global[val])) + if (!knownGlobals.includes(global[val])) leaked.push(val); return leaked; @@ -375,7 +369,7 @@ process.on('exit', function() { var leaked = leakedGlobals(); if (leaked.length > 0) { console.error('Unknown globals: %s', leaked); - assert.ok(false, 'Unknown global found'); + fail('Unknown global found'); } }); @@ -440,9 +434,10 @@ exports.fileExists = function(pathname) { } }; -exports.fail = function(msg) { +function fail(msg) { assert.fail(null, null, msg); -}; +} +exports.fail = fail; exports.skip = function(msg) { console.log(`1..0 # Skipped: ${msg}`); @@ -493,9 +488,9 @@ exports.nodeProcessAborted = function nodeProcessAborted(exitCode, signal) { // one of them (exit code or signal) needs to be set to one of // the expected exit codes or signals. if (signal !== null) { - return expectedSignals.indexOf(signal) > -1; + return expectedSignals.includes(signal); } else { - return expectedExitCodes.indexOf(exitCode) > -1; + return expectedExitCodes.includes(exitCode); } }; diff --git a/test/parallel/test-npm-install.js b/test/parallel/test-npm-install.js index 8a900cf7f7c759..e72e731ea72ea0 100644 --- a/test/parallel/test-npm-install.js +++ b/test/parallel/test-npm-install.js @@ -13,7 +13,8 @@ const installDir = path.join(common.tmpDir, 'install-dir'); fs.mkdirSync(installDir); const npmPath = path.join( - common.testDir, + __dirname, + '..', '..', 'deps', 'npm', From d1f5e99a2a0b1056ef214b51dd99eebcc9f3f49e Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 23 Nov 2016 22:19:24 -0800 Subject: [PATCH 025/313] test: refactor test-child-process-exec-error * assert.equal() -> assert.strictEqual() * regex -> .include() * Change variable representing a function from `fun` to idiomatic `fn` * var -> const PR-URL: https://github.com/nodejs/node/pull/9780 Reviewed-By: Santiago Gimeno Reviewed-By: Colin Ihrig Reviewed-By: Michael Dawson Reviewed-By: Evan Lucas Reviewed-By: Prince John Wesley --- test/parallel/test-child-process-exec-error.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-child-process-exec-error.js b/test/parallel/test-child-process-exec-error.js index 006a2eebb912d0..f937fec5d252fc 100644 --- a/test/parallel/test-child-process-exec-error.js +++ b/test/parallel/test-child-process-exec-error.js @@ -1,12 +1,12 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var child_process = require('child_process'); +const common = require('../common'); +const assert = require('assert'); +const child_process = require('child_process'); -function test(fun, code) { - fun('does-not-exist', common.mustCall(function(err) { - assert.equal(err.code, code); - assert(/does\-not\-exist/.test(err.cmd)); +function test(fn, code) { + fn('does-not-exist', common.mustCall(function(err) { + assert.strictEqual(err.code, code); + assert(err.cmd.includes('does-not-exist')); })); } From 6105c91f89b52448827a94891130b8d3d7b3e8bb Mon Sep 17 00:00:00 2001 From: Yosuke Saito Date: Sat, 12 Nov 2016 16:47:27 +0900 Subject: [PATCH 026/313] test: fix test-http-status-reason-invalid-chars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use port 0 instead of common.PORT, and use server address instead of localhost to follow writing test guideline. This is a part of Code And Learn at NodeFest 2016 Challenge in Tokyo. PR-URL: https://github.com/nodejs/node/pull/9572 Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso Reviewed-By: Santiago Gimeno Reviewed-By: Shigeki Ohtsu Reviewed-By: James M Snell --- test/parallel/test-http-status-reason-invalid-chars.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-http-status-reason-invalid-chars.js b/test/parallel/test-http-status-reason-invalid-chars.js index 7a8564a906131a..245822d0146975 100644 --- a/test/parallel/test-http-status-reason-invalid-chars.js +++ b/test/parallel/test-http-status-reason-invalid-chars.js @@ -3,6 +3,7 @@ const common = require('../common'); const assert = require('assert'); const http = require('http'); +const net = require('net'); function explicit(req, res) { assert.throws(() => { @@ -32,8 +33,10 @@ const server = http.createServer((req, res) => { } else { implicit(req, res); } -}).listen(common.PORT, common.mustCall(() => { - const url = `http://localhost:${common.PORT}`; +}).listen(0, common.mustCall(() => { + const addr = server.address().address; + const hostname = net.isIPv6(addr) ? `[${addr}1]` : addr; + const url = `http://${hostname}:${server.address().port}`; let left = 2; const check = common.mustCall((res) => { left--; From 5542a72558999220efe67a354003d7aa03ee76f5 Mon Sep 17 00:00:00 2001 From: mkamakura Date: Sat, 12 Nov 2016 16:53:23 +0900 Subject: [PATCH 027/313] test: fix test-tls-connect-address-family MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use port 0 instead of common.PORT. PR-URL: https://github.com/nodejs/node/pull/9573 Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Michaël Zasso Reviewed-By: Santiago Gimeno --- test/parallel/test-tls-connect-address-family.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-tls-connect-address-family.js b/test/parallel/test-tls-connect-address-family.js index 35216d91f6e49f..f22831f395a8dd 100644 --- a/test/parallel/test-tls-connect-address-family.js +++ b/test/parallel/test-tls-connect-address-family.js @@ -18,10 +18,10 @@ function runTest() { const ciphers = 'AECDH-NULL-SHA'; tls.createServer({ ciphers }, common.mustCall(function() { this.close(); - })).listen(common.PORT, '::1', common.mustCall(function() { + })).listen(0, '::1', common.mustCall(function() { const options = { host: 'localhost', - port: common.PORT, + port: this.address().port, family: 6, ciphers: ciphers, rejectUnauthorized: false, From aebc8dfa5710854296c56f7896c9f25283ad908a Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 24 Nov 2016 15:04:14 -0800 Subject: [PATCH 028/313] test: fix flaky test-cluster-dgram-2 There is no guarantee that a dgram packet will be received. The test is currently written to only send exactly as many dgram packets as required assuming they are all received. As a result, failures like this may occur (from CI): ``` not ok 719 parallel/test-cluster-dgram-2 --- duration_ms: 120.39 severity: fail stack: |- timeout ``` This change has the workers send packets continuously until disconnect. PR-URL: https://github.com/nodejs/node/pull/9791 Reviewed-By: Santiago Gimeno --- test/parallel/test-cluster-dgram-2.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-cluster-dgram-2.js b/test/parallel/test-cluster-dgram-2.js index 179b1ee15327e7..863e0fa358c73e 100644 --- a/test/parallel/test-cluster-dgram-2.js +++ b/test/parallel/test-cluster-dgram-2.js @@ -57,6 +57,13 @@ function worker() { // send(), explicitly bind them to an ephemeral port. socket.bind(0); - for (var i = 0; i < PACKETS_PER_WORKER; i++) + // There is no guarantee that a sent dgram packet will be received so keep + // sending until disconnect. + const interval = setInterval(() => { socket.send(buf, 0, buf.length, common.PORT, '127.0.0.1'); + }, 1); + + cluster.worker.on('disconnect', () => { + clearInterval(interval); + }); } From ca461bf5619dbe78b2ae457d64200ff14a7e1c7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sat, 26 Nov 2016 11:17:58 +0100 Subject: [PATCH 029/313] test: refactor and fix test-dns * More precise length assertion. * Fix incorrect use of string instead of RegExp in `throws` assertions. * Add missing RegExp to `throws` assertions. PR-URL: https://github.com/nodejs/node/pull/9811 Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca --- test/parallel/test-dns.js | 46 ++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/test/parallel/test-dns.js b/test/parallel/test-dns.js index 5fcc045b2e3fe4..9ee2e9f974f625 100644 --- a/test/parallel/test-dns.js +++ b/test/parallel/test-dns.js @@ -5,7 +5,7 @@ const assert = require('assert'); const dns = require('dns'); const existing = dns.getServers(); -assert(existing.length); +assert(existing.length > 0); // Verify that setServers() handles arrays with holes and other oddities assert.doesNotThrow(() => { @@ -42,7 +42,8 @@ const goog = [ ]; assert.doesNotThrow(() => dns.setServers(goog)); assert.deepStrictEqual(dns.getServers(), goog); -assert.throws(() => dns.setServers(['foobar'])); +assert.throws(() => dns.setServers(['foobar']), + /^Error: IP address is not properly formatted: foobar$/); assert.deepStrictEqual(dns.getServers(), goog); const goog6 = [ @@ -77,20 +78,18 @@ assert.throws(() => { }, 'Unexpected error'); // dns.lookup should accept falsey and string values -assert.throws(() => dns.lookup({}, noop), - 'invalid arguments: hostname must be a string or falsey'); +const errorReg = + /^TypeError: Invalid arguments: hostname must be a string or falsey$/; -assert.throws(() => dns.lookup([], noop), - 'invalid arguments: hostname must be a string or falsey'); +assert.throws(() => dns.lookup({}, noop), errorReg); -assert.throws(() => dns.lookup(true, noop), - 'invalid arguments: hostname must be a string or falsey'); +assert.throws(() => dns.lookup([], noop), errorReg); -assert.throws(() => dns.lookup(1, noop), - 'invalid arguments: hostname must be a string or falsey'); +assert.throws(() => dns.lookup(true, noop), errorReg); -assert.throws(() => dns.lookup(noop, noop), - 'invalid arguments: hostname must be a string or falsey'); +assert.throws(() => dns.lookup(1, noop), errorReg); + +assert.throws(() => dns.lookup(noop, noop), errorReg); assert.doesNotThrow(() => dns.lookup('', noop)); @@ -114,13 +113,13 @@ assert.doesNotThrow(() => dns.lookup(NaN, noop)); assert.throws(() => { dns.lookup('www.google.com', { hints: (dns.V4MAPPED | dns.ADDRCONFIG) + 1 }, noop); -}); +}, /^TypeError: Invalid argument: hints must use valid flags$/); assert.throws(() => dns.lookup('www.google.com'), - 'invalid arguments: callback must be passed'); + /^TypeError: Invalid arguments: callback must be passed$/); assert.throws(() => dns.lookup('www.google.com', 4), - 'invalid arguments: callback must be passed'); + /^TypeError: Invalid arguments: callback must be passed$/); assert.doesNotThrow(() => dns.lookup('www.google.com', 6, noop)); @@ -143,26 +142,29 @@ assert.doesNotThrow(() => { }, noop); }); -assert.throws(() => dns.lookupService('0.0.0.0'), /Invalid arguments/); +assert.throws(() => dns.lookupService('0.0.0.0'), + /^Error: Invalid arguments$/); assert.throws(() => dns.lookupService('fasdfdsaf', 0, noop), - /"host" argument needs to be a valid IP address/); + /^TypeError: "host" argument needs to be a valid IP address$/); assert.doesNotThrow(() => dns.lookupService('0.0.0.0', '0', noop)); assert.doesNotThrow(() => dns.lookupService('0.0.0.0', 0, noop)); assert.throws(() => dns.lookupService('0.0.0.0', null, noop), - /"port" should be >= 0 and < 65536, got "null"/); + /^TypeError: "port" should be >= 0 and < 65536, got "null"$/); -assert.throws(() => dns.lookupService('0.0.0.0', undefined, noop), - /"port" should be >= 0 and < 65536, got "undefined"/); +assert.throws( + () => dns.lookupService('0.0.0.0', undefined, noop), + /^TypeError: "port" should be >= 0 and < 65536, got "undefined"$/ +); assert.throws(() => dns.lookupService('0.0.0.0', 65538, noop), - /"port" should be >= 0 and < 65536, got "65538"/); + /^TypeError: "port" should be >= 0 and < 65536, got "65538"$/); assert.throws(() => dns.lookupService('0.0.0.0', 'test', noop), - /"port" should be >= 0 and < 65536, got "test"/); + /^TypeError: "port" should be >= 0 and < 65536, got "test"$/); assert.throws(() => dns.lookupService('0.0.0.0', 80, null), /^TypeError: "callback" argument must be a function$/); From 3219586512e5d72c9e2e0d3a8f672e8263cc9c8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sat, 26 Nov 2016 12:20:21 +0100 Subject: [PATCH 030/313] test: refactor test-net-pingpong * var -> const. * Verify that callbacks are called with common.mustCall. * Replace usage of deprecated `server.connections`. * Use common.fail instead of rethrowing errors. * Remove console.log statements. * assert.equal -> assert.strictEqual. * Correct order of arguments in assert.strictEqual. PR-URL: https://github.com/nodejs/node/pull/9812 Reviewed-By: Colin Ihrig Reviewed-By: Prince John Wesley Reviewed-By: Luigi Pinca --- test/parallel/test-net-pingpong.js | 124 +++++++++++++---------------- 1 file changed, 56 insertions(+), 68 deletions(-) diff --git a/test/parallel/test-net-pingpong.js b/test/parallel/test-net-pingpong.js index 33fbafd8f97861..b49b3a78778719 100644 --- a/test/parallel/test-net-pingpong.js +++ b/test/parallel/test-net-pingpong.js @@ -1,87 +1,87 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); - -var net = require('net'); - -var tests_run = 0; +const common = require('../common'); +const assert = require('assert'); +const net = require('net'); function pingPongTest(port, host) { - var N = 1000; + const N = 1000; var count = 0; var sentPongs = 0; var sent_final_ping = false; - var server = net.createServer({ allowHalfOpen: true }, function(socket) { - console.log('connection: ' + socket.remoteAddress); - assert.equal(server, socket.server); - assert.equal(1, server.connections); + const server = net.createServer( + { allowHalfOpen: true }, + common.mustCall(onSocket) + ); + + function onSocket(socket) { + assert.strictEqual(socket.server, server); + server.getConnections(common.mustCall(function(err, connections) { + assert.ifError(err); + assert.strictEqual(connections, 1); + })); socket.setNoDelay(); socket.timeout = 0; socket.setEncoding('utf8'); - socket.on('data', function(data) { + socket.on('data', common.mustCall(function(data) { // Since we never queue data (we're always waiting for the PING // before sending a pong) the writeQueueSize should always be less // than one message. assert.ok(0 <= socket.bufferSize && socket.bufferSize <= 4); - assert.equal(true, socket.writable); - assert.equal(true, socket.readable); - assert.equal(true, count <= N); - assert.equal(data, 'PING'); + assert.strictEqual(socket.writable, true); + assert.strictEqual(socket.readable, true); + assert.ok(count <= N); + assert.strictEqual(data, 'PING'); - socket.write('PONG', function() { + socket.write('PONG', common.mustCall(function() { sentPongs++; - }); - }); + })); + }, N + 1)); - socket.on('end', function() { - assert.equal(true, socket.allowHalfOpen); - assert.equal(true, socket.writable); // because allowHalfOpen - assert.equal(false, socket.readable); + socket.on('end', common.mustCall(function() { + assert.strictEqual(socket.allowHalfOpen, true); + assert.strictEqual(socket.writable, true); // because allowHalfOpen + assert.strictEqual(socket.readable, false); socket.end(); - }); + })); - socket.on('error', function(e) { - throw e; - }); + socket.on('error', common.fail); - socket.on('close', function() { - console.log('server socket.end'); - assert.equal(false, socket.writable); - assert.equal(false, socket.readable); + socket.on('close', common.mustCall(function() { + assert.strictEqual(socket.writable, false); + assert.strictEqual(socket.readable, false); socket.server.close(); - }); - }); + })); + } - server.listen(port, host, function() { + server.listen(port, host, common.mustCall(function() { if (this.address().port) port = this.address().port; - console.log(`server listening on ${port} ${host}`); - var client = net.createConnection(port, host); + const client = net.createConnection(port, host); client.setEncoding('ascii'); - client.on('connect', function() { - assert.equal(true, client.readable); - assert.equal(true, client.writable); + client.on('connect', common.mustCall(function() { + assert.strictEqual(client.readable, true); + assert.strictEqual(client.writable, true); client.write('PING'); - }); + })); - client.on('data', function(data) { - assert.equal('PONG', data); + client.on('data', common.mustCall(function(data) { + assert.strictEqual(data, 'PONG'); count += 1; if (sent_final_ping) { - assert.equal(false, client.writable); - assert.equal(true, client.readable); + assert.strictEqual(client.writable, false); + assert.strictEqual(client.readable, true); return; } else { - assert.equal(true, client.writable); - assert.equal(true, client.readable); + assert.strictEqual(client.writable, true); + assert.strictEqual(client.readable, true); } if (count < N) { @@ -91,20 +91,16 @@ function pingPongTest(port, host) { client.write('PING'); client.end(); } - }); - - client.on('close', function() { - console.log('client.end'); - assert.equal(N + 1, count); - assert.equal(N + 1, sentPongs); - assert.equal(true, sent_final_ping); - tests_run += 1; - }); - - client.on('error', function(e) { - throw e; - }); - }); + }, N + 1)); + + client.on('close', common.mustCall(function() { + assert.strictEqual(count, N + 1); + assert.strictEqual(sentPongs, N + 1); + assert.strictEqual(sent_final_ping, true); + })); + + client.on('error', common.fail); + })); } /* All are run at once, so run on different ports */ @@ -114,11 +110,3 @@ pingPongTest(0); pingPongTest(0, 'localhost'); if (common.hasIPv6) pingPongTest(0, '::1'); - -process.on('exit', function() { - if (common.hasIPv6) - assert.equal(4, tests_run); - else - assert.equal(3, tests_run); - console.log('done'); -}); From ca0e577673d7a20a1308cdeb43d115871c0ca249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sat, 26 Nov 2016 11:05:14 +0100 Subject: [PATCH 031/313] test: refactor test-crypto-binary-default * var -> const. * Group and sort imports. * Correctly align function arguments. * Fix incorrect use of string instead of RegExp in `throws` assertions. * assert.equal -> assert.strictEqual. * Verify that callbacks are called with common.mustCall. PR-URL: https://github.com/nodejs/node/pull/9810 Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott --- test/parallel/test-crypto-binary-default.js | 247 ++++++++++---------- 1 file changed, 130 insertions(+), 117 deletions(-) diff --git a/test/parallel/test-crypto-binary-default.js b/test/parallel/test-crypto-binary-default.js index 3b3603157786de..33a0783fe99963 100644 --- a/test/parallel/test-crypto-binary-default.js +++ b/test/parallel/test-crypto-binary-default.js @@ -3,30 +3,30 @@ // to use buffers by default. -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var crypto = require('crypto'); -var tls = require('tls'); + +const assert = require('assert'); +const crypto = require('crypto'); +const fs = require('fs'); +const path = require('path'); +const tls = require('tls'); const DH_NOT_SUITABLE_GENERATOR = crypto.constants.DH_NOT_SUITABLE_GENERATOR; crypto.DEFAULT_ENCODING = 'latin1'; -var fs = require('fs'); -var path = require('path'); - // Test Certificates -var certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii'); -var certPfx = fs.readFileSync(common.fixturesDir + '/test_cert.pfx'); -var keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii'); -var rsaPubPem = fs.readFileSync(common.fixturesDir + '/test_rsa_pubkey.pem', - 'ascii'); -var rsaKeyPem = fs.readFileSync(common.fixturesDir + '/test_rsa_privkey.pem', - 'ascii'); +const certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii'); +const certPfx = fs.readFileSync(common.fixturesDir + '/test_cert.pfx'); +const keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii'); +const rsaPubPem = fs.readFileSync(common.fixturesDir + '/test_rsa_pubkey.pem', + 'ascii'); +const rsaKeyPem = fs.readFileSync(common.fixturesDir + '/test_rsa_privkey.pem', + 'ascii'); // PFX tests assert.doesNotThrow(function() { @@ -35,22 +35,22 @@ assert.doesNotThrow(function() { assert.throws(function() { tls.createSecureContext({pfx: certPfx}); -}, 'mac verify failure'); +}, /^Error: mac verify failure$/); assert.throws(function() { tls.createSecureContext({pfx: certPfx, passphrase: 'test'}); -}, 'mac verify failure'); +}, /^Error: mac verify failure$/); assert.throws(function() { tls.createSecureContext({pfx: 'sample', passphrase: 'test'}); -}, 'not enough data'); +}, /^Error: not enough data$/); // Test HMAC const hmacHash = crypto.createHmac('sha1', 'Node') .update('some data') .update('to hmac') .digest('hex'); -assert.equal(hmacHash, '19fd6e1ba73d9ed2224dd5094a71babe85d9a892', 'test HMAC'); +assert.strictEqual(hmacHash, '19fd6e1ba73d9ed2224dd5094a71babe85d9a892'); // Test HMAC-SHA-* (rfc 4231 Test Cases) var rfc4231 = [ @@ -74,7 +74,7 @@ var rfc4231 = [ { key: Buffer.from('4a656665', 'hex'), // 'Jefe' data: Buffer.from('7768617420646f2079612077616e7420666f72206e6f74686' + - '96e673f', 'hex'), // 'what do ya want for nothing?' + '96e673f', 'hex'), // 'what do ya want for nothing?' hmac: { sha224: 'a30e01098bc6dbbf45690f3a7e9e6d0f8bbea2a39e6148008fd05e44', sha256: @@ -92,8 +92,8 @@ var rfc4231 = [ { key: Buffer.from('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'), data: Buffer.from('ddddddddddddddddddddddddddddddddddddddddddddddddd' + - 'ddddddddddddddddddddddddddddddddddddddddddddddddddd', - 'hex'), + 'ddddddddddddddddddddddddddddddddddddddddddddddddddd', + 'hex'), hmac: { sha224: '7fb3cb3588c6c1f6ffa9694d7d6ad2649365b0c1f65d69d1ec8333ea', sha256: @@ -110,10 +110,10 @@ var rfc4231 = [ }, { key: Buffer.from('0102030405060708090a0b0c0d0e0f10111213141516171819', - 'hex'), - data: Buffer.from('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc' + - 'dcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd', 'hex'), + data: Buffer.from('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc' + + 'dcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd', + 'hex'), hmac: { sha224: '6c11506874013cac6a2abc1bb382627cec6a90d86efc012de7afec5a', sha256: @@ -143,15 +143,15 @@ var rfc4231 = [ }, { key: Buffer.from('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaa', 'hex'), + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaaaa', 'hex'), // 'Test Using Larger Than Block-Size Key - Hash Key First' data: Buffer.from('54657374205573696e67204c6172676572205468616e20426' + - 'c6f636b2d53697a65204b6579202d2048617368204b657920' + - '4669727374', 'hex'), + 'c6f636b2d53697a65204b6579202d2048617368204b657920' + + '4669727374', 'hex'), hmac: { sha224: '95e9a0db962095adaebe9b2d6f0dbce2d499f112f2d2b7273fa6870e', sha256: @@ -168,21 +168,21 @@ var rfc4231 = [ }, { key: Buffer.from('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaa', 'hex'), + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaaaa', 'hex'), // 'This is a test using a larger than block-size key and a larger ' + // 'than block-size data. The key needs to be hashed before being ' + // 'used by the HMAC algorithm.' data: Buffer.from('5468697320697320612074657374207573696e672061206c6' + - '172676572207468616e20626c6f636b2d73697a65206b6579' + - '20616e642061206c6172676572207468616e20626c6f636b2' + - 'd73697a6520646174612e20546865206b6579206e65656473' + - '20746f20626520686173686564206265666f7265206265696' + - 'e6720757365642062792074686520484d414320616c676f72' + - '6974686d2e', 'hex'), + '172676572207468616e20626c6f636b2d73697a65206b6579' + + '20616e642061206c6172676572207468616e20626c6f636b2' + + 'd73697a6520646174612e20546865206b6579206e65656473' + + '20746f20626520686173686564206265666f7265206265696' + + 'e6720757365642062792074686520484d414320616c676f72' + + '6974686d2e', 'hex'), hmac: { sha224: '3a854166ac5d9f023f54d517d0b39dbd946770db9c2b95c9f6f565d1', sha256: @@ -207,9 +207,11 @@ for (let i = 0, l = rfc4231.length; i < l; i++) { if (rfc4231[i]['truncate']) { result = result.substr(0, 32); // first 128 bits == 32 hex chars } - assert.equal(rfc4231[i]['hmac'][hash], - result, - 'Test HMAC-' + hash + ': Test case ' + (i + 1) + ' rfc 4231'); + assert.strictEqual( + rfc4231[i]['hmac'][hash], + result, + `Test HMAC-${hash}: Test case ${i + 1} rfc 4231` + ); } } @@ -228,17 +230,17 @@ var rfc2202_md5 = [ { key: Buffer.from('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'), data: Buffer.from('ddddddddddddddddddddddddddddddddddddddddddddddddd' + - 'ddddddddddddddddddddddddddddddddddddddddddddddddddd', - 'hex'), + 'ddddddddddddddddddddddddddddddddddddddddddddddddddd', + 'hex'), hmac: '56be34521d144c88dbb8c733f0e8b3f6' }, { key: Buffer.from('0102030405060708090a0b0c0d0e0f10111213141516171819', - 'hex'), - data: Buffer.from('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc' + - 'dcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd' + - 'cdcdcdcdcd', 'hex'), + data: Buffer.from('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc' + + 'dcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd' + + 'cdcdcdcdcd', + 'hex'), hmac: '697eaf0aca3a3aea3a75164746ffaa79' }, { @@ -248,19 +250,19 @@ var rfc2202_md5 = [ }, { key: Buffer.from('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaa', - 'hex'), + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaaaaaaaaaaaaaa', + 'hex'), data: 'Test Using Larger Than Block-Size Key - Hash Key First', hmac: '6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd' }, { key: Buffer.from('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaa', - 'hex'), + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaaaaaaaaaaaaaa', + 'hex'), data: 'Test Using Larger Than Block-Size Key and Larger Than One ' + 'Block-Size Data', @@ -281,18 +283,18 @@ var rfc2202_sha1 = [ { key: Buffer.from('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa', 'hex'), data: Buffer.from('ddddddddddddddddddddddddddddddddddddddddddddd' + - 'ddddddddddddddddddddddddddddddddddddddddddddd' + - 'dddddddddd', - 'hex'), + 'ddddddddddddddddddddddddddddddddddddddddddddd' + + 'dddddddddd', + 'hex'), hmac: '125d7342b9ac11cd91a39af48aa17b4f63f175d3' }, { key: Buffer.from('0102030405060708090a0b0c0d0e0f10111213141516171819', - 'hex'), - data: Buffer.from('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc' + - 'dcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd' + - 'cdcdcdcdcd', 'hex'), + data: Buffer.from('cdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdc' + + 'dcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd' + + 'cdcdcdcdcd', + 'hex'), hmac: '4c9007f4026250c6bc8414f9bf50c86c2d7235da' }, { @@ -302,19 +304,19 @@ var rfc2202_sha1 = [ }, { key: Buffer.from('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaa', - 'hex'), + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaaaaaaaaaaaaaa', + 'hex'), data: 'Test Using Larger Than Block-Size Key - Hash Key First', hmac: 'aa4ae5e15272d00e95705637ce8a3b55ed402112' }, { key: Buffer.from('aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + - 'aaaaaaaaaaaaaaaaaaaaaa', - 'hex'), + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' + + 'aaaaaaaaaaaaaaaaaaaaaa', + 'hex'), data: 'Test Using Larger Than Block-Size Key and Larger Than One ' + 'Block-Size Data', @@ -329,7 +331,7 @@ for (let i = 0, l = rfc2202_md5.length; i < l; i++) { crypto.createHmac('md5', rfc2202_md5[i]['key']) .update(rfc2202_md5[i]['data']) .digest('hex'), - 'Test HMAC-MD5 : Test case ' + (i + 1) + ' rfc 2202' + `Test HMAC-MD5 : Test case ${i + 1} rfc 2202` ); } } @@ -339,7 +341,7 @@ for (let i = 0, l = rfc2202_sha1.length; i < l; i++) { crypto.createHmac('sha1', rfc2202_sha1[i]['key']) .update(rfc2202_sha1[i]['data']) .digest('hex'), - 'Test HMAC-SHA1 : Test case ' + (i + 1) + ' rfc 2202' + `Test HMAC-SHA1 : Test case ${i + 1} rfc 2202` ); } @@ -351,24 +353,27 @@ var a4 = crypto.createHash('sha1').update('Test123').digest('buffer'); if (!common.hasFipsCrypto) { var a0 = crypto.createHash('md5').update('Test123').digest('latin1'); - assert.equal( + assert.strictEqual( a0, 'h\u00ea\u00cb\u0097\u00d8o\fF!\u00fa+\u000e\u0017\u00ca\u00bd\u008c', 'Test MD5 as latin1' ); } -assert.equal(a1, '8308651804facb7b9af8ffc53a33a22d6a1c8ac2', 'Test SHA1'); +assert.strictEqual(a1, '8308651804facb7b9af8ffc53a33a22d6a1c8ac2', 'Test SHA1'); -assert.equal(a2, '2bX1jws4GYKTlxhloUB09Z66PoJZW+y+hq5R8dnx9l4=', - 'Test SHA256 as base64'); +assert.strictEqual(a2, '2bX1jws4GYKTlxhloUB09Z66PoJZW+y+hq5R8dnx9l4=', + 'Test SHA256 as base64'); -assert.equal(a3, '\u00c1(4\u00f1\u0003\u001fd\u0097!O\'\u00d4C/&Qz\u00d4' + - '\u0094\u0015l\u00b8\u008dQ+\u00db\u001d\u00c4\u00b5}\u00b2' + - '\u00d6\u0092\u00a3\u00df\u00a2i\u00a1\u009b\n\n*\u000f' + - '\u00d7\u00d6\u00a2\u00a8\u0085\u00e3<\u0083\u009c\u0093' + - '\u00c2\u0006\u00da0\u00a1\u00879(G\u00ed\'', - 'Test SHA512 as assumed latin1'); +assert.strictEqual( + a3, + '\u00c1(4\u00f1\u0003\u001fd\u0097!O\'\u00d4C/&Qz\u00d4' + + '\u0094\u0015l\u00b8\u008dQ+\u00db\u001d\u00c4\u00b5}\u00b2' + + '\u00d6\u0092\u00a3\u00df\u00a2i\u00a1\u009b\n\n*\u000f' + + '\u00d7\u00d6\u00a2\u00a8\u0085\u00e3<\u0083\u009c\u0093' + + '\u00c2\u0006\u00da0\u00a1\u00879(G\u00ed\'', + 'Test SHA512 as assumed latin1' +); assert.deepStrictEqual( a4, @@ -379,7 +384,7 @@ assert.deepStrictEqual( // Test multiple updates to same hash var h1 = crypto.createHash('sha1').update('Test123').digest('hex'); var h2 = crypto.createHash('sha1').update('Test').update('123').digest('hex'); -assert.equal(h1, h2, 'multipled updates'); +assert.strictEqual(h1, h2, 'multipled updates'); // Test hashing for binary files var fn = path.join(common.fixturesDir, 'sample.png'); @@ -388,16 +393,18 @@ var fileStream = fs.createReadStream(fn); fileStream.on('data', function(data) { sha1Hash.update(data); }); -fileStream.on('close', function() { - assert.equal(sha1Hash.digest('hex'), - '22723e553129a336ad96e10f6aecdf0f45e4149e', - 'Test SHA1 of sample.png'); -}); +fileStream.on('close', common.mustCall(function() { + assert.strictEqual( + sha1Hash.digest('hex'), + '22723e553129a336ad96e10f6aecdf0f45e4149e', + 'Test SHA1 of sample.png' + ); +})); // Issue #2227: unknown digest method should throw an error. assert.throws(function() { crypto.createHash('xyzzy'); -}); +}, /^Error: Digest method not supported$/); // Test signing and verifying var s1 = crypto.createSign('RSA-SHA1') @@ -443,7 +450,7 @@ function testCipher1(key) { var txt = decipher.update(ciph, 'hex', 'utf8'); txt += decipher.final('utf8'); - assert.equal(txt, plaintext, 'encryption and decryption'); + assert.strictEqual(txt, plaintext, 'encryption and decryption'); } @@ -465,7 +472,7 @@ function testCipher2(key) { var txt = decipher.update(ciph, 'base64', 'utf8'); txt += decipher.final('utf8'); - assert.equal(txt, plaintext, 'encryption and decryption with Base64'); + assert.strictEqual(txt, plaintext, 'encryption and decryption with Base64'); } @@ -483,7 +490,8 @@ function testCipher3(key, iv) { var txt = decipher.update(ciph, 'hex', 'utf8'); txt += decipher.final('utf8'); - assert.equal(txt, plaintext, 'encryption and decryption with key and iv'); + assert.strictEqual(txt, plaintext, + 'encryption and decryption with key and iv'); } @@ -501,7 +509,8 @@ function testCipher4(key, iv) { var txt = decipher.update(ciph, 'buffer', 'utf8'); txt += decipher.final('utf8'); - assert.equal(txt, plaintext, 'encryption and decryption with key and iv'); + assert.strictEqual(txt, plaintext, + 'encryption and decryption with key and iv'); } if (!common.hasFipsCrypto) { @@ -523,7 +532,7 @@ testCipher4(Buffer.from('0123456789abcd0123456789'), Buffer.from('12345678')); // update() should only take buffers / strings assert.throws(function() { crypto.createHash('sha1').update({foo: 'bar'}); -}, /buffer/); +}, /^TypeError: Data must be a string or a buffer$/); // Test Diffie-Hellman with two parties sharing a secret, @@ -536,7 +545,7 @@ var key2 = dh2.generateKeys('hex'); var secret1 = dh1.computeSecret(key2, 'hex', 'base64'); var secret2 = dh2.computeSecret(key1, 'latin1', 'buffer'); -assert.equal(secret1, secret2.toString('base64')); +assert.strictEqual(secret1, secret2.toString('base64')); // Create "another dh1" using generated keys from dh1, // and compute secret again @@ -545,14 +554,14 @@ var privkey1 = dh1.getPrivateKey(); dh3.setPublicKey(key1); dh3.setPrivateKey(privkey1); -assert.equal(dh1.getPrime(), dh3.getPrime()); -assert.equal(dh1.getGenerator(), dh3.getGenerator()); -assert.equal(dh1.getPublicKey(), dh3.getPublicKey()); -assert.equal(dh1.getPrivateKey(), dh3.getPrivateKey()); +assert.strictEqual(dh1.getPrime(), dh3.getPrime()); +assert.strictEqual(dh1.getGenerator(), dh3.getGenerator()); +assert.strictEqual(dh1.getPublicKey(), dh3.getPublicKey()); +assert.strictEqual(dh1.getPrivateKey(), dh3.getPrivateKey()); var secret3 = dh3.computeSecret(key2, 'hex', 'base64'); -assert.equal(secret1, secret3); +assert.strictEqual(secret1, secret3); // https://github.com/joyent/node/issues/2338 var p = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' + @@ -560,22 +569,24 @@ var p = 'FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74' + '4FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7ED' + 'EE386BFB5A899FA5AE9F24117C4B1FE649286651ECE65381FFFFFFFFFFFFFFFF'; var d = crypto.createDiffieHellman(p, 'hex'); -assert.equal(d.verifyError, DH_NOT_SUITABLE_GENERATOR); +assert.strictEqual(d.verifyError, DH_NOT_SUITABLE_GENERATOR); // Test RSA key signing/verification var rsaSign = crypto.createSign('RSA-SHA1'); var rsaVerify = crypto.createVerify('RSA-SHA1'); -assert.ok(rsaSign); -assert.ok(rsaVerify); +assert.ok(rsaSign instanceof crypto.Sign); +assert.ok(rsaVerify instanceof crypto.Verify); rsaSign.update(rsaPubPem); var rsaSignature = rsaSign.sign(rsaKeyPem, 'hex'); -assert.equal(rsaSignature, - '5c50e3145c4e2497aadb0eabc83b342d0b0021ece0d4c4a064b7c' + - '8f020d7e2688b122bfb54c724ac9ee169f83f66d2fe90abeb95e8' + - 'e1290e7e177152a4de3d944cf7d4883114a20ed0f78e70e25ef0f' + - '60f06b858e6af42a2f276ede95bbc6bc9a9bbdda15bd663186a6f' + - '40819a7af19e577bb2efa5e579a1f5ce8a0d4ca8b8f6'); +assert.strictEqual( + rsaSignature, + '5c50e3145c4e2497aadb0eabc83b342d0b0021ece0d4c4a064b7c' + + '8f020d7e2688b122bfb54c724ac9ee169f83f66d2fe90abeb95e8' + + 'e1290e7e177152a4de3d944cf7d4883114a20ed0f78e70e25ef0f' + + '60f06b858e6af42a2f276ede95bbc6bc9a9bbdda15bd663186a6f' + + '40819a7af19e577bb2efa5e579a1f5ce8a0d4ca8b8f6' +); rsaVerify.update(rsaPubPem); assert.strictEqual(rsaVerify.verify(rsaPubPem, rsaSignature, 'hex'), true); @@ -642,12 +653,14 @@ assert.strictEqual(rsaVerify.verify(rsaPubPem, rsaSignature, 'hex'), true); // Test PBKDF2 with RFC 6070 test vectors (except #4) // function testPBKDF2(password, salt, iterations, keylen, expected) { - var actual = crypto.pbkdf2Sync(password, salt, iterations, keylen, 'sha256'); - assert.equal(actual, expected); + const actual = crypto.pbkdf2Sync(password, salt, iterations, keylen, + 'sha256'); + assert.strictEqual(actual, expected); - crypto.pbkdf2(password, salt, iterations, keylen, 'sha256', (err, actual) => { - assert.equal(actual, expected); + const cb = common.mustCall((err, actual) => { + assert.strictEqual(actual, expected); }); + crypto.pbkdf2(password, salt, iterations, keylen, 'sha256', cb); } From 8c6b127c93ec116a83038b672f62280e908e3a8d Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 25 Nov 2016 20:37:19 -0800 Subject: [PATCH 032/313] test: refine test-http-status-reason-invalid-chars MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * replace unneeded template strings with strings; there was no variable substitution or concatenation or anything like that * assert.notEqual() -> assert.notStrictEqual() PR-URL: https://github.com/nodejs/node/pull/9802 Reviewed-By: Prince John Wesley Reviewed-By: Michaël Zasso Reviewed-By: Santiago Gimeno Reviewed-By: Colin Ihrig Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Luigi Pinca --- test/parallel/test-http-status-reason-invalid-chars.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-http-status-reason-invalid-chars.js b/test/parallel/test-http-status-reason-invalid-chars.js index 245822d0146975..9950eeeee9cdd2 100644 --- a/test/parallel/test-http-status-reason-invalid-chars.js +++ b/test/parallel/test-http-status-reason-invalid-chars.js @@ -7,7 +7,7 @@ const net = require('net'); function explicit(req, res) { assert.throws(() => { - res.writeHead(200, `OK\r\nContent-Type: text/html\r\n`); + res.writeHead(200, 'OK\r\nContent-Type: text/html\r\n'); }, /Invalid character in statusMessage/); assert.throws(() => { @@ -20,7 +20,7 @@ function explicit(req, res) { function implicit(req, res) { assert.throws(() => { - res.statusMessage = `OK\r\nContent-Type: text/html\r\n`; + res.statusMessage = 'OK\r\nContent-Type: text/html\r\n'; res.writeHead(200); }, /Invalid character in statusMessage/); res.statusMessage = 'OK'; @@ -40,8 +40,8 @@ const server = http.createServer((req, res) => { let left = 2; const check = common.mustCall((res) => { left--; - assert.notEqual(res.headers['content-type'], 'text/html'); - assert.notEqual(res.headers['content-type'], 'gotcha'); + assert.notStrictEqual(res.headers['content-type'], 'text/html'); + assert.notStrictEqual(res.headers['content-type'], 'gotcha'); if (left === 0) server.close(); }, 2); http.get(`${url}/explicit`, check).end(); From e2e51c52c9a44a82d0d4d25f7e9f7010083cdc05 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 25 Nov 2016 20:47:56 -0800 Subject: [PATCH 033/313] test: refactor test-preload MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * assert.equal() -> assert.strictEqual() * replace template string with a string; no variable substitution or concatenation or anything like that PR-URL: https://github.com/nodejs/node/pull/9803 Reviewed-By: Prince John Wesley Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- test/parallel/test-preload.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/parallel/test-preload.js b/test/parallel/test-preload.js index e60b29dfbe7e47..f849bc3dda3243 100644 --- a/test/parallel/test-preload.js +++ b/test/parallel/test-preload.js @@ -37,7 +37,7 @@ childProcess.exec(nodeBinary + ' ' + fixtureB, function(err, stdout, stderr) { if (err) throw err; - assert.equal(stdout, 'A\nB\n'); + assert.strictEqual(stdout, 'A\nB\n'); }); // test preloading multiple modules works @@ -46,7 +46,7 @@ childProcess.exec(nodeBinary + ' ' + fixtureC, function(err, stdout, stderr) { if (err) throw err; - assert.equal(stdout, 'A\nB\nC\n'); + assert.strictEqual(stdout, 'A\nB\nC\n'); }); // test that preloading a throwing module aborts @@ -55,7 +55,7 @@ childProcess.exec(nodeBinary + ' ' + fixtureB, function(err, stdout, stderr) { if (err) { - assert.equal(stdout, 'A\n'); + assert.strictEqual(stdout, 'A\n'); } else { throw new Error('Preload should have failed'); } @@ -67,7 +67,7 @@ childProcess.exec(nodeBinary + ' ' + '-e "console.log(\'hello\');"', function(err, stdout, stderr) { if (err) throw err; - assert.equal(stdout, 'A\nhello\n'); + assert.strictEqual(stdout, 'A\nhello\n'); }); // test that preload can be used with stdin @@ -76,14 +76,14 @@ const stdinProc = childProcess.spawn( ['--require', fixtureA], {stdio: 'pipe'} ); -stdinProc.stdin.end('console.log(\'hello\');'); +stdinProc.stdin.end("console.log('hello');"); var stdinStdout = ''; stdinProc.stdout.on('data', function(d) { stdinStdout += d; }); stdinProc.on('close', function(code) { - assert.equal(code, 0); - assert.equal(stdinStdout, 'A\nhello\n'); + assert.strictEqual(code, 0); + assert.strictEqual(stdinStdout, 'A\nhello\n'); }); // test that preload can be used with repl @@ -98,12 +98,12 @@ replProc.stdout.on('data', function(d) { replStdout += d; }); replProc.on('close', function(code) { - assert.equal(code, 0); + assert.strictEqual(code, 0); const output = [ 'A', '> ' ].join('\n'); - assert.equal(replStdout, output); + assert.strictEqual(replStdout, output); }); // test that preload placement at other points in the cmdline @@ -114,7 +114,7 @@ childProcess.exec(nodeBinary + ' ' + preloadOption([fixtureA, fixtureB]), function(err, stdout, stderr) { if (err) throw err; - assert.equal(stdout, 'A\nB\nhello\n'); + assert.strictEqual(stdout, 'A\nB\nhello\n'); }); // test that preload works with -i @@ -123,7 +123,7 @@ const interactive = childProcess.exec(nodeBinary + ' ' + '-i', common.mustCall(function(err, stdout, stderr) { assert.ifError(err); - assert.strictEqual(stdout, `> 'test'\n> `); + assert.strictEqual(stdout, "> 'test'\n> "); })); interactive.stdin.write('a\n'); From 51c8fe0c669410f129999af7521b3cbae18585c5 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Fri, 25 Nov 2016 21:11:55 -0800 Subject: [PATCH 034/313] test: refactor test-util-inspect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Handle a rejected Promise as that is expected to cause the process to exit in a future version of Node.js. (Currently, it emits a warning.) * Remove unneeded escaping in regexps * Replace template strings with strings where there is no variable substitution. * A few minor readability changes (whitespace). PR-URL: https://github.com/nodejs/node/pull/9804 Reviewed-By: Prince John Wesley Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- test/parallel/test-util-inspect.js | 39 +++++++++++++++++------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index f730ec1c98303e..1118065f1a09da 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -143,12 +143,12 @@ for (const showHidden of [true, false]) { assert.strictEqual( util.inspect(array, true), `${constructor.name} [\n` + - ` 65,\n` + - ` 97,\n` + + ' 65,\n' + + ' 97,\n' + ` [BYTES_PER_ELEMENT]: ${constructor.BYTES_PER_ELEMENT},\n` + ` [length]: ${length},\n` + ` [byteLength]: ${byteLength},\n` + - ` [byteOffset]: 0,\n` + + ' [byteOffset]: 0,\n' + ` [buffer]: ArrayBuffer { byteLength: ${byteLength} } ]`); assert.strictEqual( util.inspect(array, false), @@ -168,23 +168,21 @@ for (const showHidden of [true, false]) { Uint8ClampedArray ].forEach((constructor) => { const length = 2; const byteLength = length * constructor.BYTES_PER_ELEMENT; - const array = vm.runInNewContext('new constructor(new ArrayBuffer(' + - 'byteLength), 0, length)', - { constructor: constructor, - byteLength: byteLength, - length: length - }); + const array = vm.runInNewContext( + 'new constructor(new ArrayBuffer(byteLength), 0, length)', + { constructor, byteLength, length } + ); array[0] = 65; array[1] = 97; assert.strictEqual( util.inspect(array, true), `${constructor.name} [\n` + - ` 65,\n` + - ` 97,\n` + + ' 65,\n' + + ' 97,\n' + ` [BYTES_PER_ELEMENT]: ${constructor.BYTES_PER_ELEMENT},\n` + ` [length]: ${length},\n` + ` [byteLength]: ${byteLength},\n` + - ` [byteOffset]: 0,\n` + + ' [byteOffset]: 0,\n' + ` [buffer]: ArrayBuffer { byteLength: ${byteLength} } ]`); assert.strictEqual( util.inspect(array, false), @@ -208,8 +206,8 @@ for (const showHidden of [true, false]) { // Objects without prototype { const out = util.inspect(Object.create(null, - { name: {value: 'Tim', enumerable: true}, - hidden: {value: 'secret'}}), true); + { name: {value: 'Tim', enumerable: true}, + hidden: {value: 'secret'}}), true); if (out !== "{ [hidden]: 'secret', name: 'Tim' }" && out !== "{ name: 'Tim', [hidden]: 'secret' }") { common.fail(`unexpected value for out ${out}`); @@ -696,7 +694,14 @@ assert.strictEqual( // test Promise assert.strictEqual(util.inspect(Promise.resolve(3)), 'Promise { 3 }'); -assert.strictEqual(util.inspect(Promise.reject(3)), 'Promise { 3 }'); + +{ + const rejected = Promise.reject(3); + assert.strictEqual(util.inspect(rejected), 'Promise { 3 }'); + // squelch UnhandledPromiseRejection + rejected.catch(() => {}); +} + assert.strictEqual( util.inspect(new Promise(function() {})), 'Promise { }' @@ -831,7 +836,7 @@ checkAlignment(new Map(big_array.map(function(y) { return [y, null]; }))); { const x = Array(101); - assert(/^\[ ... 101 more items \]$/.test( + assert(/^\[ ... 101 more items ]$/.test( util.inspect(x, {maxArrayLength: 0}))); } @@ -847,7 +852,7 @@ checkAlignment(new Map(big_array.map(function(y) { return [y, null]; }))); { const x = new Uint8Array(101); - assert(/\[ ... 101 more items \]$/.test( + assert(/\[ ... 101 more items ]$/.test( util.inspect(x, {maxArrayLength: 0}))); } From b93c3d89f5142aedc3bed6c01d795c4983a2907c Mon Sep 17 00:00:00 2001 From: Claudio Rodriguez Date: Tue, 22 Nov 2016 14:23:18 +0000 Subject: [PATCH 035/313] test: add toASCII and toUnicode punycode tests - Add toUnicode and toASCII tests to test-punycode - Refactor test-punycode.js to better organize test cases - Change assert.equal to assert.strictEqual in test-punycode.js PR-URL: https://github.com/nodejs/node/pull/9741 Reviewed-By: Roman Reiss Reviewed-By: Luigi Pinca --- test/parallel/test-punycode.js | 259 +++++++++++++++++++++------------ 1 file changed, 165 insertions(+), 94 deletions(-) diff --git a/test/parallel/test-punycode.js b/test/parallel/test-punycode.js index abd495e4a9957b..e869e6a33bf064 100644 --- a/test/parallel/test-punycode.js +++ b/test/parallel/test-punycode.js @@ -1,153 +1,224 @@ 'use strict'; require('../common'); -var punycode = require('punycode'); -var assert = require('assert'); +const punycode = require('punycode'); +const assert = require('assert'); -assert.equal(punycode.encode('ü'), 'tda'); -assert.equal(punycode.encode('Goethe'), 'Goethe-'); -assert.equal(punycode.encode('Bücher'), 'Bcher-kva'); -assert.equal(punycode.encode( +assert.strictEqual(punycode.encode('ü'), 'tda'); +assert.strictEqual(punycode.encode('Goethe'), 'Goethe-'); +assert.strictEqual(punycode.encode('Bücher'), 'Bcher-kva'); +assert.strictEqual(punycode.encode( 'Willst du die Blüthe des frühen, die Früchte des späteren Jahres'), 'Willst du die Blthe des frhen, die Frchte des spteren Jahres-x9e96lkal'); -assert.equal(punycode.encode('日本語'), 'wgv71a119e'); +assert.strictEqual(punycode.encode('日本語'), 'wgv71a119e'); -assert.equal(punycode.decode('tda'), 'ü'); -assert.equal(punycode.decode('Goethe-'), 'Goethe'); -assert.equal(punycode.decode('Bcher-kva'), 'Bücher'); -assert.equal(punycode.decode( +assert.strictEqual(punycode.decode('tda'), 'ü'); +assert.strictEqual(punycode.decode('Goethe-'), 'Goethe'); +assert.strictEqual(punycode.decode('Bcher-kva'), 'Bücher'); +assert.strictEqual(punycode.decode( 'Willst du die Blthe des frhen, die Frchte des spteren Jahres-x9e96lkal'), 'Willst du die Blüthe des frühen, die Früchte des späteren Jahres'); -assert.equal(punycode.decode('wgv71a119e'), '日本語'); +assert.strictEqual(punycode.decode('wgv71a119e'), '日本語'); // http://tools.ietf.org/html/rfc3492#section-7.1 -var tests = { +const tests = [ // (A) Arabic (Egyptian) - 'egbpdaj6bu4bxfgehfvwxn': - '\u0644\u064A\u0647\u0645\u0627\u0628\u062A\u0643\u0644\u0645\u0648' + - '\u0634\u0639\u0631\u0628\u064A\u061F', + { + encoded: 'egbpdaj6bu4bxfgehfvwxn', + decoded: '\u0644\u064A\u0647\u0645\u0627\u0628\u062A\u0643\u0644\u0645' + + '\u0648\u0634\u0639\u0631\u0628\u064A\u061F' + }, // (B) Chinese (simplified) - 'ihqwcrb4cv8a8dqg056pqjye': - '\u4ED6\u4EEC\u4E3A\u4EC0\u4E48\u4E0D\u8BF4\u4E2D\u6587', + { + encoded: 'ihqwcrb4cv8a8dqg056pqjye', + decoded: '\u4ED6\u4EEC\u4E3A\u4EC0\u4E48\u4E0D\u8BF4\u4E2D\u6587' + }, // (C) Chinese (traditional) - 'ihqwctvzc91f659drss3x8bo0yb': - '\u4ED6\u5011\u7232\u4EC0\u9EBD\u4E0D\u8AAA\u4E2D\u6587', + { + encoded: 'ihqwctvzc91f659drss3x8bo0yb', + decoded: '\u4ED6\u5011\u7232\u4EC0\u9EBD\u4E0D\u8AAA\u4E2D\u6587' + }, // (D) Czech: Proprostnemluvesky - 'Proprostnemluvesky-uyb24dma41a': - '\u0050\u0072\u006F\u010D\u0070\u0072\u006F\u0073\u0074\u011B\u006E' + - '\u0065\u006D\u006C\u0075\u0076\u00ED\u010D\u0065\u0073\u006B\u0079', + { + encoded: 'Proprostnemluvesky-uyb24dma41a', + decoded: '\u0050\u0072\u006F\u010D\u0070\u0072\u006F\u0073\u0074\u011B' + + '\u006E\u0065\u006D\u006C\u0075\u0076\u00ED\u010D\u0065\u0073\u006B\u0079' + }, // (E) Hebrew - '4dbcagdahymbxekheh6e0a7fei0b': - '\u05DC\u05DE\u05D4\u05D4\u05DD\u05E4\u05E9\u05D5\u05D8\u05DC\u05D0' + - '\u05DE\u05D3\u05D1\u05E8\u05D9\u05DD\u05E2\u05D1\u05E8\u05D9\u05EA', + { + encoded: '4dbcagdahymbxekheh6e0a7fei0b', + decoded: '\u05DC\u05DE\u05D4\u05D4\u05DD\u05E4\u05E9\u05D5\u05D8\u05DC' + + '\u05D0\u05DE\u05D3\u05D1\u05E8\u05D9\u05DD\u05E2\u05D1\u05E8\u05D9\u05EA' + }, // (F) Hindi (Devanagari) - 'i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd': - '\u092F\u0939\u0932\u094B\u0917\u0939\u093F\u0928\u094D\u0926\u0940' + - '\u0915\u094D\u092F\u094B\u0902\u0928\u0939\u0940\u0902\u092C\u094B' + - '\u0932\u0938\u0915\u0924\u0947\u0939\u0948\u0902', + { + encoded: 'i1baa7eci9glrd9b2ae1bj0hfcgg6iyaf8o0a1dig0cd', + decoded: '\u092F\u0939\u0932\u094B\u0917\u0939\u093F\u0928\u094D\u0926' + + '\u0940\u0915\u094D\u092F\u094B\u0902\u0928\u0939\u0940\u0902\u092C' + + '\u094B\u0932\u0938\u0915\u0924\u0947\u0939\u0948\u0902' + }, // (G) Japanese (kanji and hiragana) - 'n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa': - '\u306A\u305C\u307F\u3093\u306A\u65E5\u672C\u8A9E\u3092\u8A71\u3057' + - '\u3066\u304F\u308C\u306A\u3044\u306E\u304B', + { + encoded: 'n8jok5ay5dzabd5bym9f0cm5685rrjetr6pdxa', + decoded: '\u306A\u305C\u307F\u3093\u306A\u65E5\u672C\u8A9E\u3092\u8A71' + + '\u3057\u3066\u304F\u308C\u306A\u3044\u306E\u304B' + }, // (H) Korean (Hangul syllables) - '989aomsvi5e83db1d2a355cv1e0vak1dwrv93d5xbh15a0dt30a5jpsd879ccm6fea98c': - '\uC138\uACC4\uC758\uBAA8\uB4E0\uC0AC\uB78C\uB4E4\uC774\uD55C\uAD6D' + - '\uC5B4\uB97C\uC774\uD574\uD55C\uB2E4\uBA74\uC5BC\uB9C8\uB098\uC88B' + - '\uC744\uAE4C', + { + encoded: '989aomsvi5e83db1d2a355cv1e0vak1dwrv93d5xbh15a0dt30a5jpsd879' + + 'ccm6fea98c', + decoded: '\uC138\uACC4\uC758\uBAA8\uB4E0\uC0AC\uB78C\uB4E4\uC774\uD55C' + + '\uAD6D\uC5B4\uB97C\uC774\uD574\uD55C\uB2E4\uBA74\uC5BC\uB9C8\uB098' + + '\uC88B\uC744\uAE4C' + }, // (I) Russian (Cyrillic) - 'b1abfaaepdrnnbgefbadotcwatmq2g4l': - '\u043F\u043E\u0447\u0435\u043C\u0443\u0436\u0435\u043E\u043D\u0438' + - '\u043D\u0435\u0433\u043E\u0432\u043E\u0440\u044F\u0442\u043F\u043E' + - '\u0440\u0443\u0441\u0441\u043A\u0438', + { + encoded: 'b1abfaaepdrnnbgefbadotcwatmq2g4l', + decoded: '\u043F\u043E\u0447\u0435\u043C\u0443\u0436\u0435\u043E\u043D' + + '\u0438\u043D\u0435\u0433\u043E\u0432\u043E\u0440\u044F\u0442\u043F' + + '\u043E\u0440\u0443\u0441\u0441\u043A\u0438' + }, // (J) Spanish: PorqunopuedensimplementehablarenEspaol - 'PorqunopuedensimplementehablarenEspaol-fmd56a': - '\u0050\u006F\u0072\u0071\u0075\u00E9\u006E\u006F\u0070\u0075\u0065' + - '\u0064\u0065\u006E\u0073\u0069\u006D\u0070\u006C\u0065\u006D\u0065' + - '\u006E\u0074\u0065\u0068\u0061\u0062\u006C\u0061\u0072\u0065\u006E' + - '\u0045\u0073\u0070\u0061\u00F1\u006F\u006C', + { + encoded: 'PorqunopuedensimplementehablarenEspaol-fmd56a', + decoded: '\u0050\u006F\u0072\u0071\u0075\u00E9\u006E\u006F\u0070\u0075' + + '\u0065\u0064\u0065\u006E\u0073\u0069\u006D\u0070\u006C\u0065\u006D' + + '\u0065\u006E\u0074\u0065\u0068\u0061\u0062\u006C\u0061\u0072\u0065' + + '\u006E\u0045\u0073\u0070\u0061\u00F1\u006F\u006C' + }, // (K) Vietnamese: Tisaohkhngth // chnitingVit - 'TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9g': - '\u0054\u1EA1\u0069\u0073\u0061\u006F\u0068\u1ECD\u006B\u0068\u00F4' + - '\u006E\u0067\u0074\u0068\u1EC3\u0063\u0068\u1EC9\u006E\u00F3\u0069' + - '\u0074\u0069\u1EBF\u006E\u0067\u0056\u0069\u1EC7\u0074', + { + encoded: 'TisaohkhngthchnitingVit-kjcr8268qyxafd2f1b9g', + decoded: '\u0054\u1EA1\u0069\u0073\u0061\u006F\u0068\u1ECD\u006B\u0068' + + '\u00F4\u006E\u0067\u0074\u0068\u1EC3\u0063\u0068\u1EC9\u006E\u00F3' + + '\u0069\u0074\u0069\u1EBF\u006E\u0067\u0056\u0069\u1EC7\u0074' + }, // (L) 3B - '3B-ww4c5e180e575a65lsy2b': - '\u0033\u5E74\u0042\u7D44\u91D1\u516B\u5148\u751F', + { + encoded: '3B-ww4c5e180e575a65lsy2b', + decoded: '\u0033\u5E74\u0042\u7D44\u91D1\u516B\u5148\u751F' + }, // (M) -with-SUPER-MONKEYS - '-with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n': - '\u5B89\u5BA4\u5948\u7F8E\u6075\u002D\u0077\u0069\u0074\u0068\u002D' + - '\u0053\u0055\u0050\u0045\u0052\u002D\u004D\u004F\u004E\u004B\u0045' + - '\u0059\u0053', + { + encoded: '-with-SUPER-MONKEYS-pc58ag80a8qai00g7n9n', + decoded: '\u5B89\u5BA4\u5948\u7F8E\u6075\u002D\u0077\u0069\u0074\u0068' + + '\u002D\u0053\u0055\u0050\u0045\u0052\u002D\u004D\u004F\u004E\u004B' + + '\u0045\u0059\u0053' + }, // (N) Hello-Another-Way- - 'Hello-Another-Way--fc4qua05auwb3674vfr0b': - '\u0048\u0065\u006C\u006C\u006F\u002D\u0041\u006E\u006F\u0074\u0068' + - '\u0065\u0072\u002D\u0057\u0061\u0079\u002D\u305D\u308C\u305E\u308C' + - '\u306E\u5834\u6240', + { + encoded: 'Hello-Another-Way--fc4qua05auwb3674vfr0b', + decoded: '\u0048\u0065\u006C\u006C\u006F\u002D\u0041\u006E\u006F\u0074' + + '\u0068\u0065\u0072\u002D\u0057\u0061\u0079\u002D\u305D\u308C\u305E' + + '\u308C\u306E\u5834\u6240' + }, // (O) 2 - '2-u9tlzr9756bt3uc0v': - '\u3072\u3068\u3064\u5C4B\u6839\u306E\u4E0B\u0032', + { + encoded: '2-u9tlzr9756bt3uc0v', + decoded: '\u3072\u3068\u3064\u5C4B\u6839\u306E\u4E0B\u0032' + }, // (P) MajiKoi5 - 'MajiKoi5-783gue6qz075azm5e': - '\u004D\u0061\u006A\u0069\u3067\u004B\u006F\u0069\u3059\u308B\u0035' + - '\u79D2\u524D', + { + encoded: 'MajiKoi5-783gue6qz075azm5e', + decoded: '\u004D\u0061\u006A\u0069\u3067\u004B\u006F\u0069\u3059\u308B' + + '\u0035\u79D2\u524D' + }, // (Q) de - 'de-jg4avhby1noc0d': - '\u30D1\u30D5\u30A3\u30FC\u0064\u0065\u30EB\u30F3\u30D0', + { + encoded: 'de-jg4avhby1noc0d', + decoded: '\u30D1\u30D5\u30A3\u30FC\u0064\u0065\u30EB\u30F3\u30D0' + }, // (R) - 'd9juau41awczczp': - '\u305D\u306E\u30B9\u30D4\u30FC\u30C9\u3067', + { + encoded: 'd9juau41awczczp', + decoded: '\u305D\u306E\u30B9\u30D4\u30FC\u30C9\u3067' + }, // (S) -> $1.00 <- - '-> $1.00 <--': - '\u002D\u003E\u0020\u0024\u0031\u002E\u0030\u0030\u0020\u003C\u002D' + { + encoded: '-> $1.00 <--', + decoded: '\u002D\u003E\u0020\u0024\u0031\u002E\u0030\u0030\u0020\u003C' + + '\u002D' + } +]; + +let errors = 0; +const handleError = (error, name) => { + console.error( + 'FAIL: %s expected %j, got %j', + name, + error.expected, + error.actual + ); + errors++; }; -var errors = 0; +const regexNonASCII = /[^\x20-\x7E]/; +const testBattery = { + encode: (test) => assert.strictEqual( + punycode.encode(test.decoded), + test.encoded + ), + decode: (test) => assert.strictEqual( + punycode.decode(test.encoded), + test.decoded + ), + toASCII: (test) => assert.strictEqual( + punycode.toASCII(test.decoded), + regexNonASCII.test(test.decoded) + ? `xn--${test.encoded}` + : test.decoded + ), + toUnicode: (test) => assert.strictEqual( + punycode.toUnicode( + regexNonASCII.test(test.decoded) + ? `xn--${test.encoded}` + : test.decoded + ), + regexNonASCII.test(test.decoded) + ? test.decoded.toLowerCase() + : test.decoded + ) +}; -for (var encoded in tests) { - var decoded = tests[encoded]; - try { - assert.equal(punycode.encode(decoded), encoded); - } catch (e) { - console.error('FAIL: expected %j, got %j', e.expected, e.actual); - errors++; - } - try { - assert.equal(punycode.decode(encoded), decoded); - } catch (e) { - console.error('FAIL: expected %j, got %j', e.expected, e.actual); - errors++; - } -} +tests.forEach((testCase) => { + Object.keys(testBattery).forEach((key) => { + try { + testBattery[key](testCase); + } catch (error) { + handleError(error, key); + } + }); +}); // BMP code point -assert.equal(punycode.ucs2.encode([0x61]), 'a'); +assert.strictEqual(punycode.ucs2.encode([0x61]), 'a'); // supplementary code point (surrogate pair) -assert.equal(punycode.ucs2.encode([0x1D306]), '\uD834\uDF06'); +assert.strictEqual(punycode.ucs2.encode([0x1D306]), '\uD834\uDF06'); // high surrogate -assert.equal(punycode.ucs2.encode([0xD800]), '\uD800'); +assert.strictEqual(punycode.ucs2.encode([0xD800]), '\uD800'); // high surrogate followed by non-surrogates -assert.equal(punycode.ucs2.encode([0xD800, 0x61, 0x62]), '\uD800ab'); +assert.strictEqual(punycode.ucs2.encode([0xD800, 0x61, 0x62]), '\uD800ab'); // low surrogate -assert.equal(punycode.ucs2.encode([0xDC00]), '\uDC00'); +assert.strictEqual(punycode.ucs2.encode([0xDC00]), '\uDC00'); // low surrogate followed by non-surrogates -assert.equal(punycode.ucs2.encode([0xDC00, 0x61, 0x62]), '\uDC00ab'); +assert.strictEqual(punycode.ucs2.encode([0xDC00, 0x61, 0x62]), '\uDC00ab'); -assert.equal(errors, 0); +assert.strictEqual(errors, 0); From 0605c74538738cfbf08c2e9252612f977a047b47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Tue, 29 Nov 2016 20:35:30 +0100 Subject: [PATCH 036/313] test: refactor test-crypto-timing-safe-equal Add RegExp arguments to throws assertions. PR-URL: https://github.com/nodejs/node/pull/9843 Reviewed-By: Rich Trott Reviewed-By: Teddy Katz Reviewed-By: Luigi Pinca --- test/sequential/test-crypto-timing-safe-equal.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/sequential/test-crypto-timing-safe-equal.js b/test/sequential/test-crypto-timing-safe-equal.js index 6e15a577188cc3..9c4265a672cc0f 100644 --- a/test/sequential/test-crypto-timing-safe-equal.js +++ b/test/sequential/test-crypto-timing-safe-equal.js @@ -23,12 +23,15 @@ assert.strictEqual( assert.throws(function() { crypto.timingSafeEqual(Buffer.from([1, 2, 3]), Buffer.from([1, 2])); -}, 'should throw when given buffers with different lengths'); +}, /^TypeError: Input buffers must have the same length$/, + 'should throw when given buffers with different lengths'); assert.throws(function() { crypto.timingSafeEqual('not a buffer', Buffer.from([1, 2])); -}, 'should throw if the first argument is not a buffer'); +}, /^TypeError: First argument must be a buffer$/, + 'should throw if the first argument is not a buffer'); assert.throws(function() { crypto.timingSafeEqual(Buffer.from([1, 2]), 'not a buffer'); -}, 'should throw if the second argument is not a buffer'); +}, /^TypeError: Second argument must be a buffer$/, + 'should throw if the second argument is not a buffer'); From 74919eb5efb235241cf2605e9ace7610f9bc7974 Mon Sep 17 00:00:00 2001 From: brad-decker Date: Tue, 29 Nov 2016 12:33:28 -0600 Subject: [PATCH 037/313] test: replace assert.equal with assert.strictEqual MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Using NodeTodo I learned of a need to swap out the .equal function with .strictEqual in a few test files. https://twitter.com/NodeTodo/status/803657321993961472 https://gist.github.com/Trott/864401455d4afa2428cd4814e072bd7c additional commits squashed: .strictEqual's argument signature is actual, expected, [message]. Previously some statements were listed as expected, actual. As asked in PR i swapped them to match the correct argument signature. PR-URL: https://github.com/nodejs/node/pull/9842 Reviewed-By: Rich Trott Reviewed-By: Gibson Fahnestock Reviewed-By: Luigi Pinca Reviewed-By: Michael Dawson Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso --- test/addons/async-hello-world/test.js | 4 ++-- test/addons/hello-world-function-export/test.js | 2 +- test/addons/hello-world/test.js | 2 +- test/addons/load-long-path/test.js | 2 +- .../test-stringbytes-external-at-max.js | 2 +- .../test-stringbytes-external-exceed-max-by-1-binary.js | 4 ++-- .../test-stringbytes-external-exceed-max-by-2.js | 2 +- 7 files changed, 9 insertions(+), 9 deletions(-) diff --git a/test/addons/async-hello-world/test.js b/test/addons/async-hello-world/test.js index bbc81bfbf8c9cb..7c27382c1c60f4 100644 --- a/test/addons/async-hello-world/test.js +++ b/test/addons/async-hello-world/test.js @@ -4,7 +4,7 @@ var assert = require('assert'); const binding = require(`./build/${common.buildType}/binding`); binding(5, common.mustCall(function(err, val) { - assert.equal(null, err); - assert.equal(10, val); + assert.strictEqual(err, null); + assert.strictEqual(val, 10); process.nextTick(common.mustCall(function() {})); })); diff --git a/test/addons/hello-world-function-export/test.js b/test/addons/hello-world-function-export/test.js index 89127fc787c94e..74ea66c79c548c 100644 --- a/test/addons/hello-world-function-export/test.js +++ b/test/addons/hello-world-function-export/test.js @@ -2,5 +2,5 @@ const common = require('../../common'); var assert = require('assert'); const binding = require(`./build/${common.buildType}/binding`); -assert.equal('world', binding()); +assert.strictEqual(binding(), 'world'); console.log('binding.hello() =', binding()); diff --git a/test/addons/hello-world/test.js b/test/addons/hello-world/test.js index 8d5c1238770064..32066388efe6cb 100644 --- a/test/addons/hello-world/test.js +++ b/test/addons/hello-world/test.js @@ -2,5 +2,5 @@ const common = require('../../common'); var assert = require('assert'); const binding = require(`./build/${common.buildType}/binding`); -assert.equal('world', binding.hello()); +assert.strictEqual(binding.hello(), 'world'); console.log('binding.hello() =', binding.hello()); diff --git a/test/addons/load-long-path/test.js b/test/addons/load-long-path/test.js index 2f09f2b3ff005c..b17942b45a6f34 100644 --- a/test/addons/load-long-path/test.js +++ b/test/addons/load-long-path/test.js @@ -34,4 +34,4 @@ fs.writeFileSync(addonDestinationPath, contents); // Attempt to load at long path destination var addon = require(addonDestinationPath); assert.notEqual(addon, null); -assert.equal(addon.hello(), 'world'); +assert.strictEqual(addon.hello(), 'world'); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js index bd71f05d61bf2c..2ce695852e25ae 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-at-max.js @@ -30,4 +30,4 @@ if (!binding.ensureAllocation(2 * kStringMaxLength)) { } const maxString = buf.toString('latin1'); -assert.equal(maxString.length, kStringMaxLength); +assert.strictEqual(maxString.length, kStringMaxLength); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js index c54706fd46c599..51324a3f337731 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-1-binary.js @@ -34,9 +34,9 @@ assert.throws(function() { }, /"toString\(\)" failed/); var maxString = buf.toString('latin1', 1); -assert.equal(maxString.length, kStringMaxLength); +assert.strictEqual(maxString.length, kStringMaxLength); // Free the memory early instead of at the end of the next assignment maxString = undefined; maxString = buf.toString('latin1', 0, kStringMaxLength); -assert.equal(maxString.length, kStringMaxLength); +assert.strictEqual(maxString.length, kStringMaxLength); diff --git a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js index 11f23ff1bf7627..0fab606e4663ec 100644 --- a/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js +++ b/test/addons/stringbytes-external-exceed-max/test-stringbytes-external-exceed-max-by-2.js @@ -30,4 +30,4 @@ if (!binding.ensureAllocation(2 * kStringMaxLength)) { } const maxString = buf.toString('utf16le'); -assert.equal(maxString.length, (kStringMaxLength + 2) / 2); +assert.strictEqual(maxString.length, (kStringMaxLength + 2) / 2); From 015812e2b8838103c8ee8c83c20b6f6768de9bfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Tue, 29 Nov 2016 20:28:08 +0100 Subject: [PATCH 038/313] test: refactor test-fs-non-number-arguments-throw * Add RegExp arguments to throws assertions. * Use common.mustCall for emitter callback. PR-URL: https://github.com/nodejs/node/pull/9844 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- test/parallel/test-fs-non-number-arguments-throw.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-fs-non-number-arguments-throw.js b/test/parallel/test-fs-non-number-arguments-throw.js index 8f34a1fcbb92b1..b13041ca3eecb6 100644 --- a/test/parallel/test-fs-non-number-arguments-throw.js +++ b/test/parallel/test-fs-non-number-arguments-throw.js @@ -15,17 +15,20 @@ const saneEmitter = fs.createReadStream(tempFile, { start: 4, end: 6 }); assert.throws(function() { fs.createReadStream(tempFile, { start: '4', end: 6 }); -}, "start as string didn't throw an error for createReadStream"); +}, /^TypeError: "start" option must be a Number$/, + "start as string didn't throw an error for createReadStream"); assert.throws(function() { fs.createReadStream(tempFile, { start: 4, end: '6' }); -}, "end as string didn't throw an error"); +}, /^TypeError: "end" option must be a Number$/, + "end as string didn't throw an error for createReadStream"); assert.throws(function() { fs.createWriteStream(tempFile, { start: '4' }); -}, "start as string didn't throw an error for createWriteStream"); +}, /^TypeError: "start" option must be a Number$/, + "start as string didn't throw an error for createWriteStream"); -saneEmitter.on('data', function(data) { +saneEmitter.on('data', common.mustCall(function(data) { assert.strictEqual(sanity, data.toString('utf8'), 'read ' + data.toString('utf8') + ' instead of ' + sanity); -}); +})); From a773843c01a989e5a87f4550c8732d6dab01a111 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 28 Nov 2016 13:50:21 -0800 Subject: [PATCH 039/313] test: refactor test-debug-args MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * indexOf() -> includes() * var -> const PR-URL: https://github.com/nodejs/node/pull/9833 Reviewed-By: Evan Lucas Reviewed-By: Prince John Wesley Reviewed-By: Michaël Zasso Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig --- test/parallel/test-debug-args.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-debug-args.js b/test/parallel/test-debug-args.js index e5f9f3716119ed..a4ed4f9f1ee719 100644 --- a/test/parallel/test-debug-args.js +++ b/test/parallel/test-debug-args.js @@ -2,6 +2,6 @@ // Flags: --debug-code require('../common'); -var assert = require('assert'); +const assert = require('assert'); -assert.notEqual(process.execArgv.indexOf('--debug-code'), -1); +assert(process.execArgv.includes('--debug-code')); From e55a5936cddcb7a9e1e65a0360b46712d45ef4f6 Mon Sep 17 00:00:00 2001 From: ben_cripps Date: Wed, 30 Nov 2016 09:43:26 -0600 Subject: [PATCH 040/313] test: use strictEqual in test-debugger-client.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/9857 Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott --- test/debugger/test-debugger-client.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/debugger/test-debugger-client.js b/test/debugger/test-debugger-client.js index fbe7ad1f0609be..04823113ec32c1 100644 --- a/test/debugger/test-debugger-client.js +++ b/test/debugger/test-debugger-client.js @@ -25,40 +25,40 @@ p.execute('Type: connect\r\n' + 'Protocol-Version: 1\r\n' + 'Embedding-Host: node v0.3.3-pre\r\n' + 'Content-Length: 0\r\n\r\n'); -assert.equal(1, resCount); +assert.strictEqual(resCount, 1); // Make sure split messages go in. var parts = []; parts.push('Content-Length: 336\r\n'); -assert.equal(21, parts[0].length); +assert.strictEqual(parts[0].length, 21); parts.push('\r\n'); -assert.equal(2, parts[1].length); +assert.strictEqual(parts[1].length, 2); var bodyLength = 0; parts.push('{"seq":12,"type":"event","event":"break","body":' + '{"invocationText":"#'); -assert.equal(78, parts[2].length); +assert.strictEqual(parts[2].length, 78); bodyLength += parts[2].length; parts.push('.[anonymous](req=#, ' + 'res=#)","sourceLine"'); -assert.equal(78, parts[3].length); +assert.strictEqual(parts[3].length, 78); bodyLength += parts[3].length; parts.push(':45,"sourceColumn":4,"sourceLineText":" debugger;",' + '"script":{"id":24,"name":"/home/ryan/projects/node/' + 'benchmark/http_simple.js","lineOffset":0,"columnOffset":0,' + '"lineCount":98}}}'); -assert.equal(180, parts[4].length); +assert.strictEqual(parts[4].length, 180); bodyLength += parts[4].length; -assert.equal(336, bodyLength); +assert.strictEqual(bodyLength, 336); for (var i = 0; i < parts.length; i++) { p.execute(parts[i]); } -assert.equal(2, resCount); +assert.strictEqual(resCount, 2); // Make sure that if we get backed up, we still manage to get all the @@ -77,7 +77,7 @@ var d = 'Content-Length: 466\r\n\r\n' + '{"seq":11,"type":"event","event":"scriptCollected","success":true,' + '"body":{"script":{"id":26}},"refs":[],"running":true}'; p.execute(d); -assert.equal(4, resCount); +assert.strictEqual(resCount, 4); var expectedConnections = 0; var tests = []; @@ -91,7 +91,7 @@ addTest(function(client, done) { client.reqVersion(function(err, v) { assert.ok(!err); console.log('version: %s', v); - assert.equal(process.versions.v8, v); + assert.strictEqual(process.versions.v8, v); done(); }); }); @@ -120,8 +120,8 @@ addTest(function(client, done) { client.reqEval('2+2', function(err, res) { console.error(res); assert.ok(!err); - assert.equal('4', res.text); - assert.equal(4, res.value); + assert.strictEqual(res.text, '4'); + assert.strictEqual(res.value, 4); done(); }); }); @@ -212,5 +212,5 @@ run(); process.on('exit', function(code) { if (!code) - assert.equal(expectedConnections, connectCount); + assert.strictEqual(connectCount, expectedConnections); }); From fcc511a57b0c3f193f6b177521f26a1734c60c1a Mon Sep 17 00:00:00 2001 From: ben_cripps Date: Wed, 30 Nov 2016 10:27:50 -0600 Subject: [PATCH 041/313] test: use strictEqual in test-zlib-truncated PR-URL: https://github.com/nodejs/node/pull/9858 Reviewed-By: Rich Trott --- test/parallel/test-zlib-truncated.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-zlib-truncated.js b/test/parallel/test-zlib-truncated.js index db2fca5e51271c..517b63886f8106 100644 --- a/test/parallel/test-zlib-truncated.js +++ b/test/parallel/test-zlib-truncated.js @@ -24,17 +24,18 @@ const inputString = 'ΩΩLorem ipsum dolor sit amet, consectetur adipiscing eli' zlib[methods.comp](inputString, function(err, compressed) { assert(!err); const truncated = compressed.slice(0, compressed.length / 2); + const toUTF8 = (buffer) => buffer.toString('utf-8'); // sync sanity assert.doesNotThrow(function() { const decompressed = zlib[methods.decompSync](compressed); - assert.equal(decompressed, inputString); + assert.strictEqual(toUTF8(decompressed), inputString); }); // async sanity zlib[methods.decomp](compressed, function(err, result) { assert.ifError(err); - assert.equal(result, inputString); + assert.strictEqual(toUTF8(result), inputString); }); // sync truncated input test @@ -51,17 +52,15 @@ const inputString = 'ΩΩLorem ipsum dolor sit amet, consectetur adipiscing eli' // sync truncated input test, finishFlush = Z_SYNC_FLUSH assert.doesNotThrow(function() { - const result = zlib[methods.decompSync](truncated, syncFlushOpt) - .toString(); - assert.equal(result, inputString.substr(0, result.length)); + const result = toUTF8(zlib[methods.decompSync](truncated, syncFlushOpt)); + assert.strictEqual(result, inputString.substr(0, result.length)); }); // async truncated input test, finishFlush = Z_SYNC_FLUSH zlib[methods.decomp](truncated, syncFlushOpt, function(err, decompressed) { assert.ifError(err); - - const result = decompressed.toString(); - assert.equal(result, inputString.substr(0, result.length)); + const result = toUTF8(decompressed); + assert.strictEqual(result, inputString.substr(0, result.length)); }); }); }); From 5186604fa9b5b01052f7ba6051281f5036fb93da Mon Sep 17 00:00:00 2001 From: makenova Date: Thu, 1 Dec 2016 09:36:20 -0600 Subject: [PATCH 042/313] test: refactor test-vm-debug-context MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit change var to const or let change assert.equal to assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/9875 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Michaël Zasso --- test/parallel/test-vm-debug-context.js | 34 +++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/test/parallel/test-vm-debug-context.js b/test/parallel/test-vm-debug-context.js index 9b8da58756c8d3..5cc23bb6f39148 100644 --- a/test/parallel/test-vm-debug-context.js +++ b/test/parallel/test-vm-debug-context.js @@ -1,9 +1,9 @@ /* eslint-disable no-debugger */ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var vm = require('vm'); -var spawn = require('child_process').spawn; +const common = require('../common'); +const assert = require('assert'); +const vm = require('vm'); +const spawn = require('child_process').spawn; assert.throws(function() { vm.runInDebugContext('*'); @@ -21,8 +21,8 @@ assert.throws(function() { vm.runInDebugContext('(function(f) { f(f) })(function(f) { f(f) })'); }, /RangeError/); -assert.equal(typeof vm.runInDebugContext('this'), 'object'); -assert.equal(typeof vm.runInDebugContext('Debug'), 'object'); +assert.strictEqual(typeof vm.runInDebugContext('this'), 'object'); +assert.strictEqual(typeof vm.runInDebugContext('Debug'), 'object'); assert.strictEqual(vm.runInDebugContext(), undefined); assert.strictEqual(vm.runInDebugContext(0), 0); @@ -46,11 +46,11 @@ assert.strictEqual(vm.runInDebugContext(undefined), undefined); debugger; } - assert.equal(breaks, 0); + assert.strictEqual(breaks, 0); Debug.setListener(ondebugevent); - assert.equal(breaks, 0); + assert.strictEqual(breaks, 0); breakpoint(); - assert.equal(breaks, 1); + assert.strictEqual(breaks, 1); } // Can set listeners and breakpoints on a single line file @@ -73,24 +73,24 @@ assert.strictEqual(vm.runInDebugContext(undefined), undefined); // See https://github.com/nodejs/node/issues/1190, fatal errors should not // crash the process. -var script = common.fixturesDir + '/vm-run-in-debug-context.js'; -var proc = spawn(process.execPath, [script]); -var data = []; +const script = common.fixturesDir + '/vm-run-in-debug-context.js'; +let proc = spawn(process.execPath, [script]); +const data = []; proc.stdout.on('data', common.fail); proc.stderr.on('data', data.push.bind(data)); proc.stderr.once('end', common.mustCall(function() { - var haystack = Buffer.concat(data).toString('utf8'); + const haystack = Buffer.concat(data).toString('utf8'); assert(/SyntaxError: Unexpected token \*/.test(haystack)); })); proc.once('exit', common.mustCall(function(exitCode, signalCode) { - assert.equal(exitCode, 1); - assert.equal(signalCode, null); + assert.strictEqual(exitCode, 1); + assert.strictEqual(signalCode, null); })); proc = spawn(process.execPath, [script, 'handle-fatal-exception']); proc.stdout.on('data', common.fail); proc.stderr.on('data', common.fail); proc.once('exit', common.mustCall(function(exitCode, signalCode) { - assert.equal(exitCode, 42); - assert.equal(signalCode, null); + assert.strictEqual(exitCode, 42); + assert.strictEqual(signalCode, null); })); From c9ac2b366fdfe43536691036eae776a83562f482 Mon Sep 17 00:00:00 2001 From: Adriana Rios Date: Thu, 1 Dec 2016 09:54:26 -0600 Subject: [PATCH 043/313] test: refactor test-tls-ecdh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit clear out const/let change assert.notEqual to assert move assert after common.hasCrypto check PR-URL: https://github.com/nodejs/node/pull/9878 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Gibson Fahnestock Reviewed-By: Michaël Zasso --- test/parallel/test-tls-ecdh.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-tls-ecdh.js b/test/parallel/test-tls-ecdh.js index e37552247ebd8c..99c6e108ab736a 100644 --- a/test/parallel/test-tls-ecdh.js +++ b/test/parallel/test-tls-ecdh.js @@ -1,31 +1,31 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); -var exec = require('child_process').exec; -var fs = require('fs'); +const exec = require('child_process').exec; +const fs = require('fs'); -var options = { +const options = { key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'), cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'), ciphers: '-ALL:ECDHE-RSA-AES128-SHA256', ecdhCurve: 'prime256v1' }; -var reply = 'I AM THE WALRUS'; // something recognizable +const reply = 'I AM THE WALRUS'; // something recognizable -var server = tls.createServer(options, common.mustCall(function(conn) { +const server = tls.createServer(options, common.mustCall(function(conn) { conn.end(reply); })); server.listen(0, '127.0.0.1', common.mustCall(function() { - var cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers + + let cmd = '"' + common.opensslCli + '" s_client -cipher ' + options.ciphers + ` -connect 127.0.0.1:${this.address().port}`; // for the performance and stability issue in s_client on Windows @@ -34,7 +34,7 @@ server.listen(0, '127.0.0.1', common.mustCall(function() { exec(cmd, common.mustCall(function(err, stdout, stderr) { if (err) throw err; - assert.notEqual(stdout.indexOf(reply), -1); + assert(stdout.includes(reply)); server.close(); })); })); From f38cb9bbe20ebad863d56dabad0b340d01dc43bb Mon Sep 17 00:00:00 2001 From: scalkpdev Date: Thu, 1 Dec 2016 10:04:59 -0600 Subject: [PATCH 044/313] test: update net-local-address-port MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - changed var to const - changed assert.equal to assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/9885 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Michaël Zasso --- test/parallel/test-net-local-address-port.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-net-local-address-port.js b/test/parallel/test-net-local-address-port.js index 5eebdb16be379b..56f8eab5855c46 100644 --- a/test/parallel/test-net-local-address-port.js +++ b/test/parallel/test-net-local-address-port.js @@ -1,11 +1,11 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var net = require('net'); +const common = require('../common'); +const assert = require('assert'); +const net = require('net'); var server = net.createServer(common.mustCall(function(socket) { - assert.equal(socket.localAddress, common.localhostIPv4); - assert.equal(socket.localPort, this.address().port); + assert.strictEqual(socket.localAddress, common.localhostIPv4); + assert.strictEqual(socket.localPort, this.address().port); socket.on('end', function() { server.close(); }); From 076c2c2c541b34aa81c4cb572a5743abc333ec97 Mon Sep 17 00:00:00 2001 From: Ashton Kinslow Date: Thu, 1 Dec 2016 15:12:39 -0600 Subject: [PATCH 045/313] test: test for http.request() invalid method error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a test for when an invalid http method is passed into http.request() to verify an error is thrown, that the error is the correct type, and the error message is correct. PR-URL: https://github.com/nodejs/node/pull/10080 Reviewed-By: Matteo Collina Reviewed-By: Evan Lucas Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso --- .../test-http-request-invalid-method-error.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 test/parallel/test-http-request-invalid-method-error.js diff --git a/test/parallel/test-http-request-invalid-method-error.js b/test/parallel/test-http-request-invalid-method-error.js new file mode 100644 index 00000000000000..febb340eacd2a4 --- /dev/null +++ b/test/parallel/test-http-request-invalid-method-error.js @@ -0,0 +1,12 @@ +'use strict'; +require('../common'); +const assert = require('assert'); +const http = require('http'); + +assert.throws( + () => { http.request({method: '\0'}); }, + (error) => { + return (error instanceof TypeError) && + /Method must be a valid HTTP token/.test(error); + } +); From e14a597d359a95daaed27da196500f578fbfb73d Mon Sep 17 00:00:00 2001 From: Kevin Zurawel Date: Thu, 1 Dec 2016 09:41:07 -0600 Subject: [PATCH 046/313] test: change equal to strictEqual This commit changes calls to `assert.equal()` to `assert.strictEqual()`. PR-URL: https://github.com/nodejs/node/pull/9872 Reviewed-By: Myles Borins Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Roman Reiss --- test/parallel/test-cluster-shared-handle-bind-error.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-cluster-shared-handle-bind-error.js b/test/parallel/test-cluster-shared-handle-bind-error.js index f5a08a1ed8481e..99573ef9539f56 100644 --- a/test/parallel/test-cluster-shared-handle-bind-error.js +++ b/test/parallel/test-cluster-shared-handle-bind-error.js @@ -12,7 +12,7 @@ if (cluster.isMaster) { var server = this; var worker = cluster.fork(); worker.on('exit', common.mustCall(function(exitCode) { - assert.equal(exitCode, 0); + assert.strictEqual(exitCode, 0); server.close(); })); }); @@ -20,7 +20,7 @@ if (cluster.isMaster) { var s = net.createServer(common.fail); s.listen(common.PORT, common.fail.bind(null, 'listen should have failed')); s.on('error', common.mustCall(function(err) { - assert.equal(err.code, 'EADDRINUSE'); + assert.strictEqual(err.code, 'EADDRINUSE'); process.disconnect(); })); } From f1d0bf4757d6402fdff2f013d443772b1b67bd20 Mon Sep 17 00:00:00 2001 From: lrlna Date: Thu, 1 Dec 2016 12:04:27 -0600 Subject: [PATCH 047/313] test: increase coverage for timers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add a test for cancelling timers with null or no arguments. PR-URL: https://github.com/nodejs/node/pull/10068 Reviewed-By: Myles Borins Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Jeremiah Senkpiel Reviewed-By: Michaël Zasso Reviewed-By: Roman Reiss --- ...t-timers-clear-null-does-not-throw-error.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/parallel/test-timers-clear-null-does-not-throw-error.js diff --git a/test/parallel/test-timers-clear-null-does-not-throw-error.js b/test/parallel/test-timers-clear-null-does-not-throw-error.js new file mode 100644 index 00000000000000..a15072a4c63f46 --- /dev/null +++ b/test/parallel/test-timers-clear-null-does-not-throw-error.js @@ -0,0 +1,18 @@ +'use strict'; +require('../common'); +const assert = require('assert'); + +// This test makes sure clearing timers with +// 'null' or no input does not throw error + +assert.doesNotThrow(() => clearInterval(null)); + +assert.doesNotThrow(() => clearInterval()); + +assert.doesNotThrow(() => clearTimeout(null)); + +assert.doesNotThrow(() => clearTimeout()); + +assert.doesNotThrow(() => clearImmediate(null)); + +assert.doesNotThrow(() => clearImmediate()); From 503167ba365be6321b82c8f95a47ce58ac22aa95 Mon Sep 17 00:00:00 2001 From: shiya Date: Thu, 1 Dec 2016 10:25:05 -0600 Subject: [PATCH 048/313] test: var -> let/const, .equal -> .strictEqual var -> let/const .equal -> .strictEqual PR-URL: https://github.com/nodejs/node/pull/9913 Reviewed-By: Prince John Wesley Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- .../test-net-better-error-messages-port.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-net-better-error-messages-port.js b/test/parallel/test-net-better-error-messages-port.js index 514e317fbb0b15..9d74438c5f923b 100644 --- a/test/parallel/test-net-better-error-messages-port.js +++ b/test/parallel/test-net-better-error-messages-port.js @@ -1,14 +1,14 @@ 'use strict'; -var common = require('../common'); -var net = require('net'); -var assert = require('assert'); +const common = require('../common'); +const net = require('net'); +const assert = require('assert'); -var c = net.createConnection(common.PORT); +const c = net.createConnection(common.PORT); c.on('connect', common.fail); c.on('error', common.mustCall(function(e) { - assert.equal(e.code, 'ECONNREFUSED'); - assert.equal(e.port, common.PORT); - assert.equal(e.address, '127.0.0.1'); + assert.strictEqual(e.code, 'ECONNREFUSED'); + assert.strictEqual(e.port, common.PORT); + assert.strictEqual(e.address, '127.0.0.1'); })); From 59f643096a201f50c3c6a65bb46166496b2e7f4b Mon Sep 17 00:00:00 2001 From: joyeecheung Date: Thu, 1 Dec 2016 10:00:10 -0600 Subject: [PATCH 049/313] test: improve test for crypto pbkdf2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - use assert.strictEqual instead of assert.equal - add regexp for assert.throws PR-URL: https://github.com/nodejs/node/pull/9883 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Michaël Zasso Reviewed-By: James M Snell --- test/parallel/test-crypto-pbkdf2.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-crypto-pbkdf2.js b/test/parallel/test-crypto-pbkdf2.js index f9fa7aa486318d..af72dc7f3067dd 100644 --- a/test/parallel/test-crypto-pbkdf2.js +++ b/test/parallel/test-crypto-pbkdf2.js @@ -13,10 +13,10 @@ var crypto = require('crypto'); // function testPBKDF2(password, salt, iterations, keylen, expected) { var actual = crypto.pbkdf2Sync(password, salt, iterations, keylen, 'sha256'); - assert.equal(actual.toString('latin1'), expected); + assert.strictEqual(actual.toString('latin1'), expected); crypto.pbkdf2(password, salt, iterations, keylen, 'sha256', (err, actual) => { - assert.equal(actual.toString('latin1'), expected); + assert.strictEqual(actual.toString('latin1'), expected); }); } @@ -47,43 +47,43 @@ testPBKDF2('pass\0word', 'sa\0lt', 4096, 16, var expected = '64c486c55d30d4c5a079b8823b7d7cb37ff0556f537da8410233bcec330ed956'; var key = crypto.pbkdf2Sync('password', 'salt', 32, 32, 'sha256'); -assert.equal(key.toString('hex'), expected); +assert.strictEqual(key.toString('hex'), expected); crypto.pbkdf2('password', 'salt', 32, 32, 'sha256', common.mustCall(ondone)); function ondone(err, key) { if (err) throw err; - assert.equal(key.toString('hex'), expected); + assert.strictEqual(key.toString('hex'), expected); } // Error path should not leak memory (check with valgrind). assert.throws(function() { crypto.pbkdf2('password', 'salt', 1, 20, null); -}); +}, /^Error: No callback provided to pbkdf2$/); // Should not work with Infinity key length assert.throws(function() { crypto.pbkdf2('password', 'salt', 1, Infinity, 'sha256', common.fail); -}, /Bad key length/); +}, /^TypeError: Bad key length$/); // Should not work with negative Infinity key length assert.throws(function() { crypto.pbkdf2('password', 'salt', 1, -Infinity, 'sha256', common.fail); -}, /Bad key length/); +}, /^TypeError: Bad key length$/); // Should not work with NaN key length assert.throws(function() { crypto.pbkdf2('password', 'salt', 1, NaN, 'sha256', common.fail); -}, /Bad key length/); +}, /^TypeError: Bad key length$/); // Should not work with negative key length assert.throws(function() { crypto.pbkdf2('password', 'salt', 1, -1, 'sha256', common.fail); -}, /Bad key length/); +}, /^TypeError: Bad key length$/); // Should not work with key length that does not fit into 32 signed bits assert.throws(function() { crypto.pbkdf2('password', 'salt', 1, 4073741824, 'sha256', common.fail); -}, /Bad key length/); +}, /^TypeError: Bad key length$/); // Should not get FATAL ERROR with empty password and salt // https://github.com/nodejs/node/issues/8571 From effa15ead95f6aa662eefcc79e7aba63c65cb917 Mon Sep 17 00:00:00 2001 From: Greg Valdez Date: Thu, 1 Dec 2016 10:53:02 -0600 Subject: [PATCH 050/313] test: use const in test-crypto-pbkdf2 Updated all remaining var to const PR-URL: https://github.com/nodejs/node/pull/9974 Reviewed-By: Rich Trott --- test/parallel/test-crypto-pbkdf2.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-crypto-pbkdf2.js b/test/parallel/test-crypto-pbkdf2.js index af72dc7f3067dd..20ea5c7298199a 100644 --- a/test/parallel/test-crypto-pbkdf2.js +++ b/test/parallel/test-crypto-pbkdf2.js @@ -1,18 +1,19 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var crypto = require('crypto'); +const crypto = require('crypto'); // // Test PBKDF2 with RFC 6070 test vectors (except #4) // function testPBKDF2(password, salt, iterations, keylen, expected) { - var actual = crypto.pbkdf2Sync(password, salt, iterations, keylen, 'sha256'); + const actual = + crypto.pbkdf2Sync(password, salt, iterations, keylen, 'sha256'); assert.strictEqual(actual.toString('latin1'), expected); crypto.pbkdf2(password, salt, iterations, keylen, 'sha256', (err, actual) => { @@ -44,9 +45,9 @@ testPBKDF2('pass\0word', 'sa\0lt', 4096, 16, '\x89\xb6\x9d\x05\x16\xf8\x29\x89\x3c\x69\x62\x26\x65' + '\x0a\x86\x87'); -var expected = +const expected = '64c486c55d30d4c5a079b8823b7d7cb37ff0556f537da8410233bcec330ed956'; -var key = crypto.pbkdf2Sync('password', 'salt', 32, 32, 'sha256'); +const key = crypto.pbkdf2Sync('password', 'salt', 32, 32, 'sha256'); assert.strictEqual(key.toString('hex'), expected); crypto.pbkdf2('password', 'salt', 32, 32, 'sha256', common.mustCall(ondone)); From a36389ee0836a5b3ca364754a850b37cbda89a80 Mon Sep 17 00:00:00 2001 From: Bidur Adhikari Date: Thu, 1 Dec 2016 11:51:06 -0600 Subject: [PATCH 051/313] test: use assert.strictEqual() cluster test Updated test-cluster-shared-handle-bind-privileged-port test method to use assert.strictEqual() instead of assert.equal() PR-URL: https://github.com/nodejs/node/pull/10042 Reviewed-By: Colin Ihrig Reviewed-By: Santiago Gimeno --- .../test-cluster-shared-handle-bind-privileged-port.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js index 9dc0e4ea773137..a04662750f39e4 100644 --- a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js +++ b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js @@ -18,13 +18,13 @@ if (cluster.isMaster) { // Master opens and binds the socket and shares it with the worker. cluster.schedulingPolicy = cluster.SCHED_NONE; cluster.fork().on('exit', common.mustCall(function(exitCode) { - assert.equal(exitCode, 0); + assert.strictEqual(exitCode, 0); })); } else { var s = net.createServer(common.fail); s.listen(42, common.fail.bind(null, 'listen should have failed')); s.on('error', common.mustCall(function(err) { - assert.equal(err.code, 'EACCES'); + assert.strictEqual(err.code, 'EACCES'); process.disconnect(); })); } From bf71b63444fa4c4433a2d32372a554a34c348dbd Mon Sep 17 00:00:00 2001 From: Greg Valdez Date: Thu, 1 Dec 2016 11:23:58 -0600 Subject: [PATCH 052/313] test: update to const iin cluster test Update `var` to `const` PR-URL: https://github.com/nodejs/node/pull/10007 Reviewed-By: Michael Dawson Reviewed-By: Colin Ihrig --- .../test-cluster-shared-handle-bind-privileged-port.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js index a04662750f39e4..c58aa5393519ad 100644 --- a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js +++ b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js @@ -1,8 +1,8 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var cluster = require('cluster'); -var net = require('net'); +const common = require('../common'); +const assert = require('assert'); +const cluster = require('cluster'); +const net = require('net'); if (common.isWindows) { common.skip('not reliable on Windows'); @@ -21,7 +21,7 @@ if (cluster.isMaster) { assert.strictEqual(exitCode, 0); })); } else { - var s = net.createServer(common.fail); + const s = net.createServer(common.fail); s.listen(42, common.fail.bind(null, 'listen should have failed')); s.on('error', common.mustCall(function(err) { assert.strictEqual(err.code, 'EACCES'); From ac5bf86fd12d03c6c8be9fe651884206f6946aad Mon Sep 17 00:00:00 2001 From: Kyle Carter Date: Thu, 1 Dec 2016 10:45:50 -0600 Subject: [PATCH 053/313] test: refactor test/parallel/test-fs-write-file.js - Updated references of var to const - Updated assert.equal to assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/9992 Reviewed-By: Rich Trott --- test/parallel/test-fs-write-file.js | 48 ++++++++++++++--------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/test/parallel/test-fs-write-file.js b/test/parallel/test-fs-write-file.js index 5ec95c8219aa4f..c62993b8da3990 100644 --- a/test/parallel/test-fs-write-file.js +++ b/test/parallel/test-fs-write-file.js @@ -1,34 +1,34 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var fs = require('fs'); -var join = require('path').join; +const common = require('../common'); +const assert = require('assert'); +const fs = require('fs'); +const join = require('path').join; common.refreshTmpDir(); -var filename = join(common.tmpDir, 'test.txt'); +const filename = join(common.tmpDir, 'test.txt'); -var n = 220; -var s = '南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,疆域包括今天中国的广东、' + - '广西两省区的大部份地区,福建省、湖南、贵州、云南的一小部份地区和越南的北部。' + - '南越国是秦朝灭亡后,由南海郡尉赵佗于前203年起兵兼并桂林郡和象郡后建立。' + - '前196年和前179年,南越国曾先后两次名义上臣属于西汉,成为西汉的“外臣”。前112年,' + - '南越国末代君主赵建德与西汉发生战争,被汉武帝于前111年所灭。南越国共存在93年,' + - '历经五代君主。南越国是岭南地区的第一个有记载的政权国家,采用封建制和郡县制并存的制度,' + - '它的建立保证了秦末乱世岭南地区社会秩序的稳定,有效的改善了岭南地区落后的政治、##济现状。\n'; +const n = 220; +const s = '南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,疆域包括今天中国的广东、' + + '广西两省区的大部份地区,福建省、湖南、贵州、云南的一小部份地区和越南的北部。' + + '南越国是秦朝灭亡后,由南海郡尉赵佗于前203年起兵兼并桂林郡和象郡后建立。' + + '前196年和前179年,南越国曾先后两次名义上臣属于西汉,成为西汉的“外臣”。前112年,' + + '南越国末代君主赵建德与西汉发生战争,被汉武帝于前111年所灭。南越国共存在93年,' + + '历经五代君主。南越国是岭南地区的第一个有记载的政权国家,采用封建制和郡县制并存的制度,' + + '它的建立保证了秦末乱世岭南地区社会秩序的稳定,有效的改善了岭南地区落后的政治、##济现状。\n'; fs.writeFile(filename, s, common.mustCall(function(e) { if (e) throw e; fs.readFile(filename, common.mustCall(function(e, buffer) { if (e) throw e; - assert.equal(Buffer.byteLength(s), buffer.length); + assert.strictEqual(Buffer.byteLength(s), buffer.length); })); })); // test that writeFile accepts buffers -var filename2 = join(common.tmpDir, 'test2.txt'); -var buf = Buffer.from(s, 'utf8'); +const filename2 = join(common.tmpDir, 'test2.txt'); +const buf = Buffer.from(s, 'utf8'); fs.writeFile(filename2, buf, common.mustCall(function(e) { if (e) throw e; @@ -36,32 +36,32 @@ fs.writeFile(filename2, buf, common.mustCall(function(e) { fs.readFile(filename2, common.mustCall(function(e, buffer) { if (e) throw e; - assert.equal(buf.length, buffer.length); + assert.strictEqual(buf.length, buffer.length); })); })); // test that writeFile accepts numbers. -var filename3 = join(common.tmpDir, 'test3.txt'); +const filename3 = join(common.tmpDir, 'test3.txt'); -var m = 0o600; +const m = 0o600; fs.writeFile(filename3, n, { mode: m }, common.mustCall(function(e) { if (e) throw e; // windows permissions aren't unix if (!common.isWindows) { - var st = fs.statSync(filename3); - assert.equal(st.mode & 0o700, m); + const st = fs.statSync(filename3); + assert.strictEqual(st.mode & 0o700, m); } fs.readFile(filename3, common.mustCall(function(e, buffer) { if (e) throw e; - assert.equal(Buffer.byteLength('' + n), buffer.length); + assert.strictEqual(Buffer.byteLength('' + n), buffer.length); })); })); // test that writeFile accepts file descriptors -var filename4 = join(common.tmpDir, 'test4.txt'); +const filename4 = join(common.tmpDir, 'test4.txt'); fs.open(filename4, 'w+', common.mustCall(function(e, fd) { if (e) throw e; @@ -75,7 +75,7 @@ fs.open(filename4, 'w+', common.mustCall(function(e, fd) { fs.readFile(filename4, common.mustCall(function(e, buffer) { if (e) throw e; - assert.equal(Buffer.byteLength(s), buffer.length); + assert.strictEqual(Buffer.byteLength(s), buffer.length); })); })); })); From 1bbaace480396ec41417e91c1c8ac650dee89e35 Mon Sep 17 00:00:00 2001 From: adelmann Date: Thu, 1 Dec 2016 11:39:38 -0600 Subject: [PATCH 054/313] test: refactor test-fs-write-file Replaced all error checks with assert.ifError(e). PR-URL: https://github.com/nodejs/node/pull/10030 Reviewed-By: Rich Trott --- test/parallel/test-fs-write-file.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-fs-write-file.js b/test/parallel/test-fs-write-file.js index c62993b8da3990..acc69764fe1425 100644 --- a/test/parallel/test-fs-write-file.js +++ b/test/parallel/test-fs-write-file.js @@ -18,10 +18,10 @@ const s = '南越国是前203年至前111年存在于岭南地区的一个国家 '它的建立保证了秦末乱世岭南地区社会秩序的稳定,有效的改善了岭南地区落后的政治、##济现状。\n'; fs.writeFile(filename, s, common.mustCall(function(e) { - if (e) throw e; + assert.ifError(e); fs.readFile(filename, common.mustCall(function(e, buffer) { - if (e) throw e; + assert.ifError(e); assert.strictEqual(Buffer.byteLength(s), buffer.length); })); })); @@ -31,10 +31,10 @@ const filename2 = join(common.tmpDir, 'test2.txt'); const buf = Buffer.from(s, 'utf8'); fs.writeFile(filename2, buf, common.mustCall(function(e) { - if (e) throw e; + assert.ifError(e); fs.readFile(filename2, common.mustCall(function(e, buffer) { - if (e) throw e; + assert.ifError(e); assert.strictEqual(buf.length, buffer.length); })); @@ -45,7 +45,7 @@ const filename3 = join(common.tmpDir, 'test3.txt'); const m = 0o600; fs.writeFile(filename3, n, { mode: m }, common.mustCall(function(e) { - if (e) throw e; + assert.ifError(e); // windows permissions aren't unix if (!common.isWindows) { @@ -54,7 +54,7 @@ fs.writeFile(filename3, n, { mode: m }, common.mustCall(function(e) { } fs.readFile(filename3, common.mustCall(function(e, buffer) { - if (e) throw e; + assert.ifError(e); assert.strictEqual(Buffer.byteLength('' + n), buffer.length); })); @@ -64,16 +64,16 @@ fs.writeFile(filename3, n, { mode: m }, common.mustCall(function(e) { const filename4 = join(common.tmpDir, 'test4.txt'); fs.open(filename4, 'w+', common.mustCall(function(e, fd) { - if (e) throw e; + assert.ifError(e); fs.writeFile(fd, s, common.mustCall(function(e) { - if (e) throw e; + assert.ifError(e); fs.close(fd, common.mustCall(function(e) { - if (e) throw e; + assert.ifError(e); fs.readFile(filename4, common.mustCall(function(e, buffer) { - if (e) throw e; + assert.ifError(e); assert.strictEqual(Buffer.byteLength(s), buffer.length); })); From f0937601668ee3b231687791fe701b7da523dafa Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 1 Dec 2016 11:05:31 -0600 Subject: [PATCH 055/313] test: use assert.strictEqual in test-crypto-ecb Updated test-crypto-ecb.js to change assert.equal to assert.strictEqual. PR-URL: https://github.com/nodejs/node/pull/9980 Reviewed-By: Rich Trott --- test/parallel/test-crypto-ecb.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-crypto-ecb.js b/test/parallel/test-crypto-ecb.js index dbdb486e9bcf7f..d423a386b30a19 100644 --- a/test/parallel/test-crypto-ecb.js +++ b/test/parallel/test-crypto-ecb.js @@ -21,7 +21,7 @@ crypto.DEFAULT_ENCODING = 'buffer'; var encrypt = crypto.createCipheriv('BF-ECB', 'SomeRandomBlahz0c5GZVnR', ''); var hex = encrypt.update('Hello World!', 'ascii', 'hex'); hex += encrypt.final('hex'); - assert.equal(hex.toUpperCase(), '6D385F424AAB0CFBF0BB86E07FFB7D71'); + assert.strictEqual(hex.toUpperCase(), '6D385F424AAB0CFBF0BB86E07FFB7D71'); }()); (function() { @@ -29,5 +29,5 @@ crypto.DEFAULT_ENCODING = 'buffer'; ''); var msg = decrypt.update('6D385F424AAB0CFBF0BB86E07FFB7D71', 'hex', 'ascii'); msg += decrypt.final('ascii'); - assert.equal(msg, 'Hello World!'); + assert.strictEqual(msg, 'Hello World!'); }()); From 61225eac1ac25ba0a1fa2a15ec2b433f4e03c889 Mon Sep 17 00:00:00 2001 From: Ian White Date: Thu, 1 Dec 2016 10:56:23 -0600 Subject: [PATCH 056/313] test: refactor test-fs-append-file-sync Change instances of `asset.equal` to `assert.strictEqual`. PR-URL: https://github.com/nodejs/node/pull/9977 Reviewed-By: Colin Ihrig --- test/parallel/test-fs-append-file-sync.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/parallel/test-fs-append-file-sync.js b/test/parallel/test-fs-append-file-sync.js index d337e6ff326995..4a252f7c89c11a 100644 --- a/test/parallel/test-fs-append-file-sync.js +++ b/test/parallel/test-fs-append-file-sync.js @@ -24,7 +24,7 @@ fs.appendFileSync(filename, data); var fileData = fs.readFileSync(filename); -assert.equal(Buffer.byteLength(data), fileData.length); +assert.strictEqual(Buffer.byteLength(data), fileData.length); // test that appends data to a non empty file var filename2 = join(common.tmpDir, 'append-sync2.txt'); @@ -34,8 +34,8 @@ fs.appendFileSync(filename2, data); var fileData2 = fs.readFileSync(filename2); -assert.equal(Buffer.byteLength(data) + currentFileData.length, - fileData2.length); +assert.strictEqual(Buffer.byteLength(data) + currentFileData.length, + fileData2.length); // test that appendFileSync accepts buffers var filename3 = join(common.tmpDir, 'append-sync3.txt'); @@ -46,7 +46,7 @@ fs.appendFileSync(filename3, buf); var fileData3 = fs.readFileSync(filename3); -assert.equal(buf.length + currentFileData.length, fileData3.length); +assert.strictEqual(buf.length + currentFileData.length, fileData3.length); // test that appendFile accepts numbers. var filename4 = join(common.tmpDir, 'append-sync4.txt'); @@ -58,13 +58,13 @@ fs.appendFileSync(filename4, num, { mode: m }); // windows permissions aren't unix if (!common.isWindows) { var st = fs.statSync(filename4); - assert.equal(st.mode & 0o700, m); + assert.strictEqual(st.mode & 0o700, m); } var fileData4 = fs.readFileSync(filename4); -assert.equal(Buffer.byteLength('' + num) + currentFileData.length, - fileData4.length); +assert.strictEqual(Buffer.byteLength('' + num) + currentFileData.length, + fileData4.length); // test that appendFile accepts file descriptors var filename5 = join(common.tmpDir, 'append-sync5.txt'); @@ -76,8 +76,8 @@ fs.closeSync(filename5fd); var fileData5 = fs.readFileSync(filename5); -assert.equal(Buffer.byteLength(data) + currentFileData.length, - fileData5.length); +assert.strictEqual(Buffer.byteLength(data) + currentFileData.length, + fileData5.length); //exit logic for cleanup From e75f81495df28585f5528590b392907d0c802dd3 Mon Sep 17 00:00:00 2001 From: Chris Bystrek Date: Thu, 1 Dec 2016 12:12:36 -0600 Subject: [PATCH 057/313] test: refactor test-fs-append-file-sync Update var to const. PR-URL: https://github.com/nodejs/node/pull/10056 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- test/parallel/test-fs-append-file-sync.js | 57 +++++++++++------------ 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/test/parallel/test-fs-append-file-sync.js b/test/parallel/test-fs-append-file-sync.js index 4a252f7c89c11a..c13fc8953ed5fa 100644 --- a/test/parallel/test-fs-append-file-sync.js +++ b/test/parallel/test-fs-append-file-sync.js @@ -1,80 +1,79 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var join = require('path').join; -var fs = require('fs'); - -var currentFileData = 'ABCD'; - -var num = 220; -var data = '南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,疆域包括今天中国的广东、' + - '广西两省区的大部份地区,福建省、湖南、贵州、云南的一小部份地区和越南的北部。' + - '南越国是秦朝灭亡后,由南海郡尉赵佗于前203年起兵兼并桂林郡和象郡后建立。' + - '前196年和前179年,南越国曾先后两次名义上臣属于西汉,成为西汉的“外臣”。前112年,' + - '南越国末代君主赵建德与西汉发生战争,被汉武帝于前111年所灭。南越国共存在93年,' + - '历经五代君主。南越国是岭南地区的第一个有记载的政权国家,采用封建制和郡县制并存的制度,' + - '它的建立保证了秦末乱世岭南地区社会秩序的稳定,有效的改善了岭南地区落后的政治、##济现状。\n'; +const common = require('../common'); +const assert = require('assert'); +const join = require('path').join; +const fs = require('fs'); + +const currentFileData = 'ABCD'; +const m = 0o600; +const num = 220; +const data = '南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,疆域包括今天中国的广东、' + + '广西两省区的大部份地区,福建省、湖南、贵州、云南的一小部份地区和越南的北部。' + + '南越国是秦朝灭亡后,由南海郡尉赵佗于前203年起兵兼并桂林郡和象郡后建立。' + + '前196年和前179年,南越国曾先后两次名义上臣属于西汉,成为西汉的“外臣”。前112年,' + + '南越国末代君主赵建德与西汉发生战争,被汉武帝于前111年所灭。南越国共存在93年,' + + '历经五代君主。南越国是岭南地区的第一个有记载的政权国家,采用封建制和郡县制并存的制度,' + + '它的建立保证了秦末乱世岭南地区社会秩序的稳定,有效的改善了岭南地区落后的政治、##济现状。\n'; common.refreshTmpDir(); // test that empty file will be created and have content added -var filename = join(common.tmpDir, 'append-sync.txt'); +const filename = join(common.tmpDir, 'append-sync.txt'); fs.appendFileSync(filename, data); -var fileData = fs.readFileSync(filename); +const fileData = fs.readFileSync(filename); assert.strictEqual(Buffer.byteLength(data), fileData.length); // test that appends data to a non empty file -var filename2 = join(common.tmpDir, 'append-sync2.txt'); +const filename2 = join(common.tmpDir, 'append-sync2.txt'); fs.writeFileSync(filename2, currentFileData); fs.appendFileSync(filename2, data); -var fileData2 = fs.readFileSync(filename2); +const fileData2 = fs.readFileSync(filename2); assert.strictEqual(Buffer.byteLength(data) + currentFileData.length, fileData2.length); // test that appendFileSync accepts buffers -var filename3 = join(common.tmpDir, 'append-sync3.txt'); +const filename3 = join(common.tmpDir, 'append-sync3.txt'); fs.writeFileSync(filename3, currentFileData); -var buf = Buffer.from(data, 'utf8'); +const buf = Buffer.from(data, 'utf8'); fs.appendFileSync(filename3, buf); -var fileData3 = fs.readFileSync(filename3); +const fileData3 = fs.readFileSync(filename3); assert.strictEqual(buf.length + currentFileData.length, fileData3.length); // test that appendFile accepts numbers. -var filename4 = join(common.tmpDir, 'append-sync4.txt'); +const filename4 = join(common.tmpDir, 'append-sync4.txt'); fs.writeFileSync(filename4, currentFileData, { mode: m }); -var m = 0o600; fs.appendFileSync(filename4, num, { mode: m }); // windows permissions aren't unix if (!common.isWindows) { - var st = fs.statSync(filename4); + const st = fs.statSync(filename4); assert.strictEqual(st.mode & 0o700, m); } -var fileData4 = fs.readFileSync(filename4); +const fileData4 = fs.readFileSync(filename4); assert.strictEqual(Buffer.byteLength('' + num) + currentFileData.length, fileData4.length); // test that appendFile accepts file descriptors -var filename5 = join(common.tmpDir, 'append-sync5.txt'); +const filename5 = join(common.tmpDir, 'append-sync5.txt'); fs.writeFileSync(filename5, currentFileData); -var filename5fd = fs.openSync(filename5, 'a+', 0o600); +const filename5fd = fs.openSync(filename5, 'a+', 0o600); fs.appendFileSync(filename5fd, data); fs.closeSync(filename5fd); -var fileData5 = fs.readFileSync(filename5); +const fileData5 = fs.readFileSync(filename5); assert.strictEqual(Buffer.byteLength(data) + currentFileData.length, fileData5.length); From 5009de4a53cdfac8f65d6cf2aa115540d6da08a7 Mon Sep 17 00:00:00 2001 From: Christine Hong Date: Thu, 1 Dec 2016 11:09:07 -0600 Subject: [PATCH 058/313] test: refactor test-cluster-setup-master-argv Change assert.equal to assert.strictEqual. PR-URL: https://github.com/nodejs/node/pull/9993 Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig --- test/parallel/test-cluster-setup-master-argv.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-cluster-setup-master-argv.js b/test/parallel/test-cluster-setup-master-argv.js index c42291417f9e79..e570af7cd52a60 100644 --- a/test/parallel/test-cluster-setup-master-argv.js +++ b/test/parallel/test-cluster-setup-master-argv.js @@ -8,8 +8,8 @@ setTimeout(common.fail.bind(assert, 'setup not emitted'), 1000).unref(); cluster.on('setup', function() { var clusterArgs = cluster.settings.args; var realArgs = process.argv; - assert.equal(clusterArgs[clusterArgs.length - 1], - realArgs[realArgs.length - 1]); + assert.strictEqual(clusterArgs[clusterArgs.length - 1], + realArgs[realArgs.length - 1]); }); assert.notStrictEqual(process.argv[process.argv.length - 1], 'OMG,OMG'); From 346ea432b4e8411ae600607765446c74933bc03f Mon Sep 17 00:00:00 2001 From: Oscar Martinez Date: Thu, 1 Dec 2016 10:54:07 -0600 Subject: [PATCH 059/313] test: refactor test-cluster-setup-master-argv - updated vars to const - add common.mustCall() to setup callback PR-URL: https://github.com/nodejs/node/pull/9960 Reviewed-By: Prince John Wesley Reviewed-By: Colin Ihrig --- test/parallel/test-cluster-setup-master-argv.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-cluster-setup-master-argv.js b/test/parallel/test-cluster-setup-master-argv.js index e570af7cd52a60..32c5a91b3caab4 100644 --- a/test/parallel/test-cluster-setup-master-argv.js +++ b/test/parallel/test-cluster-setup-master-argv.js @@ -1,16 +1,16 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var cluster = require('cluster'); +const common = require('../common'); +const assert = require('assert'); +const cluster = require('cluster'); setTimeout(common.fail.bind(assert, 'setup not emitted'), 1000).unref(); -cluster.on('setup', function() { +cluster.on('setup', common.mustCall(function() { var clusterArgs = cluster.settings.args; var realArgs = process.argv; assert.strictEqual(clusterArgs[clusterArgs.length - 1], realArgs[realArgs.length - 1]); -}); +})); assert.notStrictEqual(process.argv[process.argv.length - 1], 'OMG,OMG'); process.argv.push('OMG,OMG'); From c4277d9b5e37f054d76c3367288b5d916b7b5896 Mon Sep 17 00:00:00 2001 From: Julian Duque Date: Thu, 1 Dec 2016 10:42:32 -0600 Subject: [PATCH 060/313] test: refactor test for crypto cipher/decipher iv Replace assert.equal with assert.strictEqual. PR-URL: https://github.com/nodejs/node/pull/9943 Reviewed-By: Rich Trott --- test/parallel/test-crypto-cipheriv-decipheriv.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-crypto-cipheriv-decipheriv.js b/test/parallel/test-crypto-cipheriv-decipheriv.js index a3a14738c43e73..7756ed8938ab37 100644 --- a/test/parallel/test-crypto-cipheriv-decipheriv.js +++ b/test/parallel/test-crypto-cipheriv-decipheriv.js @@ -22,7 +22,7 @@ function testCipher1(key, iv) { var txt = decipher.update(ciph, 'hex', 'utf8'); txt += decipher.final('utf8'); - assert.equal(txt, plaintext, 'encryption and decryption with key and iv'); + assert.strictEqual(txt, plaintext, 'encryption/decryption with key and iv'); // streaming cipher interface // NB: In real life, it's not guaranteed that you can get all of it @@ -36,7 +36,7 @@ function testCipher1(key, iv) { dStream.end(ciph); txt = dStream.read().toString('utf8'); - assert.equal(txt, plaintext, 'streaming cipher iv'); + assert.strictEqual(txt, plaintext, 'streaming cipher iv'); } @@ -54,7 +54,7 @@ function testCipher2(key, iv) { var txt = decipher.update(ciph, 'buffer', 'utf8'); txt += decipher.final('utf8'); - assert.equal(txt, plaintext, 'encryption and decryption with key and iv'); + assert.strictEqual(txt, plaintext, 'encryption/decryption with key and iv'); } testCipher1('0123456789abcd0123456789', '12345678'); From 895472474b6128c1211d09910d19afb44e3cdc67 Mon Sep 17 00:00:00 2001 From: Aileen Date: Thu, 1 Dec 2016 11:25:35 -0600 Subject: [PATCH 061/313] test: refactor test-crypto-cipheriv-decipheriv Make change in test file from var to const/let. PR-URL: https://github.com/nodejs/node/pull/10018 Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig --- .../test-crypto-cipheriv-decipheriv.js | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/test/parallel/test-crypto-cipheriv-decipheriv.js b/test/parallel/test-crypto-cipheriv-decipheriv.js index 7756ed8938ab37..6f22dbe71affb1 100644 --- a/test/parallel/test-crypto-cipheriv-decipheriv.js +++ b/test/parallel/test-crypto-cipheriv-decipheriv.js @@ -1,25 +1,25 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var crypto = require('crypto'); +const crypto = require('crypto'); function testCipher1(key, iv) { // Test encyrption and decryption with explicit key and iv - var plaintext = - '32|RmVZZkFUVmpRRkp0TmJaUm56ZU9qcnJkaXNNWVNpTTU*|iXmckfRWZBGWWELw' + - 'eCBsThSsfUHLeRe0KCsK8ooHgxie0zOINpXxfZi/oNG7uq9JWFVCk70gfzQH8ZUJ' + - 'jAfaFg**'; - var cipher = crypto.createCipheriv('des-ede3-cbc', key, iv); - var ciph = cipher.update(plaintext, 'utf8', 'hex'); + const plaintext = + '32|RmVZZkFUVmpRRkp0TmJaUm56ZU9qcnJkaXNNWVNpTTU*|iXmckfRWZBGWWELw' + + 'eCBsThSsfUHLeRe0KCsK8ooHgxie0zOINpXxfZi/oNG7uq9JWFVCk70gfzQH8ZUJ' + + 'jAfaFg**'; + const cipher = crypto.createCipheriv('des-ede3-cbc', key, iv); + let ciph = cipher.update(plaintext, 'utf8', 'hex'); ciph += cipher.final('hex'); - var decipher = crypto.createDecipheriv('des-ede3-cbc', key, iv); - var txt = decipher.update(ciph, 'hex', 'utf8'); + const decipher = crypto.createDecipheriv('des-ede3-cbc', key, iv); + let txt = decipher.update(ciph, 'hex', 'utf8'); txt += decipher.final('utf8'); assert.strictEqual(txt, plaintext, 'encryption/decryption with key and iv'); @@ -28,11 +28,11 @@ function testCipher1(key, iv) { // NB: In real life, it's not guaranteed that you can get all of it // in a single read() like this. But in this case, we know it's // quite small, so there's no harm. - var cStream = crypto.createCipheriv('des-ede3-cbc', key, iv); + const cStream = crypto.createCipheriv('des-ede3-cbc', key, iv); cStream.end(plaintext); ciph = cStream.read(); - var dStream = crypto.createDecipheriv('des-ede3-cbc', key, iv); + const dStream = crypto.createDecipheriv('des-ede3-cbc', key, iv); dStream.end(ciph); txt = dStream.read().toString('utf8'); @@ -42,16 +42,16 @@ function testCipher1(key, iv) { function testCipher2(key, iv) { // Test encyrption and decryption with explicit key and iv - var plaintext = - '32|RmVZZkFUVmpRRkp0TmJaUm56ZU9qcnJkaXNNWVNpTTU*|iXmckfRWZBGWWELw' + - 'eCBsThSsfUHLeRe0KCsK8ooHgxie0zOINpXxfZi/oNG7uq9JWFVCk70gfzQH8ZUJ' + - 'jAfaFg**'; - var cipher = crypto.createCipheriv('des-ede3-cbc', key, iv); - var ciph = cipher.update(plaintext, 'utf8', 'buffer'); + const plaintext = + '32|RmVZZkFUVmpRRkp0TmJaUm56ZU9qcnJkaXNNWVNpTTU*|iXmckfRWZBGWWELw' + + 'eCBsThSsfUHLeRe0KCsK8ooHgxie0zOINpXxfZi/oNG7uq9JWFVCk70gfzQH8ZUJ' + + 'jAfaFg**'; + const cipher = crypto.createCipheriv('des-ede3-cbc', key, iv); + let ciph = cipher.update(plaintext, 'utf8', 'buffer'); ciph = Buffer.concat([ciph, cipher.final('buffer')]); - var decipher = crypto.createDecipheriv('des-ede3-cbc', key, iv); - var txt = decipher.update(ciph, 'buffer', 'utf8'); + const decipher = crypto.createDecipheriv('des-ede3-cbc', key, iv); + let txt = decipher.update(ciph, 'buffer', 'utf8'); txt += decipher.final('utf8'); assert.strictEqual(txt, plaintext, 'encryption/decryption with key and iv'); From 52cc1bb08eab3440a168b43aeb02bd9e41b13598 Mon Sep 17 00:00:00 2001 From: David Bradford Date: Thu, 1 Dec 2016 10:02:09 -0600 Subject: [PATCH 062/313] test: refactor test-vm-static-this.js Remove console statements and prefer strictEqual() over equal() in assertions. PR-URL: https://github.com/nodejs/node/pull/9887 Reviewed-By: Colin Ihrig --- test/parallel/test-vm-static-this.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-vm-static-this.js b/test/parallel/test-vm-static-this.js index a3cf2d820c3423..c4f10c183b6ef2 100644 --- a/test/parallel/test-vm-static-this.js +++ b/test/parallel/test-vm-static-this.js @@ -5,21 +5,21 @@ var vm = require('vm'); common.globalCheck = false; -console.error('run a string'); +// Run a string var result = vm.runInThisContext('\'passed\';'); -assert.equal('passed', result); +assert.strictEqual('passed', result); -console.error('thrown error'); +// thrown error assert.throws(function() { vm.runInThisContext('throw new Error(\'test\');'); }, /test/); global.hello = 5; vm.runInThisContext('hello = 2'); -assert.equal(2, global.hello); +assert.strictEqual(2, global.hello); -console.error('pass values'); +// pass values var code = 'foo = 1;' + 'bar = 2;' + 'if (typeof baz !== \'undefined\') throw new Error(\'test fail\');'; @@ -28,11 +28,11 @@ global.obj = { foo: 0, baz: 3 }; /* eslint-disable no-unused-vars */ var baz = vm.runInThisContext(code); /* eslint-enable no-unused-vars */ -assert.equal(0, global.obj.foo); -assert.equal(2, global.bar); -assert.equal(1, global.foo); +assert.strictEqual(0, global.obj.foo); +assert.strictEqual(2, global.bar); +assert.strictEqual(1, global.foo); -console.error('call a function'); +// call a function global.f = function() { global.foo = 100; }; vm.runInThisContext('f()'); -assert.equal(100, global.foo); +assert.strictEqual(100, global.foo); From a2e88f6e0c6e9063babbf4656abacbb0d9d31841 Mon Sep 17 00:00:00 2001 From: stokingerl Date: Thu, 1 Dec 2016 10:39:06 -0600 Subject: [PATCH 063/313] test: refactor test-child-process-spawn-error Change instances of assert.equal to assert.strictEqual. PR-URL: https://github.com/nodejs/node/pull/9937 Reviewed-By: Colin Ihrig --- test/parallel/test-child-process-spawn-error.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-child-process-spawn-error.js b/test/parallel/test-child-process-spawn-error.js index eaf9c1303966a5..1a9de1e18b523b 100644 --- a/test/parallel/test-child-process-spawn-error.js +++ b/test/parallel/test-child-process-spawn-error.js @@ -5,13 +5,13 @@ var assert = require('assert'); var enoentPath = 'foo123'; var spawnargs = ['bar']; -assert.equal(common.fileExists(enoentPath), false); +assert.strictEqual(common.fileExists(enoentPath), false); var enoentChild = spawn(enoentPath, spawnargs); enoentChild.on('error', common.mustCall(function(err) { - assert.equal(err.code, 'ENOENT'); - assert.equal(err.errno, 'ENOENT'); - assert.equal(err.syscall, 'spawn ' + enoentPath); - assert.equal(err.path, enoentPath); + assert.strictEqual(err.code, 'ENOENT'); + assert.strictEqual(err.errno, 'ENOENT'); + assert.strictEqual(err.syscall, 'spawn ' + enoentPath); + assert.strictEqual(err.path, enoentPath); assert.deepStrictEqual(err.spawnargs, spawnargs); })); From 91b942ec8a8785dda0d18c15fa9e6740856da450 Mon Sep 17 00:00:00 2001 From: Johnny Reading Date: Thu, 1 Dec 2016 10:43:40 -0600 Subject: [PATCH 064/313] test: refactor child-process-spawn-error Use const instead of var for assignments. PR-URL: https://github.com/nodejs/node/pull/9951 Reviewed-By: Prince John Wesley Reviewed-By: Colin Ihrig --- test/parallel/test-child-process-spawn-error.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-child-process-spawn-error.js b/test/parallel/test-child-process-spawn-error.js index 1a9de1e18b523b..6cd3c47eef46ad 100644 --- a/test/parallel/test-child-process-spawn-error.js +++ b/test/parallel/test-child-process-spawn-error.js @@ -1,13 +1,13 @@ 'use strict'; -var common = require('../common'); -var spawn = require('child_process').spawn; -var assert = require('assert'); +const common = require('../common'); +const spawn = require('child_process').spawn; +const assert = require('assert'); -var enoentPath = 'foo123'; -var spawnargs = ['bar']; +const enoentPath = 'foo123'; +const spawnargs = ['bar']; assert.strictEqual(common.fileExists(enoentPath), false); -var enoentChild = spawn(enoentPath, spawnargs); +const enoentChild = spawn(enoentPath, spawnargs); enoentChild.on('error', common.mustCall(function(err) { assert.strictEqual(err.code, 'ENOENT'); assert.strictEqual(err.errno, 'ENOENT'); From b48d83190ac7b1c5349fc2d380029966ad3ecee3 Mon Sep 17 00:00:00 2001 From: Mitchell Stoutin Date: Thu, 1 Dec 2016 10:28:14 -0600 Subject: [PATCH 065/313] test: crypto-hash-stream-pipe use strict equal Replaces the use of assert.equal() with assert.strictEqual in test code. PR-URL: https://github.com/nodejs/node/pull/9935 Reviewed-By: Colin Ihrig --- test/parallel/test-crypto-hash-stream-pipe.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-crypto-hash-stream-pipe.js b/test/parallel/test-crypto-hash-stream-pipe.js index 0ad9f18b0b45d8..5a0e409bada218 100644 --- a/test/parallel/test-crypto-hash-stream-pipe.js +++ b/test/parallel/test-crypto-hash-stream-pipe.js @@ -14,7 +14,7 @@ var h = crypto.createHash('sha1'); var expect = '15987e60950cf22655b9323bc1e281f9c4aff47e'; s.pipe(h).on('data', common.mustCall(function(c) { - assert.equal(c, expect); + assert.strictEqual(c, expect); })).setEncoding('hex'); s.end('aoeu'); From 393cb97cbb7a7cf9b7747f59ee618fe8a0b0c436 Mon Sep 17 00:00:00 2001 From: Matt Wilson Date: Thu, 1 Dec 2016 12:07:32 -0600 Subject: [PATCH 066/313] test: refactor test-crypto-hash-stream-pipe Change var to const. PR-URL: https://github.com/nodejs/node/pull/10055 Reviewed-By: Colin Ihrig Reviewed-By: Santiago Gimeno --- test/parallel/test-crypto-hash-stream-pipe.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-crypto-hash-stream-pipe.js b/test/parallel/test-crypto-hash-stream-pipe.js index 5a0e409bada218..33aa0f74566be0 100644 --- a/test/parallel/test-crypto-hash-stream-pipe.js +++ b/test/parallel/test-crypto-hash-stream-pipe.js @@ -1,17 +1,18 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var crypto = require('crypto'); -var stream = require('stream'); -var s = new stream.PassThrough(); -var h = crypto.createHash('sha1'); -var expect = '15987e60950cf22655b9323bc1e281f9c4aff47e'; +const assert = require('assert'); +const crypto = require('crypto'); + +const stream = require('stream'); +const s = new stream.PassThrough(); +const h = crypto.createHash('sha1'); +const expect = '15987e60950cf22655b9323bc1e281f9c4aff47e'; s.pipe(h).on('data', common.mustCall(function(c) { assert.strictEqual(c, expect); From e6747048e70886d267163e8eacc81d4345ed2260 Mon Sep 17 00:00:00 2001 From: Matt Webb Date: Thu, 1 Dec 2016 09:49:13 -0600 Subject: [PATCH 067/313] test: Updating vars to const and tsl server test PR-URL: https://github.com/nodejs/node/pull/9874 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-tls-timeout-server.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-tls-timeout-server.js b/test/parallel/test-tls-timeout-server.js index f72f39b392e297..72ee6d01629429 100644 --- a/test/parallel/test-tls-timeout-server.js +++ b/test/parallel/test-tls-timeout-server.js @@ -1,28 +1,28 @@ 'use strict'; -var common = require('../common'); +const common = require('../common'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const tls = require('tls'); -var net = require('net'); -var fs = require('fs'); +const net = require('net'); +const fs = require('fs'); -var options = { +const options = { key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'), handshakeTimeout: 50 }; -var server = tls.createServer(options, common.fail); +const server = tls.createServer(options, common.fail); server.on('tlsClientError', common.mustCall(function(err, conn) { conn.destroy(); server.close(); })); -server.listen(0, function() { +server.listen(0, common.mustCall(function() { net.connect({ host: '127.0.0.1', port: this.address().port }); -}); +})); From 7fa3b6fad33e6cc3654bed38f59e498db631b106 Mon Sep 17 00:00:00 2001 From: Devon Rifkin Date: Thu, 1 Dec 2016 09:49:49 -0600 Subject: [PATCH 068/313] test: refactor test-tls-timeout-server-2 * Use `common.mustCall` for all callbacks * Use `const` instead of `var` PR-URL: https://github.com/nodejs/node/pull/9876 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/parallel/test-tls-timeout-server-2.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-tls-timeout-server-2.js b/test/parallel/test-tls-timeout-server-2.js index a054f41f623455..1613e9fc4e06d6 100644 --- a/test/parallel/test-tls-timeout-server-2.js +++ b/test/parallel/test-tls-timeout-server-2.js @@ -1,32 +1,32 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const tls = require('tls'); -var fs = require('fs'); +const fs = require('fs'); -var options = { +const options = { key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem') }; -var server = tls.createServer(options, function(cleartext) { - var s = cleartext.setTimeout(50, function() { +const server = tls.createServer(options, common.mustCall(function(cleartext) { + const s = cleartext.setTimeout(50, function() { cleartext.destroy(); server.close(); }); assert.ok(s instanceof tls.TLSSocket); -}); +})); -server.listen(0, function() { +server.listen(0, common.mustCall(function() { tls.connect({ host: '127.0.0.1', port: this.address().port, rejectUnauthorized: false }); -}); +})); From c5bfe90900af1a75137916b68223c2693855b040 Mon Sep 17 00:00:00 2001 From: rajatk Date: Thu, 1 Dec 2016 09:47:46 -0600 Subject: [PATCH 069/313] test: var to const/let in test-tls-set-ciphers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this change is part of code and learn (NINA-2016) PR-URL: https://github.com/nodejs/node/pull/9877 Reviewed-By: Colin Ihrig Reviewed-By: Prince John Wesley Reviewed-By: Luigi Pinca Reviewed-By: Michaël Zasso Reviewed-By: James M Snell --- test/parallel/test-tls-set-ciphers.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/parallel/test-tls-set-ciphers.js b/test/parallel/test-tls-set-ciphers.js index 4d9274b184232d..5a85e3b22e4c62 100644 --- a/test/parallel/test-tls-set-ciphers.js +++ b/test/parallel/test-tls-set-ciphers.js @@ -1,5 +1,5 @@ 'use strict'; -var common = require('../common'); +const common = require('../common'); if (!common.opensslCli) { common.skip('node compiled without OpenSSL CLI.'); @@ -11,25 +11,25 @@ if (!common.hasCrypto) { return; } -var assert = require('assert'); -var exec = require('child_process').exec; -var tls = require('tls'); -var fs = require('fs'); +const assert = require('assert'); +const exec = require('child_process').exec; +const tls = require('tls'); +const fs = require('fs'); -var options = { +const options = { key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'), cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'), ciphers: 'DES-CBC3-SHA' }; -var reply = 'I AM THE WALRUS'; // something recognizable -var response = ''; +const reply = 'I AM THE WALRUS'; // something recognizable +let response = ''; process.on('exit', function() { assert.notEqual(response.indexOf(reply), -1); }); -var server = tls.createServer(options, common.mustCall(function(conn) { +const server = tls.createServer(options, common.mustCall(function(conn) { conn.end(reply); })); From 0c66f68fe2c6f0b57aa477cc8d34ffaaf492bde1 Mon Sep 17 00:00:00 2001 From: Julian Duque Date: Thu, 1 Dec 2016 09:56:23 -0600 Subject: [PATCH 070/313] test: replace equal with strictEqual MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Replace assert.equal with assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/9879 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Michaël Zasso Reviewed-By: James M Snell --- test/parallel/test-child-process-validate-stdio.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-child-process-validate-stdio.js b/test/parallel/test-child-process-validate-stdio.js index 09d000467404b6..384efdf15a1425 100644 --- a/test/parallel/test-child-process-validate-stdio.js +++ b/test/parallel/test-child-process-validate-stdio.js @@ -19,10 +19,10 @@ assert.throws(function() { { const stdio1 = []; const result = _validateStdio(stdio1, false); - assert.equal(stdio1.length, 3); - assert.equal(result.hasOwnProperty('stdio'), true); - assert.equal(result.hasOwnProperty('ipc'), true); - assert.equal(result.hasOwnProperty('ipcFd'), true); + assert.strictEqual(stdio1.length, 3); + assert.strictEqual(result.hasOwnProperty('stdio'), true); + assert.strictEqual(result.hasOwnProperty('ipc'), true); + assert.strictEqual(result.hasOwnProperty('ipcFd'), true); } // should throw if stdio has ipc and sync is true From 5446b3c6a0ac3196a54565ac71b40107976a02ce Mon Sep 17 00:00:00 2001 From: Julian Duque Date: Thu, 1 Dec 2016 10:05:31 -0600 Subject: [PATCH 071/313] test: replace equal with strictEqual in crypto Replace assert.equal with assert.strictEqual in crypto cipher-decipher test PR-URL: https://github.com/nodejs/node/pull/9886 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Evan Lucas Reviewed-By: James M Snell --- test/parallel/test-crypto-cipher-decipher.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-crypto-cipher-decipher.js b/test/parallel/test-crypto-cipher-decipher.js index 0a140cf9f49d36..5ea6d3899561a6 100644 --- a/test/parallel/test-crypto-cipher-decipher.js +++ b/test/parallel/test-crypto-cipher-decipher.js @@ -27,7 +27,7 @@ function testCipher1(key) { var txt = decipher.update(ciph, 'hex', 'utf8'); txt += decipher.final('utf8'); - assert.equal(txt, plaintext, 'encryption and decryption'); + assert.strictEqual(txt, plaintext, 'encryption and decryption'); // streaming cipher interface // NB: In real life, it's not guaranteed that you can get all of it @@ -41,7 +41,7 @@ function testCipher1(key) { dStream.end(ciph); txt = dStream.read().toString('utf8'); - assert.equal(txt, plaintext, 'encryption and decryption with streams'); + assert.strictEqual(txt, plaintext, 'encryption and decryption with streams'); } @@ -63,7 +63,7 @@ function testCipher2(key) { var txt = decipher.update(ciph, 'base64', 'utf8'); txt += decipher.final('utf8'); - assert.equal(txt, plaintext, 'encryption and decryption with Base64'); + assert.strictEqual(txt, plaintext, 'encryption and decryption with Base64'); } testCipher1('MySecretKey123'); From 6d5b21517a6992657043b45531c6a61049640edb Mon Sep 17 00:00:00 2001 From: Peter Masucci Date: Thu, 1 Dec 2016 11:01:54 -0500 Subject: [PATCH 072/313] test: swap var->const/let and equal->strictEqual Change instances of var with const/let. Change assert.equal to assert.strictEqual. PR-URL: https://github.com/nodejs/node/pull/9888 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-tls-no-sslv3.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/test/parallel/test-tls-no-sslv3.js b/test/parallel/test-tls-no-sslv3.js index c284356ce37bb6..16a722ef85b9da 100644 --- a/test/parallel/test-tls-no-sslv3.js +++ b/test/parallel/test-tls-no-sslv3.js @@ -1,30 +1,30 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const tls = require('tls'); -var fs = require('fs'); -var spawn = require('child_process').spawn; +const fs = require('fs'); +const spawn = require('child_process').spawn; if (common.opensslCli === false) { common.skip('node compiled without OpenSSL CLI.'); return; } -var cert = fs.readFileSync(common.fixturesDir + '/test_cert.pem'); -var key = fs.readFileSync(common.fixturesDir + '/test_key.pem'); -var server = tls.createServer({ cert: cert, key: key }, common.fail); -var errors = []; -var stderr = ''; +const cert = fs.readFileSync(common.fixturesDir + '/test_cert.pem'); +const key = fs.readFileSync(common.fixturesDir + '/test_key.pem'); +const server = tls.createServer({ cert: cert, key: key }, common.fail); +const errors = []; +let stderr = ''; server.listen(0, '127.0.0.1', function() { - var address = this.address().address + ':' + this.address().port; - var args = ['s_client', + const address = this.address().address + ':' + this.address().port; + const args = ['s_client', '-ssl3', '-connect', address]; @@ -32,14 +32,14 @@ server.listen(0, '127.0.0.1', function() { if (common.isWindows) args.push('-no_rand_screen'); - var client = spawn(common.opensslCli, args, { stdio: 'pipe' }); + const client = spawn(common.opensslCli, args, { stdio: 'pipe' }); client.stdout.pipe(process.stdout); client.stderr.pipe(process.stderr); client.stderr.setEncoding('utf8'); client.stderr.on('data', (data) => stderr += data); client.once('exit', common.mustCall(function(exitCode) { - assert.equal(exitCode, 1); + assert.strictEqual(exitCode, 1); server.close(); })); }); @@ -50,7 +50,7 @@ process.on('exit', function() { if (/unknown option -ssl3/.test(stderr)) { common.skip('`openssl s_client -ssl3` not supported.'); } else { - assert.equal(errors.length, 1); + assert.strictEqual(errors.length, 1); assert(/:wrong version number/.test(errors[0].message)); } }); From 8097b3b1eca14c42f92074b4dfb0451e26e19a60 Mon Sep 17 00:00:00 2001 From: Daniel Flores Date: Thu, 1 Dec 2016 10:12:47 -0600 Subject: [PATCH 073/313] test: Update to const and use regex for assertions Use const over var. Assert error message with regex. PR-URL: https://github.com/nodejs/node/pull/9891 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-net-localerror.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-net-localerror.js b/test/parallel/test-net-localerror.js index ed7c9471e0397f..184e55c890b2bb 100644 --- a/test/parallel/test-net-localerror.js +++ b/test/parallel/test-net-localerror.js @@ -1,19 +1,19 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var net = require('net'); +const common = require('../common'); +const assert = require('assert'); +const net = require('net'); connect({ host: 'localhost', port: common.PORT, localPort: 'foobar', -}, 'localPort should be a number: foobar'); +}, /^TypeError: "localPort" option should be a number: foobar$/); connect({ host: 'localhost', port: common.PORT, localAddress: 'foobar', -}, 'localAddress should be a valid IP: foobar'); +}, /^TypeError: "localAddress" option must be a valid IP: foobar$/); function connect(opts, msg) { assert.throws(function() { From 80e3aabedd5b1c1aef8410a45e3d89905b24c878 Mon Sep 17 00:00:00 2001 From: Harish Tejwani Date: Thu, 1 Dec 2016 10:14:12 -0600 Subject: [PATCH 074/313] test: change var to const for require and strict equality checks PR-URL: https://github.com/nodejs/node/pull/9892 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- .../test-require-extensions-same-filename-as-dir.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-require-extensions-same-filename-as-dir.js b/test/parallel/test-require-extensions-same-filename-as-dir.js index 41051dad45e10f..ff95a47b9a83bf 100644 --- a/test/parallel/test-require-extensions-same-filename-as-dir.js +++ b/test/parallel/test-require-extensions-same-filename-as-dir.js @@ -1,9 +1,9 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); -var content = require(common.fixturesDir + +const content = require(common.fixturesDir + '/json-with-directory-name-module/module-stub/one/two/three.js'); -assert.notEqual(content.rocko, 'artischocko'); -assert.equal(content, 'hello from module-stub!'); +assert.notStrictEqual(content.rocko, 'artischocko'); +assert.strictEqual(content, 'hello from module-stub!'); From a11f9ab82e4cbe5d5472d75ad411d7e298ae0232 Mon Sep 17 00:00:00 2001 From: Wes Tyler Date: Thu, 1 Dec 2016 10:06:40 -0600 Subject: [PATCH 075/313] test: refactor test-child-process-stdio-inherit assert.equal() -> assert.strictEqual() PR-URL: https://github.com/nodejs/node/pull/9893 Reviewed-By: Santiago Gimeno Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-child-process-stdio-inherit.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-child-process-stdio-inherit.js b/test/parallel/test-child-process-stdio-inherit.js index 409c0af7ca0d31..dc3bb3e9aa9391 100644 --- a/test/parallel/test-child-process-stdio-inherit.js +++ b/test/parallel/test-child-process-stdio-inherit.js @@ -22,10 +22,10 @@ function grandparent() { child.stdin.end(input); child.on('close', function(code, signal) { - assert.equal(code, 0); - assert.equal(signal, null); + assert.strictEqual(code, 0); + assert.strictEqual(signal, null); // cat on windows adds a \r\n at the end. - assert.equal(output.trim(), input.trim()); + assert.strictEqual(output.trim(), input.trim()); }); } From 5377f72b5a62e22e7f4a493cce5b8cdf0f44ce96 Mon Sep 17 00:00:00 2001 From: Jonathan Darling Date: Thu, 1 Dec 2016 09:50:25 -0600 Subject: [PATCH 076/313] test: refactor test-fs-read-stream-inherit.js * convert assert.equal to assert.strictEqual * convert var to const/let PR-URL: https://github.com/nodejs/node/pull/9894 Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-fs-read-stream-inherit.js | 92 ++++++++++---------- 1 file changed, 45 insertions(+), 47 deletions(-) diff --git a/test/parallel/test-fs-read-stream-inherit.js b/test/parallel/test-fs-read-stream-inherit.js index c4216f4e13905b..40ec5ed883829b 100644 --- a/test/parallel/test-fs-read-stream-inherit.js +++ b/test/parallel/test-fs-read-stream-inherit.js @@ -1,22 +1,22 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); -var path = require('path'); -var fs = require('fs'); -var fn = path.join(common.fixturesDir, 'elipses.txt'); -var rangeFile = path.join(common.fixturesDir, 'x.txt'); +const path = require('path'); +const fs = require('fs'); +const fn = path.join(common.fixturesDir, 'elipses.txt'); +const rangeFile = path.join(common.fixturesDir, 'x.txt'); -var callbacks = { open: 0, end: 0, close: 0 }; +const callbacks = { open: 0, end: 0, close: 0 }; -var paused = false; +let paused = false; -var file = fs.ReadStream(fn); +const file = fs.ReadStream(fn); file.on('open', function(fd) { file.length = 0; callbacks.open++; - assert.equal('number', typeof fd); + assert.strictEqual(typeof fd, 'number'); assert.ok(file.readable); // GH-535 @@ -48,19 +48,17 @@ file.on('end', function(chunk) { file.on('close', function() { callbacks.close++; - - //assert.equal(fs.readFileSync(fn), fileContent); }); -var file3 = fs.createReadStream(fn, Object.create({encoding: 'utf8'})); +const file3 = fs.createReadStream(fn, Object.create({encoding: 'utf8'})); file3.length = 0; file3.on('data', function(data) { - assert.equal('string', typeof data); + assert.strictEqual(typeof data, 'string'); file3.length += data.length; - for (var i = 0; i < data.length; i++) { + for (let i = 0; i < data.length; i++) { // http://www.fileformat.info/info/unicode/char/2026/index.htm - assert.equal('\u2026', data[i]); + assert.strictEqual(data[i], '\u2026'); } }); @@ -69,57 +67,57 @@ file3.on('close', function() { }); process.on('exit', function() { - assert.equal(1, callbacks.open); - assert.equal(1, callbacks.end); - assert.equal(2, callbacks.close); - assert.equal(30000, file.length); - assert.equal(10000, file3.length); + assert.strictEqual(callbacks.open, 1); + assert.strictEqual(callbacks.end, 1); + assert.strictEqual(callbacks.close, 2); + assert.strictEqual(file.length, 30000); + assert.strictEqual(file3.length, 10000); console.error('ok'); }); -var file4 = fs.createReadStream(rangeFile, Object.create({bufferSize: 1, - start: 1, end: 2})); -assert.equal(file4.start, 1); -assert.equal(file4.end, 2); -var contentRead = ''; +const file4 = fs.createReadStream(rangeFile, Object.create({bufferSize: 1, + start: 1, end: 2})); +assert.strictEqual(file4.start, 1); +assert.strictEqual(file4.end, 2); +let contentRead = ''; file4.on('data', function(data) { contentRead += data.toString('utf-8'); }); file4.on('end', function(data) { - assert.equal(contentRead, 'yz'); + assert.strictEqual(contentRead, 'yz'); }); -var file5 = fs.createReadStream(rangeFile, Object.create({bufferSize: 1, - start: 1})); -assert.equal(file5.start, 1); +const file5 = fs.createReadStream(rangeFile, Object.create({bufferSize: 1, + start: 1})); +assert.strictEqual(file5.start, 1); file5.data = ''; file5.on('data', function(data) { file5.data += data.toString('utf-8'); }); file5.on('end', function() { - assert.equal(file5.data, 'yz\n'); + assert.strictEqual(file5.data, 'yz\n'); }); // https://github.com/joyent/node/issues/2320 -var file6 = fs.createReadStream(rangeFile, Object.create({bufferSize: 1.23, - start: 1})); -assert.equal(file6.start, 1); +const file6 = fs.createReadStream(rangeFile, Object.create({bufferSize: 1.23, + start: 1})); +assert.strictEqual(file6.start, 1); file6.data = ''; file6.on('data', function(data) { file6.data += data.toString('utf-8'); }); file6.on('end', function() { - assert.equal(file6.data, 'yz\n'); + assert.strictEqual(file6.data, 'yz\n'); }); assert.throws(function() { fs.createReadStream(rangeFile, Object.create({start: 10, end: 2})); }, /"start" option must be <= "end" option/); -var stream = fs.createReadStream(rangeFile, Object.create({ start: 0, - end: 0 })); -assert.equal(stream.start, 0); -assert.equal(stream.end, 0); +const stream = fs.createReadStream(rangeFile, Object.create({ start: 0, + end: 0 })); +assert.strictEqual(stream.start, 0); +assert.strictEqual(stream.end, 0); stream.data = ''; stream.on('data', function(chunk) { @@ -127,16 +125,16 @@ stream.on('data', function(chunk) { }); stream.on('end', function() { - assert.equal('x', stream.data); + assert.strictEqual(stream.data, 'x'); }); // pause and then resume immediately. -var pauseRes = fs.createReadStream(rangeFile); +const pauseRes = fs.createReadStream(rangeFile); pauseRes.pause(); pauseRes.resume(); -var file7 = fs.createReadStream(rangeFile, Object.create({autoClose: false })); -assert.equal(file7.autoClose, false); +let file7 = fs.createReadStream(rangeFile, Object.create({autoClose: false })); +assert.strictEqual(file7.autoClose, false); file7.on('data', function() {}); file7.on('end', function() { process.nextTick(function() { @@ -154,18 +152,18 @@ function file7Next() { file7.data += data; }); file7.on('end', function(err) { - assert.equal(file7.data, 'xyz\n'); + assert.strictEqual(file7.data, 'xyz\n'); }); } // Just to make sure autoClose won't close the stream because of error. -var file8 = fs.createReadStream(null, Object.create({fd: 13337, - autoClose: false })); +const file8 = fs.createReadStream(null, Object.create({fd: 13337, + autoClose: false })); file8.on('data', function() {}); file8.on('error', common.mustCall(function() {})); // Make sure stream is destroyed when file does not exist. -var file9 = fs.createReadStream('/path/to/file/that/does/not/exist'); +const file9 = fs.createReadStream('/path/to/file/that/does/not/exist'); file9.on('data', function() {}); file9.on('error', common.mustCall(function() {})); From f3ef0d9c1bc9e23a50cabe6878a2b4890af3881b Mon Sep 17 00:00:00 2001 From: JDHarmon Date: Thu, 1 Dec 2016 12:56:32 -0500 Subject: [PATCH 077/313] test: use strictEqual in cwd-enoent Changed all references from assert.Equal() to assert.strictEqual(). PR-URL: https://github.com/nodejs/node/pull/10077 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen --- test/parallel/test-cwd-enoent.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-cwd-enoent.js b/test/parallel/test-cwd-enoent.js index f5c04fe068e945..c671ef2be4619e 100644 --- a/test/parallel/test-cwd-enoent.js +++ b/test/parallel/test-cwd-enoent.js @@ -21,6 +21,6 @@ proc.stdout.pipe(process.stdout); proc.stderr.pipe(process.stderr); proc.once('exit', common.mustCall(function(exitCode, signalCode) { - assert.equal(exitCode, 0); - assert.equal(signalCode, null); + assert.strictEqual(exitCode, 0); + assert.strictEqual(signalCode, null); })); From 776cfc5898ee976c9cbe19573f379b9a27526872 Mon Sep 17 00:00:00 2001 From: bjdelro Date: Thu, 1 Dec 2016 10:17:17 -0600 Subject: [PATCH 078/313] test: change var to const in test-tls-key-mismatch.js PR-URL: https://github.com/nodejs/node/pull/9897 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-tls-key-mismatch.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-tls-key-mismatch.js b/test/parallel/test-tls-key-mismatch.js index f0eb8121bd68e5..65cac6f07a296c 100644 --- a/test/parallel/test-tls-key-mismatch.js +++ b/test/parallel/test-tls-key-mismatch.js @@ -1,15 +1,15 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); -var fs = require('fs'); +const assert = require('assert'); +const tls = require('tls'); +const fs = require('fs'); -var options = { +const options = { key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem') }; From 7bf13f3834cd98cf5b3bc506f3d0548a73132f62 Mon Sep 17 00:00:00 2001 From: Hitesh Kanwathirtha Date: Fri, 2 Dec 2016 07:22:55 +0000 Subject: [PATCH 079/313] test: polish test-net-better-error-messages-listen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cleans up test-net-better-error-messages-list.js with following: - var -> const - assert.equal -> assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/10087 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Michaël Zasso --- .../test-net-better-error-messages-listen.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-net-better-error-messages-listen.js b/test/parallel/test-net-better-error-messages-listen.js index 44adce71a7d541..15ef4036aaa89a 100644 --- a/test/parallel/test-net-better-error-messages-listen.js +++ b/test/parallel/test-net-better-error-messages-listen.js @@ -1,12 +1,12 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var net = require('net'); +const common = require('../common'); +const assert = require('assert'); +const net = require('net'); -var server = net.createServer(common.fail); +const server = net.createServer(common.fail); server.listen(1, '1.1.1.1', common.fail); server.on('error', common.mustCall(function(e) { - assert.equal(e.address, '1.1.1.1'); - assert.equal(e.port, 1); - assert.equal(e.syscall, 'listen'); + assert.strictEqual(e.address, '1.1.1.1'); + assert.strictEqual(e.port, 1); + assert.strictEqual(e.syscall, 'listen'); })); From bb950a6997feb63c8aa0957f6ab072551a8345b3 Mon Sep 17 00:00:00 2001 From: Julian Duque Date: Thu, 1 Dec 2016 10:21:00 -0600 Subject: [PATCH 080/313] test: improve test for crypto padding Replace assert.equal with assert.strictEqual and use RegExp in assert.throws PR-URL: https://github.com/nodejs/node/pull/9906 Reviewed-By: Colin Ihrig --- test/parallel/test-crypto-padding.js | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/test/parallel/test-crypto-padding.js b/test/parallel/test-crypto-padding.js index 7822df64d9e2de..eeb41f278ac6fc 100644 --- a/test/parallel/test-crypto-padding.js +++ b/test/parallel/test-crypto-padding.js @@ -74,16 +74,18 @@ function dec(encd, pad) { * Test encryption */ -assert.equal(enc(ODD_LENGTH_PLAIN, true), ODD_LENGTH_ENCRYPTED); -assert.equal(enc(EVEN_LENGTH_PLAIN, true), EVEN_LENGTH_ENCRYPTED); +assert.strictEqual(enc(ODD_LENGTH_PLAIN, true), ODD_LENGTH_ENCRYPTED); +assert.strictEqual(enc(EVEN_LENGTH_PLAIN, true), EVEN_LENGTH_ENCRYPTED); assert.throws(function() { // input must have block length % enc(ODD_LENGTH_PLAIN, false); -}); +}, /data not multiple of block length/); assert.doesNotThrow(function() { - assert.equal(enc(EVEN_LENGTH_PLAIN, false), EVEN_LENGTH_ENCRYPTED_NOPAD); + assert.strictEqual( + enc(EVEN_LENGTH_PLAIN, false), EVEN_LENGTH_ENCRYPTED_NOPAD + ); }); @@ -91,21 +93,25 @@ assert.doesNotThrow(function() { * Test decryption */ -assert.equal(dec(ODD_LENGTH_ENCRYPTED, true), ODD_LENGTH_PLAIN); -assert.equal(dec(EVEN_LENGTH_ENCRYPTED, true), EVEN_LENGTH_PLAIN); +assert.strictEqual(dec(ODD_LENGTH_ENCRYPTED, true), ODD_LENGTH_PLAIN); +assert.strictEqual(dec(EVEN_LENGTH_ENCRYPTED, true), EVEN_LENGTH_PLAIN); assert.doesNotThrow(function() { // returns including original padding - assert.equal(dec(ODD_LENGTH_ENCRYPTED, false).length, 32); - assert.equal(dec(EVEN_LENGTH_ENCRYPTED, false).length, 48); + assert.strictEqual(dec(ODD_LENGTH_ENCRYPTED, false).length, 32); + assert.strictEqual(dec(EVEN_LENGTH_ENCRYPTED, false).length, 48); }); assert.throws(function() { // must have at least 1 byte of padding (PKCS): - assert.equal(dec(EVEN_LENGTH_ENCRYPTED_NOPAD, true), EVEN_LENGTH_PLAIN); -}); + assert.strictEqual( + dec(EVEN_LENGTH_ENCRYPTED_NOPAD, true), EVEN_LENGTH_PLAIN + ); +}, /bad decrypt/); assert.doesNotThrow(function() { // no-pad encrypted string should return the same: - assert.equal(dec(EVEN_LENGTH_ENCRYPTED_NOPAD, false), EVEN_LENGTH_PLAIN); + assert.strictEqual( + dec(EVEN_LENGTH_ENCRYPTED_NOPAD, false), EVEN_LENGTH_PLAIN + ); }); From 67b11a429b7cda9a6334b206fd82e0c275f50c44 Mon Sep 17 00:00:00 2001 From: davidmarkclements Date: Thu, 1 Dec 2016 13:35:05 -0600 Subject: [PATCH 081/313] test: assert.equal -> assert.strictEqual changes assert.equal to assert.strictEqual to ensure specificity PR-URL: https://github.com/nodejs/node/pull/10067 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen --- test/parallel/test-crypto-domain.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-crypto-domain.js b/test/parallel/test-crypto-domain.js index 9bb6c0229648e7..ec9985719933d3 100644 --- a/test/parallel/test-crypto-domain.js +++ b/test/parallel/test-crypto-domain.js @@ -13,7 +13,7 @@ function test(fn) { var ex = new Error('BAM'); var d = domain.create(); d.on('error', common.mustCall(function(err) { - assert.equal(err, ex); + assert.strictEqual(err, ex); })); var cb = common.mustCall(function() { throw ex; From f10c3210a1da857e3bf79df67294eb05fcdbaaf8 Mon Sep 17 00:00:00 2001 From: Cesar Hernandez Date: Thu, 1 Dec 2016 13:31:53 -0600 Subject: [PATCH 082/313] test: refactor test-dgram-exclusive-implicit-bind * assert.equal() -> assert.strictEqual() PR-URL: https://github.com/nodejs/node/pull/10066 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Santiago Gimeno --- test/parallel/test-dgram-exclusive-implicit-bind.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-dgram-exclusive-implicit-bind.js b/test/parallel/test-dgram-exclusive-implicit-bind.js index 9a3cb91b3ac105..c8799cf058b99e 100644 --- a/test/parallel/test-dgram-exclusive-implicit-bind.js +++ b/test/parallel/test-dgram-exclusive-implicit-bind.js @@ -45,7 +45,7 @@ if (cluster.isMaster) { var ports = {}; process.on('exit', function() { - assert.equal(pass, true); + assert.strictEqual(pass, true); }); var target = dgram.createSocket('udp4'); @@ -55,12 +55,12 @@ if (cluster.isMaster) { ports[rinfo.port] = true; if (common.isWindows && messages === 2) { - assert.equal(Object.keys(ports).length, 2); + assert.strictEqual(Object.keys(ports).length, 2); done(); } if (!common.isWindows && messages === 4) { - assert.equal(Object.keys(ports).length, 3); + assert.strictEqual(Object.keys(ports).length, 3); done(); } From bffbf6881a95d546f9b50cac622a19518cd2e32b Mon Sep 17 00:00:00 2001 From: davidmarkclements Date: Thu, 1 Dec 2016 13:24:40 -0600 Subject: [PATCH 083/313] test: assert.equal -> assert.strictEqual changes assert.equal to assert.strictEqual to ensure specificity PR-URL: https://github.com/nodejs/node/pull/10065 Reviewed-By: Colin Ihrig --- test/parallel/test-crypto-stream.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-crypto-stream.js b/test/parallel/test-crypto-stream.js index 10271e27da4191..1720cc7c4e0aea 100644 --- a/test/parallel/test-crypto-stream.js +++ b/test/parallel/test-crypto-stream.js @@ -30,8 +30,10 @@ if (!common.hasFipsCrypto) { // Create an md5 hash of "Hallo world" var hasher1 = crypto.createHash('md5'); hasher1.pipe(new Stream2buffer(common.mustCall(function end(err, hash) { - assert.equal(err, null); - assert.equal(hash.toString('hex'), '06460dadb35d3d503047ce750ceb2d07'); + assert.strictEqual(err, null); + assert.strictEqual( + hash.toString('hex'), '06460dadb35d3d503047ce750ceb2d07' + ); }))); hasher1.end('Hallo world'); From 55269c106be4b2aa9b855c0b0d98dce9692e4b76 Mon Sep 17 00:00:00 2001 From: adelmann Date: Sat, 3 Dec 2016 23:05:27 -0800 Subject: [PATCH 084/313] test: refactor test-fs-append-file.js - Replaced var with either const or let. - Replaced assert.equal() with assert.strictEqual(). - Replaced all error checks with assert.ifError(e). PR-URL: https://github.com/nodejs/node/pull/10110 Reviewed-By: Colin Ihrig Reviewed-By: Santiago Gimeno --- test/parallel/test-fs-append-file.js | 87 ++++++++++++++-------------- 1 file changed, 44 insertions(+), 43 deletions(-) diff --git a/test/parallel/test-fs-append-file.js b/test/parallel/test-fs-append-file.js index 5970c8cec1515d..00691b1e74e6fe 100644 --- a/test/parallel/test-fs-append-file.js +++ b/test/parallel/test-fs-append-file.js @@ -1,129 +1,130 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var fs = require('fs'); -var join = require('path').join; +const common = require('../common'); +const assert = require('assert'); +const fs = require('fs'); +const join = require('path').join; -var filename = join(common.tmpDir, 'append.txt'); +const filename = join(common.tmpDir, 'append.txt'); -var currentFileData = 'ABCD'; +const currentFileData = 'ABCD'; -var n = 220; -var s = '南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,疆域包括今天中国的广东、' + - '广西两省区的大部份地区,福建省、湖南、贵州、云南的一小部份地区和越南的北部。' + - '南越国是秦朝灭亡后,由南海郡尉赵佗于前203年起兵兼并桂林郡和象郡后建立。' + - '前196年和前179年,南越国曾先后两次名义上臣属于西汉,成为西汉的“外臣”。前112年,' + - '南越国末代君主赵建德与西汉发生战争,被汉武帝于前111年所灭。南越国共存在93年,' + - '历经五代君主。南越国是岭南地区的第一个有记载的政权国家,采用封建制和郡县制并存的制度,' + - '它的建立保证了秦末乱世岭南地区社会秩序的稳定,有效的改善了岭南地区落后的政治、##济现状。\n'; +const n = 220; +const s = '南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,疆域包括今天中国的广东、' + + '广西两省区的大部份地区,福建省、湖南、贵州、云南的一小部份地区和越南的北部。' + + '南越国是秦朝灭亡后,由南海郡尉赵佗于前203年起兵兼并桂林郡和象郡后建立。' + + '前196年和前179年,南越国曾先后两次名义上臣属于西汉,成为西汉的“外臣”。前112年,' + + '南越国末代君主赵建德与西汉发生战争,被汉武帝于前111年所灭。南越国共存在93年,' + + '历经五代君主。南越国是岭南地区的第一个有记载的政权国家,采用封建制和郡县制并存的制度,' + + '它的建立保证了秦末乱世岭南地区社会秩序的稳定,有效的改善了岭南地区落后的政治、##济现状。\n'; -var ncallbacks = 0; +let ncallbacks = 0; common.refreshTmpDir(); // test that empty file will be created and have content added fs.appendFile(filename, s, function(e) { - if (e) throw e; + assert.ifError(e); ncallbacks++; fs.readFile(filename, function(e, buffer) { - if (e) throw e; + assert.ifError(e); ncallbacks++; - assert.equal(Buffer.byteLength(s), buffer.length); + assert.strictEqual(Buffer.byteLength(s), buffer.length); }); }); // test that appends data to a non empty file -var filename2 = join(common.tmpDir, 'append2.txt'); +const filename2 = join(common.tmpDir, 'append2.txt'); fs.writeFileSync(filename2, currentFileData); fs.appendFile(filename2, s, function(e) { - if (e) throw e; + assert.ifError(e); ncallbacks++; fs.readFile(filename2, function(e, buffer) { - if (e) throw e; + assert.ifError(e); ncallbacks++; - assert.equal(Buffer.byteLength(s) + currentFileData.length, buffer.length); + assert.strictEqual(Buffer.byteLength(s) + currentFileData.length, + buffer.length); }); }); // test that appendFile accepts buffers -var filename3 = join(common.tmpDir, 'append3.txt'); +const filename3 = join(common.tmpDir, 'append3.txt'); fs.writeFileSync(filename3, currentFileData); -var buf = Buffer.from(s, 'utf8'); +const buf = Buffer.from(s, 'utf8'); fs.appendFile(filename3, buf, function(e) { - if (e) throw e; + assert.ifError(e); ncallbacks++; fs.readFile(filename3, function(e, buffer) { - if (e) throw e; + assert.ifError(e); ncallbacks++; - assert.equal(buf.length + currentFileData.length, buffer.length); + assert.strictEqual(buf.length + currentFileData.length, buffer.length); }); }); // test that appendFile accepts numbers. -var filename4 = join(common.tmpDir, 'append4.txt'); +const filename4 = join(common.tmpDir, 'append4.txt'); fs.writeFileSync(filename4, currentFileData); -var m = 0o600; +const m = 0o600; fs.appendFile(filename4, n, { mode: m }, function(e) { - if (e) throw e; + assert.ifError(e); ncallbacks++; // windows permissions aren't unix if (!common.isWindows) { - var st = fs.statSync(filename4); - assert.equal(st.mode & 0o700, m); + const st = fs.statSync(filename4); + assert.strictEqual(st.mode & 0o700, m); } fs.readFile(filename4, function(e, buffer) { - if (e) throw e; + assert.ifError(e); ncallbacks++; - assert.equal(Buffer.byteLength('' + n) + currentFileData.length, - buffer.length); + assert.strictEqual(Buffer.byteLength('' + n) + currentFileData.length, + buffer.length); }); }); // test that appendFile accepts file descriptors -var filename5 = join(common.tmpDir, 'append5.txt'); +const filename5 = join(common.tmpDir, 'append5.txt'); fs.writeFileSync(filename5, currentFileData); fs.open(filename5, 'a+', function(e, fd) { - if (e) throw e; + assert.ifError(e); ncallbacks++; fs.appendFile(fd, s, function(e) { - if (e) throw e; + assert.ifError(e); ncallbacks++; fs.close(fd, function(e) { - if (e) throw e; + assert.ifError(e); ncallbacks++; fs.readFile(filename5, function(e, buffer) { - if (e) throw e; + assert.ifError(e); ncallbacks++; - assert.equal(Buffer.byteLength(s) + currentFileData.length, - buffer.length); + assert.strictEqual(Buffer.byteLength(s) + currentFileData.length, + buffer.length); }); }); }); }); process.on('exit', function() { - assert.equal(12, ncallbacks); + assert.strictEqual(12, ncallbacks); fs.unlinkSync(filename); fs.unlinkSync(filename2); From 821518d4e4ac309b1ba714be64303595e3920a9d Mon Sep 17 00:00:00 2001 From: Adrian Estrada Date: Thu, 1 Dec 2016 10:54:34 -0600 Subject: [PATCH 085/313] test: refactor test-tls-friendly-error-message.js Replaces var with const and adds common.mustCall(). PR-URL: https://github.com/nodejs/node/pull/9967 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen --- .../test-tls-friendly-error-message.js | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/parallel/test-tls-friendly-error-message.js b/test/parallel/test-tls-friendly-error-message.js index c53dd7cbc07205..9ae69f4016e319 100644 --- a/test/parallel/test-tls-friendly-error-message.js +++ b/test/parallel/test-tls-friendly-error-message.js @@ -1,26 +1,26 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const tls = require('tls'); -var fs = require('fs'); +const fs = require('fs'); -var key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'); -var cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'); +const key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'); +const cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'); -tls.createServer({ key: key, cert: cert }, function(conn) { +tls.createServer({ key: key, cert: cert }, common.mustCall(function(conn) { conn.end(); this.close(); -}).listen(0, function() { +})).listen(0, common.mustCall(function() { var options = { port: this.address().port, rejectUnauthorized: true }; tls.connect(options).on('error', common.mustCall(function(err) { - assert.equal(err.code, 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'); - assert.equal(err.message, 'unable to verify the first certificate'); + assert.strictEqual(err.code, 'UNABLE_TO_VERIFY_LEAF_SIGNATURE'); + assert.strictEqual(err.message, 'unable to verify the first certificate'); this.destroy(); })); -}); +})); From 404306fd0ecc792e28d41a30d0e53937f75a9909 Mon Sep 17 00:00:00 2001 From: Konstantin Likhter Date: Thu, 1 Dec 2016 08:52:38 -0800 Subject: [PATCH 086/313] test: refactor test-crypto-padding.js - Replaced var with const and let. - Replaced assert.equal() with assert.strictEqual(). - Added error message checking for assert.throws(). PR-URL: https://github.com/nodejs/node/pull/9971 Reviewed-By: Colin Ihrig Reviewed-By: Prince John Wesley Reviewed-By: Anna Henningsen --- test/parallel/test-crypto-padding.js | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/test/parallel/test-crypto-padding.js b/test/parallel/test-crypto-padding.js index eeb41f278ac6fc..70905a8a9bd1e7 100644 --- a/test/parallel/test-crypto-padding.js +++ b/test/parallel/test-crypto-padding.js @@ -1,12 +1,12 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var crypto = require('crypto'); +const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; @@ -21,7 +21,7 @@ const EVEN_LENGTH_PLAIN = 'Hello node world!AbC09876dDeFgHi'; const KEY_PLAIN = 'S3c.r.e.t.K.e.Y!'; const IV_PLAIN = 'blahFizz2011Buzz'; -var CIPHER_NAME = 'aes-128-cbc'; +const CIPHER_NAME = 'aes-128-cbc'; /* @@ -31,20 +31,20 @@ var CIPHER_NAME = 'aes-128-cbc'; // echo -n 'Hello node world!' | \ // openssl enc -aes-128-cbc -e -K 5333632e722e652e742e4b2e652e5921 \ // -iv 626c616846697a7a3230313142757a7a | xxd -p -c256 -var ODD_LENGTH_ENCRYPTED = +const ODD_LENGTH_ENCRYPTED = '7f57859550d4d2fdb9806da2a750461a9fe77253cd1cbd4b07beee4e070d561f'; // echo -n 'Hello node world!AbC09876dDeFgHi' | \ // openssl enc -aes-128-cbc -e -K 5333632e722e652e742e4b2e652e5921 \ // -iv 626c616846697a7a3230313142757a7a | xxd -p -c256 -var EVEN_LENGTH_ENCRYPTED = +const EVEN_LENGTH_ENCRYPTED = '7f57859550d4d2fdb9806da2a750461ab46e71b3d78ebe2d9684dfc87f7575b988' + '6119866912cb8c7bcaf76c5ebc2378'; // echo -n 'Hello node world!AbC09876dDeFgHi' | \ // openssl enc -aes-128-cbc -e -K 5333632e722e652e742e4b2e652e5921 \ // -iv 626c616846697a7a3230313142757a7a -nopad | xxd -p -c256 -var EVEN_LENGTH_ENCRYPTED_NOPAD = +const EVEN_LENGTH_ENCRYPTED_NOPAD = '7f57859550d4d2fdb9806da2a750461ab46e' + '71b3d78ebe2d9684dfc87f7575b9'; @@ -54,17 +54,17 @@ var EVEN_LENGTH_ENCRYPTED_NOPAD = */ function enc(plain, pad) { - var encrypt = crypto.createCipheriv(CIPHER_NAME, KEY_PLAIN, IV_PLAIN); + const encrypt = crypto.createCipheriv(CIPHER_NAME, KEY_PLAIN, IV_PLAIN); encrypt.setAutoPadding(pad); - var hex = encrypt.update(plain, 'ascii', 'hex'); + let hex = encrypt.update(plain, 'ascii', 'hex'); hex += encrypt.final('hex'); return hex; } function dec(encd, pad) { - var decrypt = crypto.createDecipheriv(CIPHER_NAME, KEY_PLAIN, IV_PLAIN); + const decrypt = crypto.createDecipheriv(CIPHER_NAME, KEY_PLAIN, IV_PLAIN); decrypt.setAutoPadding(pad); - var plain = decrypt.update(encd, 'hex'); + let plain = decrypt.update(encd, 'hex'); plain += decrypt.final('latin1'); return plain; } @@ -104,9 +104,7 @@ assert.doesNotThrow(function() { assert.throws(function() { // must have at least 1 byte of padding (PKCS): - assert.strictEqual( - dec(EVEN_LENGTH_ENCRYPTED_NOPAD, true), EVEN_LENGTH_PLAIN - ); + assert.strictEqual(dec(EVEN_LENGTH_ENCRYPTED_NOPAD, true), EVEN_LENGTH_PLAIN); }, /bad decrypt/); assert.doesNotThrow(function() { From 7277c376c201eb8f6c387feab08d23ebfee6b7c8 Mon Sep 17 00:00:00 2001 From: Richard Karmazin Date: Thu, 1 Dec 2016 10:56:07 -0600 Subject: [PATCH 087/313] test: use strictEqual in test-cli-eval-event.js PR-URL: https://github.com/nodejs/node/pull/9964 Reviewed-By: Colin Ihrig --- test/parallel/test-cli-eval-event.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-cli-eval-event.js b/test/parallel/test-cli-eval-event.js index b19bdd38680f79..df356e50d37b66 100644 --- a/test/parallel/test-cli-eval-event.js +++ b/test/parallel/test-cli-eval-event.js @@ -10,6 +10,6 @@ const child = spawn(process.execPath, ['-e', ` `]); child.once('exit', common.mustCall(function(exitCode, signalCode) { - assert.equal(exitCode, 0); - assert.equal(signalCode, null); + assert.strictEqual(exitCode, 0); + assert.strictEqual(signalCode, null); })); From d698f9d0aca8dd5809a1303cdb3ed8cae2664dee Mon Sep 17 00:00:00 2001 From: Hutson Betts Date: Thu, 1 Dec 2016 10:27:39 -0600 Subject: [PATCH 088/313] test: refactor test-tls-server-verify Refactored `test-tls-server-verify.js` to replace uses of `var` with `const` and `let`. Also replaced uses of `assert.equal` with `assert.strictEqual`. PR-URL: https://github.com/nodejs/node/pull/10076 Reviewed-By: Michael Dawson --- test/parallel/test-tls-server-verify.js | 60 ++++++++++++------------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/test/parallel/test-tls-server-verify.js b/test/parallel/test-tls-server-verify.js index a51aef51564690..04c1547384c61e 100644 --- a/test/parallel/test-tls-server-verify.js +++ b/test/parallel/test-tls-server-verify.js @@ -1,5 +1,5 @@ 'use strict'; -var common = require('../common'); +const common = require('../common'); if (!common.opensslCli) { common.skip('node compiled without OpenSSL CLI.'); @@ -14,7 +14,7 @@ if (!common.opensslCli) { // - accepted and "unauthorized", or // - accepted and "authorized". -var testCases = +const testCases = [{ title: 'Do not request certs. Everyone is unauthorized.', requestCert: false, rejectUnauthorized: false, @@ -102,14 +102,14 @@ if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const tls = require('tls'); const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION = require('crypto').constants.SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION; -var assert = require('assert'); -var fs = require('fs'); -var spawn = require('child_process').spawn; +const assert = require('assert'); +const fs = require('fs'); +const spawn = require('child_process').spawn; function filenamePEM(n) { @@ -122,8 +122,8 @@ function loadPEM(n) { } -var serverKey = loadPEM('agent2-key'); -var serverCert = loadPEM('agent2-cert'); +const serverKey = loadPEM('agent2-key'); +const serverCert = loadPEM('agent2-cert'); function runClient(prefix, port, options, cb) { @@ -133,7 +133,7 @@ function runClient(prefix, port, options, cb) { // - Certificate, but not signed by CA. // - Certificate signed by CA. - var args = ['s_client', '-connect', '127.0.0.1:' + port]; + const args = ['s_client', '-connect', '127.0.0.1:' + port]; // for the performance issue in s_client on Windows if (common.isWindows) @@ -184,13 +184,13 @@ function runClient(prefix, port, options, cb) { } // To test use: openssl s_client -connect localhost:8000 - var client = spawn(common.opensslCli, args); + const client = spawn(common.opensslCli, args); - var out = ''; + let out = ''; - var rejected = true; - var authed = false; - var goodbye = false; + let rejected = true; + let authed = false; + let goodbye = false; client.stdout.setEncoding('utf8'); client.stdout.on('data', function(d) { @@ -219,12 +219,12 @@ function runClient(prefix, port, options, cb) { //assert.equal(0, code, prefix + options.name + // ": s_client exited with error code " + code); if (options.shouldReject) { - assert.equal(true, rejected, prefix + options.name + + assert.strictEqual(true, rejected, prefix + options.name + ' NOT rejected, but should have been'); } else { - assert.equal(false, rejected, prefix + options.name + + assert.strictEqual(false, rejected, prefix + options.name + ' rejected, but should NOT have been'); - assert.equal(options.shouldAuth, authed, prefix + + assert.strictEqual(options.shouldAuth, authed, prefix + options.name + ' authed is ' + authed + ' but should have been ' + options.shouldAuth); } @@ -235,19 +235,19 @@ function runClient(prefix, port, options, cb) { // Run the tests -var successfulTests = 0; +let successfulTests = 0; function runTest(port, testIndex) { - var prefix = testIndex + ' '; - var tcase = testCases[testIndex]; + const prefix = testIndex + ' '; + const tcase = testCases[testIndex]; if (!tcase) return; console.error(prefix + "Running '%s'", tcase.title); - var cas = tcase.CAs.map(loadPEM); + const cas = tcase.CAs.map(loadPEM); - var crl = tcase.crl ? loadPEM(tcase.crl) : null; + const crl = tcase.crl ? loadPEM(tcase.crl) : null; - var serverOptions = { + const serverOptions = { key: serverKey, cert: serverCert, ca: cas, @@ -265,8 +265,8 @@ function runTest(port, testIndex) { SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION; } - var renegotiated = false; - var server = tls.Server(serverOptions, function handleConnection(c) { + let renegotiated = false; + const server = tls.Server(serverOptions, function handleConnection(c) { c.on('error', function(e) { // child.kill() leads ECONNRESET errro in the TLS connection of // openssl s_client via spawn(). A Test result is already @@ -301,7 +301,7 @@ function runTest(port, testIndex) { }); function runNextClient(clientIndex) { - var options = tcase.clients[clientIndex]; + const options = tcase.clients[clientIndex]; if (options) { runClient(prefix + clientIndex + ' ', port, options, function() { runNextClient(clientIndex + 1); @@ -321,8 +321,8 @@ function runTest(port, testIndex) { if (tcase.renegotiate) { runNextClient(0); } else { - var clientsCompleted = 0; - for (var i = 0; i < tcase.clients.length; i++) { + let clientsCompleted = 0; + for (let i = 0; i < tcase.clients.length; i++) { runClient(prefix + i + ' ', port, tcase.clients[i], function() { clientsCompleted++; if (clientsCompleted === tcase.clients.length) { @@ -338,11 +338,11 @@ function runTest(port, testIndex) { } -var nextTest = 0; +let nextTest = 0; runTest(0, nextTest++); runTest(0, nextTest++); process.on('exit', function() { - assert.equal(successfulTests, testCases.length); + assert.strictEqual(successfulTests, testCases.length); }); From 9b7d7487ef4147bbf08f98af37fb3501a2eb047f Mon Sep 17 00:00:00 2001 From: davidmarkclements Date: Thu, 1 Dec 2016 14:23:55 -0600 Subject: [PATCH 089/313] test: refactor test-https-truncate Changes assert.equal to assert.strictEqual to ensure specificity. Changes var declarations to const/let where appropriate. PR-URL: https://github.com/nodejs/node/pull/10074 Reviewed-By: Colin Ihrig Reviewed-By: Santiago Gimeno --- test/parallel/test-https-truncate.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/parallel/test-https-truncate.js b/test/parallel/test-https-truncate.js index 26f133b4a5b48a..4101a8c974e736 100644 --- a/test/parallel/test-https-truncate.js +++ b/test/parallel/test-https-truncate.js @@ -1,34 +1,34 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var https = require('https'); +const https = require('https'); -var fs = require('fs'); +const fs = require('fs'); -var key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'); -var cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'); +const key = fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'); +const cert = fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'); // number of bytes discovered empirically to trigger the bug -var data = Buffer.allocUnsafe(1024 * 32 + 1); +const data = Buffer.allocUnsafe(1024 * 32 + 1); httpsTest(); function httpsTest() { - var sopt = { key: key, cert: cert }; + const sopt = { key: key, cert: cert }; - var server = https.createServer(sopt, function(req, res) { + const server = https.createServer(sopt, function(req, res) { res.setHeader('content-length', data.length); res.end(data); server.close(); }); server.listen(0, function() { - var opts = { port: this.address().port, rejectUnauthorized: false }; + const opts = { port: this.address().port, rejectUnauthorized: false }; https.get(opts).on('response', function(res) { test(res); }); @@ -38,14 +38,14 @@ function httpsTest() { function test(res) { res.on('end', function() { - assert.equal(res._readableState.length, 0); - assert.equal(bytes, data.length); + assert.strictEqual(res._readableState.length, 0); + assert.strictEqual(bytes, data.length); console.log('ok'); }); // Pause and then resume on each chunk, to ensure that there will be // a lone byte hanging out at the very end. - var bytes = 0; + let bytes = 0; res.on('data', function(chunk) { bytes += chunk.length; this.pause(); From 1c3227fd8cd5bf1f5e239b0edea8c18fcdb0ff7e Mon Sep 17 00:00:00 2001 From: "Kent.Fan" Date: Thu, 1 Dec 2016 14:08:44 -0600 Subject: [PATCH 090/313] test: refactor test-net-dns-custom-lookup Use asssert.strictEqual to disallow coersion. PR-URL: https://github.com/nodejs/node/pull/10071 Reviewed-By: Santiago Gimeno Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/parallel/test-net-dns-custom-lookup.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-net-dns-custom-lookup.js b/test/parallel/test-net-dns-custom-lookup.js index 8d91bcba6687ea..07eb71c5ed5811 100644 --- a/test/parallel/test-net-dns-custom-lookup.js +++ b/test/parallel/test-net-dns-custom-lookup.js @@ -18,9 +18,9 @@ function check(addressType, cb) { family: addressType, lookup: lookup }).on('lookup', common.mustCall(function(err, ip, type) { - assert.equal(err, null); - assert.equal(address, ip); - assert.equal(type, addressType); + assert.strictEqual(err, null); + assert.strictEqual(address, ip); + assert.strictEqual(type, addressType); })); })); From 5d28864d7ff0d2a9184b834e385cc6e4e53c6ba9 Mon Sep 17 00:00:00 2001 From: Chris Bystrek Date: Thu, 1 Dec 2016 13:18:50 -0600 Subject: [PATCH 091/313] test: refactor test-tls-destroy-whilst-write Update var to let/const and replace arbitrary timeout. PR-URL: https://github.com/nodejs/node/pull/10064 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Gibson Fahnestock --- test/parallel/test-tls-destroy-whilst-write.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-tls-destroy-whilst-write.js b/test/parallel/test-tls-destroy-whilst-write.js index 4f6ede968be408..b4f9766d998630 100644 --- a/test/parallel/test-tls-destroy-whilst-write.js +++ b/test/parallel/test-tls-destroy-whilst-write.js @@ -1,26 +1,26 @@ 'use strict'; -var common = require('../common'); +const common = require('../common'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); -var stream = require('stream'); +const tls = require('tls'); +const stream = require('stream'); -var delay = new stream.Duplex({ +const delay = new stream.Duplex({ read: function read() { }, write: function write(data, enc, cb) { console.log('pending'); - setTimeout(function() { + setImmediate(function() { console.log('done'); cb(); - }, 200); + }); } }); -var secure = tls.connect({ +const secure = tls.connect({ socket: delay }); setImmediate(function() { From 7c4b59f9b123c2835aa0372fa23c5baad4b5ac4e Mon Sep 17 00:00:00 2001 From: Jay Brownlee Date: Thu, 1 Dec 2016 10:06:21 -0600 Subject: [PATCH 092/313] test: refactor test-vm-syntax-error-stderr.js use common.fail instead of assert(false) change var to let or const as appropriate PR-URL: https://github.com/nodejs/node/pull/9900 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-vm-syntax-error-stderr.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-vm-syntax-error-stderr.js b/test/parallel/test-vm-syntax-error-stderr.js index 7c3c5ff1351da2..43ed8d882804ca 100644 --- a/test/parallel/test-vm-syntax-error-stderr.js +++ b/test/parallel/test-vm-syntax-error-stderr.js @@ -1,22 +1,22 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var path = require('path'); -var child_process = require('child_process'); +const common = require('../common'); +const assert = require('assert'); +const path = require('path'); +const child_process = require('child_process'); -var wrong_script = path.join(common.fixturesDir, 'cert.pem'); +const wrong_script = path.join(common.fixturesDir, 'cert.pem'); -var p = child_process.spawn(process.execPath, [ +const p = child_process.spawn(process.execPath, [ '-e', 'require(process.argv[1]);', wrong_script ]); p.stdout.on('data', function(data) { - assert(false, 'Unexpected stdout data: ' + data); + common.fail('Unexpected stdout data: ' + data); }); -var output = ''; +let output = ''; p.stderr.on('data', function(data) { output += data; From 7a228fe4aeace36fcaa2b16ad3ab32cab1463839 Mon Sep 17 00:00:00 2001 From: Daniel Pittman Date: Thu, 1 Dec 2016 10:18:45 -0600 Subject: [PATCH 093/313] test: Changed assert.equal to assert.strictEqual Updated test-cluster-send-deadlock.js to change assert.equal to assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/9902 Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-cluster-send-deadlock.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-cluster-send-deadlock.js b/test/parallel/test-cluster-send-deadlock.js index 90b8c91695359b..fa3e1138248221 100644 --- a/test/parallel/test-cluster-send-deadlock.js +++ b/test/parallel/test-cluster-send-deadlock.js @@ -10,7 +10,7 @@ var net = require('net'); if (cluster.isMaster) { var worker = cluster.fork(); worker.on('exit', function(code, signal) { - assert.equal(code, 0, 'Worker exited with an error code'); + assert.strictEqual(code, 0, 'Worker exited with an error code'); assert(!signal, 'Worker exited by a signal'); server.close(); }); From f4b6b9faa700251756e8f644f6273dc17af2ed5b Mon Sep 17 00:00:00 2001 From: Outsider Date: Thu, 1 Dec 2016 13:08:04 -0600 Subject: [PATCH 094/313] test: refactor test-http-dns-error Replace var with const and use strictEqual(). PR-URL: https://github.com/nodejs/node/pull/10062 Reviewed-By: Evan Lucas Reviewed-By: Colin Ihrig Reviewed-By: Santiago Gimeno --- test/parallel/test-http-dns-error.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-http-dns-error.js b/test/parallel/test-http-dns-error.js index f1f144a60a24c0..5e15ab9a3fa0da 100644 --- a/test/parallel/test-http-dns-error.js +++ b/test/parallel/test-http-dns-error.js @@ -1,8 +1,8 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); -var http = require('http'); +const http = require('http'); if (common.hasCrypto) { var https = require('https'); @@ -10,7 +10,7 @@ if (common.hasCrypto) { common.skip('missing crypto'); } -var host = '*'.repeat(256); +const host = '*'.repeat(256); function do_not_call() { throw new Error('This function should not have been called.'); @@ -20,15 +20,15 @@ function test(mod) { // Bad host name should not throw an uncatchable exception. // Ensure that there is time to attach an error listener. - var req1 = mod.get({host: host, port: 42}, do_not_call); + const req1 = mod.get({host: host, port: 42}, do_not_call); req1.on('error', common.mustCall(function(err) { - assert.equal(err.code, 'ENOTFOUND'); + assert.strictEqual(err.code, 'ENOTFOUND'); })); // http.get() called req1.end() for us - var req2 = mod.request({method: 'GET', host: host, port: 42}, do_not_call); + const req2 = mod.request({method: 'GET', host: host, port: 42}, do_not_call); req2.on('error', common.mustCall(function(err) { - assert.equal(err.code, 'ENOTFOUND'); + assert.strictEqual(err.code, 'ENOTFOUND'); })); req2.end(); } From e9d4665b2938105598e81234179bd321514c6aa5 Mon Sep 17 00:00:00 2001 From: Sarah Meyer Date: Thu, 1 Dec 2016 10:16:53 -0600 Subject: [PATCH 095/313] test: use const instead of var in test-require-json.js PR-URL: https://github.com/nodejs/node/pull/9904 Reviewed-By: Colin Ihrig Reviewed-By: Myles Borins Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-require-json.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-require-json.js b/test/parallel/test-require-json.js index 75cdb98855e6ee..f2c74dc57d743d 100644 --- a/test/parallel/test-require-json.js +++ b/test/parallel/test-require-json.js @@ -1,12 +1,12 @@ 'use strict'; -var common = require('../common'); -var path = require('path'); -var assert = require('assert'); +const common = require('../common'); +const path = require('path'); +const assert = require('assert'); try { require(path.join(common.fixturesDir, 'invalid.json')); } catch (err) { - var re = /test[/\\]fixtures[/\\]invalid.json: Unexpected string/; - var i = err.message.match(re); + const re = /test[/\\]fixtures[/\\]invalid.json: Unexpected string/; + const i = err.message.match(re); assert.notStrictEqual(null, i, 'require() json error should include path'); } From cf9f6f8dbf31a28de52fea58feb499ec0813be32 Mon Sep 17 00:00:00 2001 From: anoff Date: Thu, 1 Dec 2016 10:05:40 -0600 Subject: [PATCH 096/313] test: changed vars to const in test-net-better-error-messages-listen-path.js * `var` to `const` * use `assert.strictEqual` PR-URL: https://github.com/nodejs/node/pull/9905 Reviewed-By: Colin Ihrig Reviewed-By: Prince John Wesley Reviewed-By: James M Snell --- .../test-net-better-error-messages-listen-path.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-net-better-error-messages-listen-path.js b/test/parallel/test-net-better-error-messages-listen-path.js index 41d22c3fb9a4b5..50ed80a5e3cd1e 100644 --- a/test/parallel/test-net-better-error-messages-listen-path.js +++ b/test/parallel/test-net-better-error-messages-listen-path.js @@ -1,10 +1,10 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var net = require('net'); -var fp = '/blah/fadfa'; -var server = net.createServer(common.fail); +const common = require('../common'); +const assert = require('assert'); +const net = require('net'); +const fp = '/blah/fadfa'; +const server = net.createServer(common.fail); server.listen(fp, common.fail); server.on('error', common.mustCall(function(e) { - assert.equal(e.address, fp); + assert.strictEqual(e.address, fp); })); From 2127798eaa678bd9d87a068bfa71195a9c2abdd3 Mon Sep 17 00:00:00 2001 From: Sean Villars Date: Thu, 1 Dec 2016 10:15:40 -0600 Subject: [PATCH 097/313] test: var to const, assert.equal to assert.strictEqual in net * var -> const * assert.equal -> assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/9907 Reviewed-By: Colin Ihrig Reviewed-By: Prince John Wesley Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- ...test-net-better-error-messages-port-hostname.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-net-better-error-messages-port-hostname.js b/test/parallel/test-net-better-error-messages-port-hostname.js index 23089baf448a39..b08c35f3e63ea5 100644 --- a/test/parallel/test-net-better-error-messages-port-hostname.js +++ b/test/parallel/test-net-better-error-messages-port-hostname.js @@ -1,14 +1,14 @@ 'use strict'; -var common = require('../common'); -var net = require('net'); -var assert = require('assert'); +const common = require('../common'); +const net = require('net'); +const assert = require('assert'); -var c = net.createConnection(common.PORT, '***'); +const c = net.createConnection(common.PORT, '***'); c.on('connect', common.fail); c.on('error', common.mustCall(function(e) { - assert.equal(e.code, 'ENOTFOUND'); - assert.equal(e.port, common.PORT); - assert.equal(e.hostname, '***'); + assert.strictEqual(e.code, 'ENOTFOUND'); + assert.strictEqual(e.port, common.PORT); + assert.strictEqual(e.hostname, '***'); })); From f78b81750d95d5e75b0e006a2642e9472f1bd0c8 Mon Sep 17 00:00:00 2001 From: Cesar Hernandez Date: Thu, 1 Dec 2016 10:21:35 -0600 Subject: [PATCH 098/313] test: refactor test-repl-mode.js * var -> const/let * assert.equal() -> assert.strictEqual() PR-URL: https://github.com/nodejs/node/pull/10061 Reviewed-By: Evan Lucas Reviewed-By: Colin Ihrig Reviewed-By: Jeremiah Senkpiel --- test/parallel/test-repl-mode.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/test/parallel/test-repl-mode.js b/test/parallel/test-repl-mode.js index 08b296c2c341a4..00e9cd577ece90 100644 --- a/test/parallel/test-repl-mode.js +++ b/test/parallel/test-repl-mode.js @@ -1,12 +1,12 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var Stream = require('stream'); -var repl = require('repl'); +const common = require('../common'); +const assert = require('assert'); +const Stream = require('stream'); +const repl = require('repl'); common.globalCheck = false; -var tests = [ +const tests = [ testSloppyMode, testStrictMode, testAutoMode @@ -17,22 +17,22 @@ tests.forEach(function(test) { }); function testSloppyMode() { - var cli = initRepl(repl.REPL_MODE_SLOPPY); + const cli = initRepl(repl.REPL_MODE_SLOPPY); cli.input.emit('data', ` x = 3 `.trim() + '\n'); - assert.equal(cli.output.accumulator.join(''), '> 3\n> '); + assert.strictEqual(cli.output.accumulator.join(''), '> 3\n> '); cli.output.accumulator.length = 0; cli.input.emit('data', ` let y = 3 `.trim() + '\n'); - assert.equal(cli.output.accumulator.join(''), 'undefined\n> '); + assert.strictEqual(cli.output.accumulator.join(''), 'undefined\n> '); } function testStrictMode() { - var cli = initRepl(repl.REPL_MODE_STRICT); + const cli = initRepl(repl.REPL_MODE_STRICT); cli.input.emit('data', ` x = 3 @@ -44,30 +44,30 @@ function testStrictMode() { cli.input.emit('data', ` let y = 3 `.trim() + '\n'); - assert.equal(cli.output.accumulator.join(''), 'undefined\n> '); + assert.strictEqual(cli.output.accumulator.join(''), 'undefined\n> '); } function testAutoMode() { - var cli = initRepl(repl.REPL_MODE_MAGIC); + const cli = initRepl(repl.REPL_MODE_MAGIC); cli.input.emit('data', ` x = 3 `.trim() + '\n'); - assert.equal(cli.output.accumulator.join(''), '> 3\n> '); + assert.strictEqual(cli.output.accumulator.join(''), '> 3\n> '); cli.output.accumulator.length = 0; cli.input.emit('data', ` let y = 3 `.trim() + '\n'); - assert.equal(cli.output.accumulator.join(''), 'undefined\n> '); + assert.strictEqual(cli.output.accumulator.join(''), 'undefined\n> '); } function initRepl(mode) { - var input = new Stream(); + const input = new Stream(); input.write = input.pause = input.resume = function() {}; input.readable = true; - var output = new Stream(); + const output = new Stream(); output.write = output.pause = output.resume = function(buf) { output.accumulator.push(buf); }; From 76dda9ca37ff6247e8e474b84359751698222dd8 Mon Sep 17 00:00:00 2001 From: k3kathy Date: Thu, 1 Dec 2016 11:22:07 -0600 Subject: [PATCH 099/313] test: refactor test-child-process-constructor Change all assert.equal() to use assert.strictEqual(). PR-URL: https://github.com/nodejs/node/pull/10060 Reviewed-By: Colin Ihrig Reviewed-By: Evan Lucas --- test/parallel/test-child-process-constructor.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-child-process-constructor.js b/test/parallel/test-child-process-constructor.js index 6980810485c964..0abf1289f0737d 100644 --- a/test/parallel/test-child-process-constructor.js +++ b/test/parallel/test-child-process-constructor.js @@ -4,7 +4,7 @@ require('../common'); var assert = require('assert'); var child_process = require('child_process'); var ChildProcess = child_process.ChildProcess; -assert.equal(typeof ChildProcess, 'function'); +assert.strictEqual(typeof ChildProcess, 'function'); // test that we can call spawn var child = new ChildProcess(); @@ -15,11 +15,11 @@ child.spawn({ stdio: 'pipe' }); -assert.equal(child.hasOwnProperty('pid'), true); +assert.strictEqual(child.hasOwnProperty('pid'), true); // try killing with invalid signal assert.throws(function() { child.kill('foo'); }, /Unknown signal: foo/); -assert.equal(child.kill(), true); +assert.strictEqual(child.kill(), true); From b343a584e69be1ed37d0a15902b9835ba3e69fcb Mon Sep 17 00:00:00 2001 From: Exlipse7 Date: Thu, 1 Dec 2016 18:20:35 +0000 Subject: [PATCH 100/313] test: refactor test-cli-syntax Switch assert.equal to assert.strictEqual. PR-URL: https://github.com/nodejs/node/pull/10057 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig --- test/parallel/test-cli-syntax.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-cli-syntax.js b/test/parallel/test-cli-syntax.js index 7718c42f31fa25..839e50d7d94b40 100644 --- a/test/parallel/test-cli-syntax.js +++ b/test/parallel/test-cli-syntax.js @@ -29,9 +29,9 @@ var syntaxArgs = [ var c = spawnSync(node, _args, {encoding: 'utf8'}); // no output should be produced - assert.equal(c.stdout, '', 'stdout produced'); - assert.equal(c.stderr, '', 'stderr produced'); - assert.equal(c.status, 0, 'code == ' + c.status); + assert.strictEqual(c.stdout, '', 'stdout produced'); + assert.strictEqual(c.stderr, '', 'stderr produced'); + assert.strictEqual(c.status, 0, 'code == ' + c.status); }); }); @@ -50,13 +50,13 @@ var syntaxArgs = [ var c = spawnSync(node, _args, {encoding: 'utf8'}); // no stdout should be produced - assert.equal(c.stdout, '', 'stdout produced'); + assert.strictEqual(c.stdout, '', 'stdout produced'); // stderr should have a syntax error message var match = c.stderr.match(/^SyntaxError: Unexpected identifier$/m); assert(match, 'stderr incorrect'); - assert.equal(c.status, 1, 'code == ' + c.status); + assert.strictEqual(c.status, 1, 'code == ' + c.status); }); }); @@ -73,12 +73,12 @@ var syntaxArgs = [ var c = spawnSync(node, _args, {encoding: 'utf8'}); // no stdout should be produced - assert.equal(c.stdout, '', 'stdout produced'); + assert.strictEqual(c.stdout, '', 'stdout produced'); // stderr should have a module not found error message var match = c.stderr.match(/^Error: Cannot find module/m); assert(match, 'stderr incorrect'); - assert.equal(c.status, 1, 'code == ' + c.status); + assert.strictEqual(c.status, 1, 'code == ' + c.status); }); }); From 6fc75ba498897fd3b296dae46a3bc6237db87e4a Mon Sep 17 00:00:00 2001 From: Johnny Reading Date: Thu, 1 Dec 2016 10:11:46 -0600 Subject: [PATCH 101/313] test: refactor test-domain Use assert.strictEqual() instead of assert.equal(). PR-URL: https://github.com/nodejs/node/pull/9890 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-domain.js | 67 ++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/test/parallel/test-domain.js b/test/parallel/test-domain.js index 19cd964a28923a..69521108f6e47b 100644 --- a/test/parallel/test-domain.js +++ b/test/parallel/test-domain.js @@ -31,67 +31,67 @@ d.on('error', function(er) { switch (er_message) { case 'emitted': - assert.equal(er.domain, d); - assert.equal(er.domainEmitter, e); - assert.equal(er.domainThrown, false); + assert.strictEqual(er.domain, d); + assert.strictEqual(er.domainEmitter, e); + assert.strictEqual(er.domainThrown, false); break; case 'bound': assert.ok(!er.domainEmitter); - assert.equal(er.domain, d); - assert.equal(er.domainBound, fn); - assert.equal(er.domainThrown, false); + assert.strictEqual(er.domain, d); + assert.strictEqual(er.domainBound, fn); + assert.strictEqual(er.domainThrown, false); break; case 'thrown': assert.ok(!er.domainEmitter); - assert.equal(er.domain, d); - assert.equal(er.domainThrown, true); + assert.strictEqual(er.domain, d); + assert.strictEqual(er.domainThrown, true); break; case "ENOENT: no such file or directory, open 'this file does not exist'": - assert.equal(er.domain, d); - assert.equal(er.domainThrown, false); - assert.equal(typeof er.domainBound, 'function'); + assert.strictEqual(er.domain, d); + assert.strictEqual(er.domainThrown, false); + assert.strictEqual(typeof er.domainBound, 'function'); assert.ok(!er.domainEmitter); - assert.equal(er.code, 'ENOENT'); - assert.equal(er_path, 'this file does not exist'); - assert.equal(typeof er.errno, 'number'); + assert.strictEqual(er.code, 'ENOENT'); + assert.strictEqual(er_path, 'this file does not exist'); + assert.strictEqual(typeof er.errno, 'number'); break; case "ENOENT: no such file or directory, open 'stream for nonexistent file'": - assert.equal(typeof er.errno, 'number'); - assert.equal(er.code, 'ENOENT'); - assert.equal(er_path, 'stream for nonexistent file'); - assert.equal(er.domain, d); - assert.equal(er.domainEmitter, fst); + assert.strictEqual(typeof er.errno, 'number'); + assert.strictEqual(er.code, 'ENOENT'); + assert.strictEqual(er_path, 'stream for nonexistent file'); + assert.strictEqual(er.domain, d); + assert.strictEqual(er.domainEmitter, fst); assert.ok(!er.domainBound); - assert.equal(er.domainThrown, false); + assert.strictEqual(er.domainThrown, false); break; case 'implicit': - assert.equal(er.domainEmitter, implicit); - assert.equal(er.domain, d); - assert.equal(er.domainThrown, false); + assert.strictEqual(er.domainEmitter, implicit); + assert.strictEqual(er.domain, d); + assert.strictEqual(er.domainThrown, false); assert.ok(!er.domainBound); break; case 'implicit timer': - assert.equal(er.domain, d); - assert.equal(er.domainThrown, true); + assert.strictEqual(er.domain, d); + assert.strictEqual(er.domainThrown, true); assert.ok(!er.domainEmitter); assert.ok(!er.domainBound); break; case 'Cannot read property \'isDirectory\' of undefined': - assert.equal(er.domain, d); + assert.strictEqual(er.domain, d); assert.ok(!er.domainEmitter); assert.ok(!er.domainBound); break; case 'nextTick execution loop': - assert.equal(er.domain, d); + assert.strictEqual(er.domain, d); assert.ok(!er.domainEmitter); assert.ok(!er.domainBound); break; @@ -107,7 +107,8 @@ d.on('error', function(er) { process.on('exit', function() { console.error('exit', caught, expectCaught); - assert.equal(caught, expectCaught, 'caught the expected number of errors'); + assert.strictEqual(caught, expectCaught, + 'caught the expected number of errors'); console.log('ok'); }); @@ -172,7 +173,7 @@ expectCaught++; // intercepted should never pass first argument to callback function fn2(data) { - assert.equal(data, 'data', 'should not be null err argument'); + assert.strictEqual(data, 'data', 'should not be null err argument'); } bound = d.intercept(fn2); @@ -181,8 +182,8 @@ bound(null, 'data'); // intercepted should never pass first argument to callback // even if arguments length is more than 2. function fn3(data, data2) { - assert.equal(data, 'data', 'should not be null err argument'); - assert.equal(data2, 'data2', 'should not be data argument'); + assert.strictEqual(data, 'data', 'should not be null err argument'); + assert.strictEqual(data2, 'data2', 'should not be data argument'); } bound = d.intercept(fn3); @@ -225,14 +226,14 @@ expectCaught++; var result = d.run(function() { return 'return value'; }); -assert.equal(result, 'return value'); +assert.strictEqual(result, 'return value'); // check if the executed function take in count the applied parameters result = d.run(function(a, b) { return a + ' ' + b; }, 'return', 'value'); -assert.equal(result, 'return value'); +assert.strictEqual(result, 'return value'); var fst = fs.createReadStream('stream for nonexistent file'); From 81def1857d415e668a1d851bdec8b2e607158157 Mon Sep 17 00:00:00 2001 From: Konstantin Likhter Date: Thu, 1 Dec 2016 08:05:59 -0800 Subject: [PATCH 102/313] test: refactor dgram-send-multi-buffer-copy assert.equal() -> assert.strictEqual() PR-URL: https://github.com/nodejs/node/pull/9909 Reviewed-By: Colin Ihrig --- test/parallel/test-dgram-send-multi-buffer-copy.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-dgram-send-multi-buffer-copy.js b/test/parallel/test-dgram-send-multi-buffer-copy.js index 0b7f003335b545..2ee87494b02836 100644 --- a/test/parallel/test-dgram-send-multi-buffer-copy.js +++ b/test/parallel/test-dgram-send-multi-buffer-copy.js @@ -7,7 +7,7 @@ const dgram = require('dgram'); const client = dgram.createSocket('udp4'); const onMessage = common.mustCall(function(err, bytes) { - assert.equal(bytes, buf1.length + buf2.length); + assert.strictEqual(bytes, buf1.length + buf2.length); }); const buf1 = Buffer.alloc(256, 'x'); From 5ba08d94735a01057a03a2c7eb405d8ec01468aa Mon Sep 17 00:00:00 2001 From: Josh Mays Date: Thu, 1 Dec 2016 10:09:05 -0600 Subject: [PATCH 103/313] test: refactor test-crypto-certificate assert.equal() -> assert.strictEqual() PR-URL: https://github.com/nodejs/node/pull/9911 Reviewed-By: Prince John Wesley Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen --- test/parallel/test-crypto-certificate.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-crypto-certificate.js b/test/parallel/test-crypto-certificate.js index 66a5da04073825..1dfb2c73b0eca5 100644 --- a/test/parallel/test-crypto-certificate.js +++ b/test/parallel/test-crypto-certificate.js @@ -19,20 +19,20 @@ var spkacPem = fs.readFileSync(common.fixturesDir + '/spkac.pem'); var certificate = new crypto.Certificate(); -assert.equal(certificate.verifySpkac(spkacValid), true); -assert.equal(certificate.verifySpkac(spkacFail), false); +assert.strictEqual(certificate.verifySpkac(spkacValid), true); +assert.strictEqual(certificate.verifySpkac(spkacFail), false); -assert.equal( +assert.strictEqual( stripLineEndings(certificate.exportPublicKey(spkacValid).toString('utf8')), stripLineEndings(spkacPem.toString('utf8')) ); -assert.equal(certificate.exportPublicKey(spkacFail), ''); +assert.strictEqual(certificate.exportPublicKey(spkacFail), ''); -assert.equal( +assert.strictEqual( certificate.exportChallenge(spkacValid).toString('utf8'), 'fb9ab814-6677-42a4-a60c-f905d1a6924d' ); -assert.equal(certificate.exportChallenge(spkacFail), ''); +assert.strictEqual(certificate.exportChallenge(spkacFail), ''); function stripLineEndings(obj) { return obj.replace(/\n/g, ''); From 26d61c3dbc5fa59a662935b17a68ab1f9a5b771a Mon Sep 17 00:00:00 2001 From: Matt Crummey Date: Thu, 1 Dec 2016 15:43:15 +0000 Subject: [PATCH 104/313] test: refactor test-console assert.equal() -> assert.strictEqual() PR-URL: https://github.com/nodejs/node/pull/9873 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-console.js | 36 ++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/test/parallel/test-console.js b/test/parallel/test-console.js index 2c8a498a331b55..ee7170bd9101ac 100644 --- a/test/parallel/test-console.js +++ b/test/parallel/test-console.js @@ -5,8 +5,8 @@ const assert = require('assert'); assert.ok(process.stdout.writable); assert.ok(process.stderr.writable); // Support legacy API -assert.equal('number', typeof process.stdout.fd); -assert.equal('number', typeof process.stderr.fd); +assert.strictEqual('number', typeof process.stdout.fd); +assert.strictEqual('number', typeof process.stderr.fd); assert.doesNotThrow(function() { process.once('warning', common.mustCall((warning) => { @@ -35,28 +35,28 @@ global.process.stderr.write = function(string) { errStrings.push(string); }; -// test console.log() +// test console.log() goes to stdout console.log('foo'); console.log('foo', 'bar'); console.log('%s %s', 'foo', 'bar', 'hop'); console.log({slashes: '\\\\'}); console.log(custom_inspect); -// test console.info() +// test console.info() goes to stdout console.info('foo'); console.info('foo', 'bar'); console.info('%s %s', 'foo', 'bar', 'hop'); console.info({slashes: '\\\\'}); console.info(custom_inspect); -// test console.error() +// test console.error() goes to stderr console.error('foo'); console.error('foo', 'bar'); console.error('%s %s', 'foo', 'bar', 'hop'); console.error({slashes: '\\\\'}); console.error(custom_inspect); -// test console.warn() +// test console.warn() goes to stderr console.warn('foo'); console.warn('foo', 'bar'); console.warn('%s %s', 'foo', 'bar', 'hop'); @@ -102,29 +102,31 @@ const expectedStrings = [ ]; for (const expected of expectedStrings) { - assert.equal(expected + '\n', strings.shift()); // console.log (stdout) - assert.equal(expected + '\n', errStrings.shift()); // console.error (stderr) + assert.strictEqual(expected + '\n', strings.shift()); + assert.strictEqual(expected + '\n', errStrings.shift()); } for (const expected of expectedStrings) { - assert.equal(expected + '\n', strings.shift()); // console.info (stdout) - assert.equal(expected + '\n', errStrings.shift()); // console.warn (stderr) + assert.strictEqual(expected + '\n', strings.shift()); + assert.strictEqual(expected + '\n', errStrings.shift()); } -assert.equal("{ foo: 'bar', inspect: [Function: inspect] }\n", strings.shift()); -assert.equal("{ foo: 'bar', inspect: [Function: inspect] }\n", strings.shift()); +assert.strictEqual("{ foo: 'bar', inspect: [Function: inspect] }\n", + strings.shift()); +assert.strictEqual("{ foo: 'bar', inspect: [Function: inspect] }\n", + strings.shift()); assert.notEqual(-1, strings.shift().indexOf('foo: [Object]')); -assert.equal(-1, strings.shift().indexOf('baz')); +assert.strictEqual(-1, strings.shift().indexOf('baz')); assert.ok(/^label: \d+\.\d{3}ms$/.test(strings.shift().trim())); assert.ok(/^__proto__: \d+\.\d{3}ms$/.test(strings.shift().trim())); assert.ok(/^constructor: \d+\.\d{3}ms$/.test(strings.shift().trim())); assert.ok(/^hasOwnProperty: \d+\.\d{3}ms$/.test(strings.shift().trim())); -assert.equal('Trace: This is a {"formatted":"trace"} 10 foo', - errStrings.shift().split('\n').shift()); +assert.strictEqual('Trace: This is a {"formatted":"trace"} 10 foo', + errStrings.shift().split('\n').shift()); -assert.equal(strings.length, 0); -assert.equal(errStrings.length, 0); +assert.strictEqual(strings.length, 0); +assert.strictEqual(errStrings.length, 0); assert.throws(() => { console.assert(false, 'should throw'); From af5c4a9958928859865a9e24a026705bb62f313b Mon Sep 17 00:00:00 2001 From: Oscar Martinez Date: Thu, 1 Dec 2016 10:01:11 -0600 Subject: [PATCH 105/313] test: refactor test-require-exceptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updated regex for error assertion. PR-URL: https://github.com/nodejs/node/pull/9882 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Michaël Zasso Reviewed-By: James M Snell --- test/parallel/test-require-exceptions.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-require-exceptions.js b/test/parallel/test-require-exceptions.js index 0e61ad2f3fd703..e6b7977b48770b 100644 --- a/test/parallel/test-require-exceptions.js +++ b/test/parallel/test-require-exceptions.js @@ -1,16 +1,16 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); // A module with an error in it should throw assert.throws(function() { require(common.fixturesDir + '/throws_error'); -}); +}, /^Error: blah$/); // Requiring the same module again should throw as well assert.throws(function() { require(common.fixturesDir + '/throws_error'); -}); +}, /^Error: blah$/); // Requiring a module that does not exist should throw an // error with its `code` set to MODULE_NOT_FOUND From 3aa51ecb6f20e6120a56beecce020a1a0293af95 Mon Sep 17 00:00:00 2001 From: michael6 Date: Thu, 1 Dec 2016 11:18:33 -0600 Subject: [PATCH 106/313] test: refactor test-crypto-ecb * var -> const/let * IIFE to blocks PR-URL: https://github.com/nodejs/node/pull/10029 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen --- test/parallel/test-crypto-ecb.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/test/parallel/test-crypto-ecb.js b/test/parallel/test-crypto-ecb.js index d423a386b30a19..655246d0586cbf 100644 --- a/test/parallel/test-crypto-ecb.js +++ b/test/parallel/test-crypto-ecb.js @@ -1,6 +1,6 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); @@ -10,24 +10,25 @@ if (common.hasFipsCrypto) { common.skip('BF-ECB is not FIPS 140-2 compatible'); return; } -var crypto = require('crypto'); +const crypto = require('crypto'); crypto.DEFAULT_ENCODING = 'buffer'; // Testing whether EVP_CipherInit_ex is functioning correctly. // Reference: bug#1997 -(function() { - var encrypt = crypto.createCipheriv('BF-ECB', 'SomeRandomBlahz0c5GZVnR', ''); - var hex = encrypt.update('Hello World!', 'ascii', 'hex'); +{ + const encrypt = + crypto.createCipheriv('BF-ECB', 'SomeRandomBlahz0c5GZVnR', ''); + let hex = encrypt.update('Hello World!', 'ascii', 'hex'); hex += encrypt.final('hex'); assert.strictEqual(hex.toUpperCase(), '6D385F424AAB0CFBF0BB86E07FFB7D71'); -}()); +} -(function() { - var decrypt = crypto.createDecipheriv('BF-ECB', 'SomeRandomBlahz0c5GZVnR', - ''); - var msg = decrypt.update('6D385F424AAB0CFBF0BB86E07FFB7D71', 'hex', 'ascii'); +{ + const decrypt = + crypto.createDecipheriv('BF-ECB', 'SomeRandomBlahz0c5GZVnR', ''); + let msg = decrypt.update('6D385F424AAB0CFBF0BB86E07FFB7D71', 'hex', 'ascii'); msg += decrypt.final('ascii'); assert.strictEqual(msg, 'Hello World!'); -}()); +} From 5afcf3ac78f3160bb88326b5a150baff32c2fe41 Mon Sep 17 00:00:00 2001 From: Raja Panidepu Date: Fri, 2 Dec 2016 17:51:43 -0600 Subject: [PATCH 107/313] test: updated test-stream-pipe-unpipe-stream test readableStream.unpipe(dest) is no operation when dest is not a destination for readable stream. PR-URL: https://github.com/nodejs/node/pull/10100 Reviewed-By: Colin Ihrig Reviewed-By: Matteo Collina --- test/parallel/test-stream-pipe-unpipe-streams.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/parallel/test-stream-pipe-unpipe-streams.js b/test/parallel/test-stream-pipe-unpipe-streams.js index c51c100d0f6802..79719add3700fc 100644 --- a/test/parallel/test-stream-pipe-unpipe-streams.js +++ b/test/parallel/test-stream-pipe-unpipe-streams.js @@ -25,6 +25,9 @@ source.unpipe(dest2); assert.strictEqual(source._readableState.pipes, dest1); assert.notStrictEqual(source._readableState.pipes, dest2); +dest2.on('unpipe', common.fail); +source.unpipe(dest2); + source.unpipe(dest1); assert.strictEqual(source._readableState.pipes, null); From bc3b77f525d659e1b89d5f4a8db0820a8fffa86d Mon Sep 17 00:00:00 2001 From: Adrian Estrada Date: Thu, 1 Dec 2016 10:21:29 -0600 Subject: [PATCH 108/313] test: replace equal with strictEqual in test-freelist.js Improving asserts in test-freelist.js PR-URL: https://github.com/nodejs/node/pull/9910 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-freelist.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-freelist.js b/test/parallel/test-freelist.js index feb5dcc9a96a70..65758bd7114de8 100644 --- a/test/parallel/test-freelist.js +++ b/test/parallel/test-freelist.js @@ -6,8 +6,8 @@ require('../common'); const assert = require('assert'); const freelist = require('internal/freelist'); -assert.equal(typeof freelist, 'object'); -assert.equal(typeof freelist.FreeList, 'function'); +assert.strictEqual(typeof freelist, 'object'); +assert.strictEqual(typeof freelist.FreeList, 'function'); const flist1 = new freelist.FreeList('flist1', 3, String); From 47c925a4acccf286d36a0eaf8af4f1f5a8e478aa Mon Sep 17 00:00:00 2001 From: Ethan Arrowood Date: Thu, 1 Dec 2016 10:29:05 -0600 Subject: [PATCH 109/313] test: updated tls-getcipher test Changed var to ES6 syntax const/let. Added common.mustCall function wrapper to all functions called exactly once. Changed assert.equal to assert.strictEqual. PR-URL: https://github.com/nodejs/node/pull/9923 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-tls-getcipher.js | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/test/parallel/test-tls-getcipher.js b/test/parallel/test-tls-getcipher.js index 4ecacb1e9f2fbb..b5205d48778f5f 100644 --- a/test/parallel/test-tls-getcipher.js +++ b/test/parallel/test-tls-getcipher.js @@ -1,37 +1,37 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); -var fs = require('fs'); -var cipher_list = ['AES128-SHA256', 'AES256-SHA256']; -var cipher_version_pattern = /TLS|SSL/; -var options = { +const fs = require('fs'); +const cipher_list = ['AES128-SHA256', 'AES256-SHA256']; +const cipher_version_pattern = /TLS|SSL/; +const options = { key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'), cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'), ciphers: cipher_list.join(':'), honorCipherOrder: true }; -var server = tls.createServer(options, - common.mustCall(function(cleartextStream) {})); +const server = tls.createServer(options, + common.mustCall(function(cleartextStream) {})); -server.listen(0, '127.0.0.1', function() { - var client = tls.connect({ +server.listen(0, '127.0.0.1', common.mustCall(function() { + const client = tls.connect({ host: '127.0.0.1', port: this.address().port, ciphers: cipher_list.join(':'), rejectUnauthorized: false - }, function() { - var cipher = client.getCipher(); - assert.equal(cipher.name, cipher_list[0]); + }, common.mustCall(function() { + const cipher = client.getCipher(); + assert.strictEqual(cipher.name, cipher_list[0]); assert(cipher_version_pattern.test(cipher.version)); client.end(); server.close(); - }); -}); + })); +})); From b71d3fd748ad33e4932634b697a1352da25ff6ce Mon Sep 17 00:00:00 2001 From: Dan Villa Date: Thu, 1 Dec 2016 08:14:27 -0800 Subject: [PATCH 110/313] test: refactor test-child-process-double-pipe Update test to use strictEqual instead of equal to remove error. PR-URL: https://github.com/nodejs/node/pull/9930 Reviewed-By: Prince John Wesley Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/parallel/test-child-process-double-pipe.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-child-process-double-pipe.js b/test/parallel/test-child-process-double-pipe.js index 2d9805d687635c..c5b7c093af8a4a 100644 --- a/test/parallel/test-child-process-double-pipe.js +++ b/test/parallel/test-child-process-double-pipe.js @@ -91,5 +91,5 @@ sed.stdout.on('data', function(data) { }); sed.stdout.on('end', function(code) { - assert.equal(result, 'hellO' + os.EOL + 'nOde' + os.EOL + 'wOrld' + os.EOL); + assert.strictEqual(result, `hellO${os.EOL}nOde${os.EOL}wOrld${os.EOL}`); }); From eeab546fb64b856803fd0a142ece96af2dd6a8b9 Mon Sep 17 00:00:00 2001 From: CodeTheInternet Date: Thu, 1 Dec 2016 11:27:21 -0600 Subject: [PATCH 111/313] test: strictEqual in test-beforeexit-event.js PR-URL: https://github.com/nodejs/node/pull/10004 Reviewed-by: Michael Dawson Reviewed-By: Colin Ihrig --- test/parallel/test-beforeexit-event.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-beforeexit-event.js b/test/parallel/test-beforeexit-event.js index d50ef67190c4c7..4decbcf9f921f3 100644 --- a/test/parallel/test-beforeexit-event.js +++ b/test/parallel/test-beforeexit-event.js @@ -37,6 +37,6 @@ function tryListen() { } process.on('exit', function() { - assert.equal(4, deaths); - assert.equal(3, revivals); + assert.strictEqual(4, deaths); + assert.strictEqual(3, revivals); }); From 6d79c0cd2cbacfd937efbbbd1631cdfafe9d64ff Mon Sep 17 00:00:00 2001 From: Eric Gonzalez Date: Thu, 1 Dec 2016 10:29:07 -0600 Subject: [PATCH 112/313] test: adding strictEqual to test-buffer-indexof.js PR-URL: https://github.com/nodejs/node/pull/9955 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-buffer-indexof.js | 114 +++++++++++++-------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/test/parallel/test-buffer-indexof.js b/test/parallel/test-buffer-indexof.js index 5757200c2b0470..746a2723167a60 100644 --- a/test/parallel/test-buffer-indexof.js +++ b/test/parallel/test-buffer-indexof.js @@ -11,65 +11,65 @@ const buf_f = Buffer.from('f'); const buf_z = Buffer.from('z'); const buf_empty = Buffer.from(''); -assert.equal(b.indexOf('a'), 0); -assert.equal(b.indexOf('a', 1), -1); -assert.equal(b.indexOf('a', -1), -1); -assert.equal(b.indexOf('a', -4), -1); -assert.equal(b.indexOf('a', -b.length), 0); -assert.equal(b.indexOf('a', NaN), 0); -assert.equal(b.indexOf('a', -Infinity), 0); -assert.equal(b.indexOf('a', Infinity), -1); -assert.equal(b.indexOf('bc'), 1); -assert.equal(b.indexOf('bc', 2), -1); -assert.equal(b.indexOf('bc', -1), -1); -assert.equal(b.indexOf('bc', -3), -1); -assert.equal(b.indexOf('bc', -5), 1); -assert.equal(b.indexOf('bc', NaN), 1); -assert.equal(b.indexOf('bc', -Infinity), 1); -assert.equal(b.indexOf('bc', Infinity), -1); -assert.equal(b.indexOf('f'), b.length - 1); -assert.equal(b.indexOf('z'), -1); -assert.equal(b.indexOf(''), -1); -assert.equal(b.indexOf('', 1), -1); -assert.equal(b.indexOf('', b.length + 1), -1); -assert.equal(b.indexOf('', Infinity), -1); -assert.equal(b.indexOf(buf_a), 0); -assert.equal(b.indexOf(buf_a, 1), -1); -assert.equal(b.indexOf(buf_a, -1), -1); -assert.equal(b.indexOf(buf_a, -4), -1); -assert.equal(b.indexOf(buf_a, -b.length), 0); -assert.equal(b.indexOf(buf_a, NaN), 0); -assert.equal(b.indexOf(buf_a, -Infinity), 0); -assert.equal(b.indexOf(buf_a, Infinity), -1); -assert.equal(b.indexOf(buf_bc), 1); -assert.equal(b.indexOf(buf_bc, 2), -1); -assert.equal(b.indexOf(buf_bc, -1), -1); -assert.equal(b.indexOf(buf_bc, -3), -1); -assert.equal(b.indexOf(buf_bc, -5), 1); -assert.equal(b.indexOf(buf_bc, NaN), 1); -assert.equal(b.indexOf(buf_bc, -Infinity), 1); -assert.equal(b.indexOf(buf_bc, Infinity), -1); -assert.equal(b.indexOf(buf_f), b.length - 1); -assert.equal(b.indexOf(buf_z), -1); -assert.equal(b.indexOf(buf_empty), -1); -assert.equal(b.indexOf(buf_empty, 1), -1); -assert.equal(b.indexOf(buf_empty, b.length + 1), -1); -assert.equal(b.indexOf(buf_empty, Infinity), -1); -assert.equal(b.indexOf(0x61), 0); -assert.equal(b.indexOf(0x61, 1), -1); -assert.equal(b.indexOf(0x61, -1), -1); -assert.equal(b.indexOf(0x61, -4), -1); -assert.equal(b.indexOf(0x61, -b.length), 0); -assert.equal(b.indexOf(0x61, NaN), 0); -assert.equal(b.indexOf(0x61, -Infinity), 0); -assert.equal(b.indexOf(0x61, Infinity), -1); -assert.equal(b.indexOf(0x0), -1); +assert.strictEqual(b.indexOf('a'), 0); +assert.strictEqual(b.indexOf('a', 1), -1); +assert.strictEqual(b.indexOf('a', -1), -1); +assert.strictEqual(b.indexOf('a', -4), -1); +assert.strictEqual(b.indexOf('a', -b.length), 0); +assert.strictEqual(b.indexOf('a', NaN), 0); +assert.strictEqual(b.indexOf('a', -Infinity), 0); +assert.strictEqual(b.indexOf('a', Infinity), -1); +assert.strictEqual(b.indexOf('bc'), 1); +assert.strictEqual(b.indexOf('bc', 2), -1); +assert.strictEqual(b.indexOf('bc', -1), -1); +assert.strictEqual(b.indexOf('bc', -3), -1); +assert.strictEqual(b.indexOf('bc', -5), 1); +assert.strictEqual(b.indexOf('bc', NaN), 1); +assert.strictEqual(b.indexOf('bc', -Infinity), 1); +assert.strictEqual(b.indexOf('bc', Infinity), -1); +assert.strictEqual(b.indexOf('f'), b.length - 1); +assert.strictEqual(b.indexOf('z'), -1); +assert.strictEqual(b.indexOf(''), -1); +assert.strictEqual(b.indexOf('', 1), -1); +assert.strictEqual(b.indexOf('', b.length + 1), -1); +assert.strictEqual(b.indexOf('', Infinity), -1); +assert.strictEqual(b.indexOf(buf_a), 0); +assert.strictEqual(b.indexOf(buf_a, 1), -1); +assert.strictEqual(b.indexOf(buf_a, -1), -1); +assert.strictEqual(b.indexOf(buf_a, -4), -1); +assert.strictEqual(b.indexOf(buf_a, -b.length), 0); +assert.strictEqual(b.indexOf(buf_a, NaN), 0); +assert.strictEqual(b.indexOf(buf_a, -Infinity), 0); +assert.strictEqual(b.indexOf(buf_a, Infinity), -1); +assert.strictEqual(b.indexOf(buf_bc), 1); +assert.strictEqual(b.indexOf(buf_bc, 2), -1); +assert.strictEqual(b.indexOf(buf_bc, -1), -1); +assert.strictEqual(b.indexOf(buf_bc, -3), -1); +assert.strictEqual(b.indexOf(buf_bc, -5), 1); +assert.strictEqual(b.indexOf(buf_bc, NaN), 1); +assert.strictEqual(b.indexOf(buf_bc, -Infinity), 1); +assert.strictEqual(b.indexOf(buf_bc, Infinity), -1); +assert.strictEqual(b.indexOf(buf_f), b.length - 1); +assert.strictEqual(b.indexOf(buf_z), -1); +assert.strictEqual(b.indexOf(buf_empty), -1); +assert.strictEqual(b.indexOf(buf_empty, 1), -1); +assert.strictEqual(b.indexOf(buf_empty, b.length + 1), -1); +assert.strictEqual(b.indexOf(buf_empty, Infinity), -1); +assert.strictEqual(b.indexOf(0x61), 0); +assert.strictEqual(b.indexOf(0x61, 1), -1); +assert.strictEqual(b.indexOf(0x61, -1), -1); +assert.strictEqual(b.indexOf(0x61, -4), -1); +assert.strictEqual(b.indexOf(0x61, -b.length), 0); +assert.strictEqual(b.indexOf(0x61, NaN), 0); +assert.strictEqual(b.indexOf(0x61, -Infinity), 0); +assert.strictEqual(b.indexOf(0x61, Infinity), -1); +assert.strictEqual(b.indexOf(0x0), -1); // test offsets -assert.equal(b.indexOf('d', 2), 3); -assert.equal(b.indexOf('f', 5), 5); -assert.equal(b.indexOf('f', -1), 5); -assert.equal(b.indexOf('f', 6), -1); +assert.strictEqual(b.indexOf('d', 2), 3); +assert.strictEqual(b.indexOf('f', 5), 5); +assert.strictEqual(b.indexOf('f', -1), 5); +assert.strictEqual(b.indexOf('f', 6), -1); assert.equal(b.indexOf(Buffer.from('d'), 2), 3); assert.equal(b.indexOf(Buffer.from('f'), 5), 5); From 1addb3ba5372339711c7938ac379042d22e73cb7 Mon Sep 17 00:00:00 2001 From: rgoodwin Date: Thu, 1 Dec 2016 10:41:34 -0600 Subject: [PATCH 113/313] test: update tls test to use const/let and common.mustCall * Replace variable defs using var with more up to date const/let. * Updated tests to use strict equality to ensure type and value comparision * wrap callback functions in common.mustCall to ensure single execution PR-URL: https://github.com/nodejs/node/pull/9968 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/parallel/test-tls-client-reject.js | 34 ++++++++++++------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/test/parallel/test-tls-client-reject.js b/test/parallel/test-tls-client-reject.js index 1b33f5525dc478..5868472c121517 100644 --- a/test/parallel/test-tls-client-reject.js +++ b/test/parallel/test-tls-client-reject.js @@ -1,64 +1,64 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const tls = require('tls'); -var fs = require('fs'); -var path = require('path'); +const fs = require('fs'); +const path = require('path'); -var options = { +const options = { key: fs.readFileSync(path.join(common.fixturesDir, 'test_key.pem')), cert: fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem')) }; -var server = tls.createServer(options, common.mustCall(function(socket) { +const server = tls.createServer(options, common.mustCall(function(socket) { socket.on('data', function(data) { console.error(data.toString()); - assert.equal(data, 'ok'); + assert.strictEqual(data.toString(), 'ok'); }); }, 3)).listen(0, function() { unauthorized(); }); function unauthorized() { - var socket = tls.connect({ + const socket = tls.connect({ port: server.address().port, servername: 'localhost', rejectUnauthorized: false - }, function() { + }, common.mustCall(function() { assert(!socket.authorized); socket.end(); rejectUnauthorized(); - }); + })); socket.on('error', common.fail); socket.write('ok'); } function rejectUnauthorized() { - var socket = tls.connect(server.address().port, { + const socket = tls.connect(server.address().port, { servername: 'localhost' }, common.fail); - socket.on('error', function(err) { + socket.on('error', common.mustCall(function(err) { console.error(err); authorized(); - }); + })); socket.write('ng'); } function authorized() { - var socket = tls.connect(server.address().port, { + const socket = tls.connect(server.address().port, { ca: [fs.readFileSync(path.join(common.fixturesDir, 'test_cert.pem'))], servername: 'localhost' - }, function() { + }, common.mustCall(function() { assert(socket.authorized); socket.end(); server.close(); - }); + })); socket.on('error', common.fail); socket.write('ok'); } From a749604e111634deec39d1b81f018b93db8dbcc9 Mon Sep 17 00:00:00 2001 From: Nigel Kibodeaux Date: Thu, 1 Dec 2016 11:06:29 -0600 Subject: [PATCH 114/313] test: modernize test-fs-truncate-fd - changed `var` to `const` where variables were not reassigned. - changed `assert.equal` to `assert.strictEqual` because there was no downside to being more rigorous. PR-URL: https://github.com/nodejs/node/pull/9978 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-fs-truncate-fd.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-fs-truncate-fd.js b/test/parallel/test-fs-truncate-fd.js index 2514b80f09892a..526612870d9f73 100644 --- a/test/parallel/test-fs-truncate-fd.js +++ b/test/parallel/test-fs-truncate-fd.js @@ -1,17 +1,17 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var path = require('path'); -var fs = require('fs'); -var tmp = common.tmpDir; +const common = require('../common'); +const assert = require('assert'); +const path = require('path'); +const fs = require('fs'); +const tmp = common.tmpDir; common.refreshTmpDir(); -var filename = path.resolve(tmp, 'truncate-file.txt'); +const filename = path.resolve(tmp, 'truncate-file.txt'); fs.writeFileSync(filename, 'hello world', 'utf8'); -var fd = fs.openSync(filename, 'r+'); +const fd = fs.openSync(filename, 'r+'); fs.truncate(fd, 5, common.mustCall(function(err) { assert.ok(!err); - assert.equal(fs.readFileSync(filename, 'utf8'), 'hello'); + assert.strictEqual(fs.readFileSync(filename, 'utf8'), 'hello'); })); process.on('exit', function() { From aea0d47b779c432d11a3a1ab238bc72661bc011b Mon Sep 17 00:00:00 2001 From: makenova Date: Thu, 1 Dec 2016 11:08:42 -0600 Subject: [PATCH 115/313] test: update repl tests change var to const or let change assert.equal to assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/9991 Reviewed-By: Gibson Fahnestock Reviewed-By: James M Snell --- test/parallel/test-repl.js | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index a6603332aad672..fc8efc695433f0 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -1,6 +1,6 @@ /* eslint-disable max-len, strict */ -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); common.globalCheck = false; common.refreshTmpDir(); @@ -15,11 +15,11 @@ const prompt_npm = 'npm should be run outside of the ' + 'node repl, in your normal shell.\n' + '(Press Control-D to exit.)\n'; const expect_npm = prompt_npm + prompt_unix; -var server_tcp, server_unix, client_tcp, client_unix, replServer; +let server_tcp, server_unix, client_tcp, client_unix, replServer; // absolute path to test/fixtures/a.js -var moduleFilename = require('path').join(common.fixturesDir, 'a'); +const moduleFilename = require('path').join(common.fixturesDir, 'a'); console.error('repl test'); @@ -30,7 +30,7 @@ global.invoke_me = function(arg) { function send_expect(list) { if (list.length > 0) { - var cur = list.shift(); + const cur = list.shift(); console.error('sending ' + JSON.stringify(cur.send)); @@ -56,8 +56,8 @@ function strict_mode_error_test() { function error_test() { // The other stuff is done so reuse unix socket - var read_buffer = ''; - var run_strict_test = true; + let read_buffer = ''; + let run_strict_test = true; client_unix.removeAllListeners('data'); client_unix.on('data', function(data) { @@ -70,7 +70,7 @@ function error_test() { if (read_buffer.indexOf(prompt_unix) !== -1) { // if it's an exact match, then don't do the regexp if (read_buffer !== client_unix.expect) { - var expect = client_unix.expect; + let expect = client_unix.expect; if (expect === prompt_multiline) expect = /[\.]{3} /; assert.ok(read_buffer.match(expect)); @@ -354,13 +354,13 @@ function tcp_test() { }); server_tcp.listen(0, function() { - var read_buffer = ''; + let read_buffer = ''; client_tcp = net.createConnection(this.address().port); client_tcp.on('connect', function() { - assert.equal(true, client_tcp.readable); - assert.equal(true, client_tcp.writable); + assert.strictEqual(true, client_tcp.readable); + assert.strictEqual(true, client_tcp.writable); send_expect([ { client: client_tcp, send: '', @@ -423,13 +423,13 @@ function unix_test() { }); server_unix.on('listening', function() { - var read_buffer = ''; + let read_buffer = ''; client_unix = net.createConnection(common.PIPE); client_unix.on('connect', function() { - assert.equal(true, client_unix.readable); - assert.equal(true, client_unix.writable); + assert.strictEqual(true, client_unix.readable); + assert.strictEqual(true, client_unix.writable); send_expect([ { client: client_unix, send: '', From ced89ede035cc924e71ede4dc2fc4a6c01fbbf05 Mon Sep 17 00:00:00 2001 From: fmizzell Date: Thu, 1 Dec 2016 17:19:34 +0000 Subject: [PATCH 116/313] test: refactor test-cluster-worker-events Use assert.strictEqual() instead of assert.equal() PR-URL: https://github.com/nodejs/node/pull/9994 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-cluster-worker-events.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-cluster-worker-events.js b/test/parallel/test-cluster-worker-events.js index fadfd5356540b3..08bf456a735b7d 100644 --- a/test/parallel/test-cluster-worker-events.js +++ b/test/parallel/test-cluster-worker-events.js @@ -10,7 +10,7 @@ if (cluster.isMaster) { var worker = cluster.fork(); worker.on('exit', function(code) { - assert.equal(code, OK); + assert.strictEqual(code, OK); process.exit(0); }); @@ -50,7 +50,7 @@ function check(m) { assert.deepStrictEqual(messages[0], messages[1]); cluster.worker.once('error', function(e) { - assert.equal(e, 'HI'); + assert.strictEqual(e, 'HI'); process.exit(OK); }); From fe59a67b6eabeeaf2b4114a201ef7aaad9e2bd93 Mon Sep 17 00:00:00 2001 From: cdnadmin Date: Thu, 1 Dec 2016 11:09:34 -0600 Subject: [PATCH 117/313] test: use strictEqual() domain-http did this at nina 2016 na code and learn event PR-URL: https://github.com/nodejs/node/pull/9996 Reviewed-By: Colin Ihrig Reviewed-By: Gibson Fahnestock Reviewed-By: James M Snell --- test/parallel/test-domain-http-server.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-domain-http-server.js b/test/parallel/test-domain-http-server.js index e6e4b294cfef2e..26264e8ec987d8 100644 --- a/test/parallel/test-domain-http-server.js +++ b/test/parallel/test-domain-http-server.js @@ -88,7 +88,7 @@ function next() { } process.on('exit', function() { - assert.equal(serverCaught, 2); - assert.equal(clientCaught, 2); + assert.strictEqual(serverCaught, 2); + assert.strictEqual(clientCaught, 2); console.log('ok'); }); From eb61d918b140a1d983daaa59f4c3c87695470ec6 Mon Sep 17 00:00:00 2001 From: Paul Lucas Date: Thu, 1 Dec 2016 10:47:51 -0600 Subject: [PATCH 118/313] test: Added more validations to setEncoding * Added more strict validations to properly test setEncoding * Changed all var usage to const or let * Changed assert.equal to assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/9997 Reviewed-By: Colin Ihrig Reviewed-By: Gibson Fahnestock Reviewed-By: James M Snell --- test/parallel/test-tls-set-encoding.js | 37 ++++++++++++++++---------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/test/parallel/test-tls-set-encoding.js b/test/parallel/test-tls-set-encoding.js index 013a5799fa1a3e..5eb58132bc2b64 100644 --- a/test/parallel/test-tls-set-encoding.js +++ b/test/parallel/test-tls-set-encoding.js @@ -1,38 +1,41 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const tls = require('tls'); -var fs = require('fs'); +const fs = require('fs'); -var options = { +const options = { key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'), cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem') }; -var message = 'hello world\n'; +// Contains a UTF8 only character +const messageUtf8 = 'x√ab c'; +// The same string above represented with ASCII +const messageAscii = 'xb\b\u001aab c'; -var server = tls.Server(options, common.mustCall(function(socket) { - socket.end(message); +const server = tls.Server(options, common.mustCall(function(socket) { + socket.end(messageUtf8); })); server.listen(0, function() { - var client = tls.connect({ + const client = tls.connect({ port: this.address().port, rejectUnauthorized: false }); - var buffer = ''; + let buffer = ''; - client.setEncoding('utf8'); + client.setEncoding('ascii'); client.on('data', function(d) { assert.ok(typeof d === 'string'); @@ -44,10 +47,16 @@ server.listen(0, function() { // readyState is deprecated but we want to make // sure this isn't triggering an assert in lib/net.js // See issue #1069. - assert.equal('closed', client.readyState); + assert.strictEqual('closed', client.readyState); + + // Confirming the buffer string is encoded in ASCII + // and thus does NOT match the UTF8 string + assert.notStrictEqual(buffer, messageUtf8); + + // Confirming the buffer string is encoded in ASCII + // and thus does equal the ASCII string representation + assert.strictEqual(buffer, messageAscii); - assert.equal(buffer, message); - console.log(message); server.close(); }); }); From cc8100a529f64d5e356a9e0d5d7e1e8255a48f5f Mon Sep 17 00:00:00 2001 From: levsoroka Date: Thu, 1 Dec 2016 11:19:09 -0600 Subject: [PATCH 119/313] test: fix buffer alloc tests Replaced assert.equal to assert.strictEqual. Fixed assert.throws syntax and added second argument PR-URL: https://github.com/nodejs/node/pull/9998 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-buffer-alloc.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index 2b731cee94a301..b03c96bf646042 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/test/parallel/test-buffer-alloc.js @@ -138,7 +138,7 @@ assert.doesNotThrow(() => Buffer.alloc(1).write('', 1, 0)); const sliceA = b.slice(offset, offset + asciiString.length); const sliceB = b.slice(offset, offset + asciiString.length); for (let i = 0; i < asciiString.length; i++) { - assert.equal(sliceA[i], sliceB[i]); + assert.strictEqual(sliceA[i], sliceB[i]); } } @@ -149,7 +149,7 @@ assert.doesNotThrow(() => Buffer.alloc(1).write('', 1, 0)); b.write(utf8String, 0, Buffer.byteLength(utf8String), 'utf8'); let utf8Slice = b.toString('utf8', 0, Buffer.byteLength(utf8String)); - assert.equal(utf8String, utf8Slice); + assert.strictEqual(utf8String, utf8Slice); assert.strictEqual(Buffer.byteLength(utf8String), b.write(utf8String, offset, 'utf8')); @@ -1057,7 +1057,8 @@ assert.strictEqual(Buffer.allocUnsafe(1).parent, undefined); Buffer.poolSize = ps; // Test Buffer.copy() segfault -assert.throws(() => Buffer.allocUnsafe(10).copy()); +assert.throws(() => Buffer.allocUnsafe(10).copy(), + /TypeError: argument should be a Buffer/); const regErrorMsg = new RegExp('First argument must be a string, Buffer, ' + 'ArrayBuffer, Array, or array-like object.'); @@ -1066,10 +1067,10 @@ assert.throws(() => Buffer.from(), regErrorMsg); assert.throws(() => Buffer.from(null), regErrorMsg); // Test prototype getters don't throw -assert.equal(Buffer.prototype.parent, undefined); -assert.equal(Buffer.prototype.offset, undefined); -assert.equal(SlowBuffer.prototype.parent, undefined); -assert.equal(SlowBuffer.prototype.offset, undefined); +assert.strictEqual(Buffer.prototype.parent, undefined); +assert.strictEqual(Buffer.prototype.offset, undefined); +assert.strictEqual(SlowBuffer.prototype.parent, undefined); +assert.strictEqual(SlowBuffer.prototype.offset, undefined); { @@ -1095,7 +1096,7 @@ assert.throws(() => { const a = Buffer.alloc(1); const b = Buffer.alloc(1); a.copy(b, 0, 0x100000000, 0x100000001); -}), /out of range index/; +}, /out of range index/); // Unpooled buffer (replaces SlowBuffer) { From a6096041c6fafb8dbfb438c27f270e089c1a686a Mon Sep 17 00:00:00 2001 From: Christopher Rokita Date: Thu, 1 Dec 2016 12:20:25 -0500 Subject: [PATCH 120/313] test: use const or let and assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/10001 Reviewed-By: Michael Dawson Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-fs-read-file-sync.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/parallel/test-fs-read-file-sync.js b/test/parallel/test-fs-read-file-sync.js index d34bf7748cea89..45d08f40111f78 100644 --- a/test/parallel/test-fs-read-file-sync.js +++ b/test/parallel/test-fs-read-file-sync.js @@ -1,13 +1,13 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var path = require('path'); -var fs = require('fs'); +const common = require('../common'); +const assert = require('assert'); +const path = require('path'); +const fs = require('fs'); -var fn = path.join(common.fixturesDir, 'elipses.txt'); +const fn = path.join(common.fixturesDir, 'elipses.txt'); -var s = fs.readFileSync(fn, 'utf8'); -for (var i = 0; i < s.length; i++) { - assert.equal('\u2026', s[i]); +const s = fs.readFileSync(fn, 'utf8'); +for (let i = 0; i < s.length; i++) { + assert.strictEqual('\u2026', s[i]); } -assert.equal(10000, s.length); +assert.strictEqual(10000, s.length); From b7619e3b16bbd17d4622e14577ac7b610ef88fea Mon Sep 17 00:00:00 2001 From: Peter Diaz Date: Thu, 1 Dec 2016 11:41:53 -0600 Subject: [PATCH 121/313] test: update assert.equal() to assert.strictEqual() PR-URL: https://github.com/nodejs/node/pull/10024 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-crypto-sign-verify.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-crypto-sign-verify.js b/test/parallel/test-crypto-sign-verify.js index 77ecda30534a76..6df41409f0e6c1 100644 --- a/test/parallel/test-crypto-sign-verify.js +++ b/test/parallel/test-crypto-sign-verify.js @@ -21,7 +21,7 @@ var keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii'); let s1stream = crypto.createSign('RSA-SHA1'); s1stream.end('Test123'); s1stream = s1stream.sign(keyPem, 'base64'); - assert.equal(s1, s1stream, 'Stream produces same output'); + assert.strictEqual(s1, s1stream, 'Stream produces same output'); const verified = crypto.createVerify('RSA-SHA1') .update('Test') @@ -37,7 +37,7 @@ var keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii'); let s2stream = crypto.createSign('RSA-SHA256'); s2stream.end('Test123'); s2stream = s2stream.sign(keyPem, 'latin1'); - assert.equal(s2, s2stream, 'Stream produces same output'); + assert.strictEqual(s2, s2stream, 'Stream produces same output'); let verified = crypto.createVerify('RSA-SHA256') .update('Test') From 4fce85554a7d1d85dc23466561f6e6ffda054d62 Mon Sep 17 00:00:00 2001 From: Julian Duque Date: Thu, 1 Dec 2016 11:42:19 -0600 Subject: [PATCH 122/313] test: refactor test for net listen on fd0 Replace var to const/let, use common.mustCall on callbacks and move process.on('exit') to the .on('error') handler PR-URL: https://github.com/nodejs/node/pull/10025 Reviewed-By: Santiago Gimeno Reviewed-By: Gibson Fahnestock Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-net-listen-fd0.js | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) diff --git a/test/parallel/test-net-listen-fd0.js b/test/parallel/test-net-listen-fd0.js index b484c6306f8463..f34f12ec22c771 100644 --- a/test/parallel/test-net-listen-fd0.js +++ b/test/parallel/test-net-listen-fd0.js @@ -1,20 +1,12 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var net = require('net'); +const common = require('../common'); +const assert = require('assert'); +const net = require('net'); -var gotError = false; - -process.on('exit', function() { - assert(gotError instanceof Error); -}); - -// this should fail with an async EINVAL error, not throw an exception -net.createServer(common.fail).listen({fd: 0}).on('error', function(e) { - switch (e.code) { - case 'EINVAL': - case 'ENOTSOCK': - gotError = e; - break; - } -}); +// This should fail with an async EINVAL error, not throw an exception +net.createServer(common.fail) + .listen({fd: 0}) + .on('error', common.mustCall(function(e) { + assert(e instanceof Error); + assert(['EINVAL', 'ENOTSOCK'].includes(e.code)); + })); From ec7df6c0a4cc67cc72b43ce07e4d43d805483625 Mon Sep 17 00:00:00 2001 From: Jonathan Darling Date: Thu, 1 Dec 2016 11:49:50 -0600 Subject: [PATCH 123/313] test: add test for process.stdin.setRawMode() adds a basic test for process.stdin.setRawMode to ensure that the isRaw property is properly changed PR-URL: https://github.com/nodejs/node/pull/10037 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/pseudo-tty/stdin-setrawmode.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test/pseudo-tty/stdin-setrawmode.js diff --git a/test/pseudo-tty/stdin-setrawmode.js b/test/pseudo-tty/stdin-setrawmode.js new file mode 100644 index 00000000000000..015c769a9b6144 --- /dev/null +++ b/test/pseudo-tty/stdin-setrawmode.js @@ -0,0 +1,9 @@ +'use strict'; +require('../common'); +const assert = require('assert'); + +process.stdin.setRawMode(true); +assert.strictEqual(process.stdin.isRaw, true); + +process.stdin.setRawMode(false); +assert.strictEqual(process.stdin.isRaw, false); From ba5e37765ad34ae62a49e625531f7d83e83414a5 Mon Sep 17 00:00:00 2001 From: Michael Alexander Date: Thu, 1 Dec 2016 11:35:42 -0600 Subject: [PATCH 124/313] test: strictCompare and explcit inputs mprovement to test-buffer-slice * change implicit string equal() compares to strictEqual compares of buffer output (the slice output default) * explicitly create buffers from utf8 inputs for the compare PR-URL: https://github.com/nodejs/node/pull/10048 Reviewed-By: James M Snell --- test/parallel/test-buffer-slice.js | 127 ++++++++++++++++++----------- 1 file changed, 80 insertions(+), 47 deletions(-) diff --git a/test/parallel/test-buffer-slice.js b/test/parallel/test-buffer-slice.js index 076bf33fb07736..2489420c33e6e9 100644 --- a/test/parallel/test-buffer-slice.js +++ b/test/parallel/test-buffer-slice.js @@ -3,52 +3,83 @@ require('../common'); const assert = require('assert'); -assert.strictEqual(0, Buffer.from('hello').slice(0, 0).length); -assert.strictEqual(0, Buffer('hello').slice(0, 0).length); +assert.strictEqual(0, Buffer.from('hello', 'utf8').slice(0, 0).length); +assert.strictEqual(0, Buffer('hello', 'utf8').slice(0, 0).length); -const buf = Buffer.from('0123456789'); -assert.equal(buf.slice(-10, 10), '0123456789'); -assert.equal(buf.slice(-20, 10), '0123456789'); -assert.equal(buf.slice(-20, -10), ''); -assert.equal(buf.slice(), '0123456789'); -assert.equal(buf.slice(0), '0123456789'); -assert.equal(buf.slice(0, 0), ''); -assert.equal(buf.slice(undefined), '0123456789'); -assert.equal(buf.slice('foobar'), '0123456789'); -assert.equal(buf.slice(undefined, undefined), '0123456789'); +const buf = Buffer.from('0123456789', 'utf8'); +assert.strictEqual(0, Buffer.compare(buf.slice(-10, 10), + Buffer.from('0123456789', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(-20, 10), + Buffer.from('0123456789', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(-20, -10), + Buffer.from('', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(), + Buffer.from('0123456789', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(0), + Buffer.from('0123456789', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(0, 0), + Buffer.from('', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(undefined), + Buffer.from('0123456789', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice('foobar'), + Buffer.from('0123456789', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(undefined, undefined), + Buffer.from('0123456789', 'utf8'))); -assert.equal(buf.slice(2), '23456789'); -assert.equal(buf.slice(5), '56789'); -assert.equal(buf.slice(10), ''); -assert.equal(buf.slice(5, 8), '567'); -assert.equal(buf.slice(8, -1), '8'); -assert.equal(buf.slice(-10), '0123456789'); -assert.equal(buf.slice(0, -9), '0'); -assert.equal(buf.slice(0, -10), ''); -assert.equal(buf.slice(0, -1), '012345678'); -assert.equal(buf.slice(2, -2), '234567'); -assert.equal(buf.slice(0, 65536), '0123456789'); -assert.equal(buf.slice(65536, 0), ''); -assert.equal(buf.slice(-5, -8), ''); -assert.equal(buf.slice(-5, -3), '56'); -assert.equal(buf.slice(-10, 10), '0123456789'); -for (let i = 0, s = buf.toString(); i < buf.length; ++i) { - assert.equal(buf.slice(i), s.slice(i)); - assert.equal(buf.slice(0, i), s.slice(0, i)); - assert.equal(buf.slice(-i), s.slice(-i)); - assert.equal(buf.slice(0, -i), s.slice(0, -i)); +assert.strictEqual(0, Buffer.compare(buf.slice(2), + Buffer.from('23456789', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(5), + Buffer.from('56789', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(10), + Buffer.from('', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(5, 8), + Buffer.from('567', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(8, -1), + Buffer.from('8', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(-10), + Buffer.from('0123456789', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(0, -9), + Buffer.from('0', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(0, -10), + Buffer.from('', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(0, -1), + Buffer.from('012345678', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(2, -2), + Buffer.from('234567', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(0, 65536), + Buffer.from('0123456789', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(65536, 0), + Buffer.from('', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(-5, -8), + Buffer.from('', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(-5, -3), + Buffer.from('56', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice(-10, 10), + Buffer.from('0123456789', 'utf8'))); +for (let i = 0, s = buf; i < buf.length; ++i) { + assert.strictEqual(0, Buffer.compare(buf.slice(i), s.slice(i))); + assert.strictEqual(0, Buffer.compare(buf.slice(0, i), s.slice(0, i))); + assert.strictEqual(0, Buffer.compare(buf.slice(-i), s.slice(-i))); + assert.strictEqual(0, Buffer.compare(buf.slice(0, -i), s.slice(0, -i))); } const utf16Buf = Buffer.from('0123456789', 'utf16le'); assert.deepStrictEqual(utf16Buf.slice(0, 6), Buffer.from('012', 'utf16le')); -assert.equal(buf.slice('0', '1'), '0'); -assert.equal(buf.slice('-5', '10'), '56789'); -assert.equal(buf.slice('-10', '10'), '0123456789'); -assert.equal(buf.slice('-10', '-5'), '01234'); -assert.equal(buf.slice('-10', '-0'), ''); -assert.equal(buf.slice('111'), ''); -assert.equal(buf.slice('0', '-111'), ''); +assert.strictEqual(0, Buffer.compare(buf.slice('0', '1'), + Buffer.from('0', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice('-5', '10'), + Buffer.from('56789', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice('-10', '10'), + Buffer.from('0123456789', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice('-10', '-5'), + Buffer.from('01234', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice('-10', '-0'), + Buffer.from('', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice('111'), + Buffer.from('', 'utf8'))); +assert.strictEqual(0, Buffer.compare(buf.slice('0', '-111'), + Buffer.from('', 'utf8'))); // try to slice a zero length Buffer // see https://github.com/joyent/node/issues/5881 @@ -57,16 +88,17 @@ assert.strictEqual(Buffer.alloc(0).slice(0, 1).length, 0); { // Single argument slice - assert.strictEqual('bcde', Buffer.from('abcde').slice(1).toString()); + assert.strictEqual('bcde', + Buffer.from('abcde', 'utf8').slice(1).toString('utf8')); } // slice(0,0).length === 0 -assert.strictEqual(0, Buffer.from('hello').slice(0, 0).length); +assert.strictEqual(0, Buffer.from('hello', 'utf8').slice(0, 0).length); { // Regression tests for https://github.com/nodejs/node/issues/9096 - const buf = Buffer.from('abcd'); - assert.strictEqual(buf.slice(buf.length / 3).toString(), 'bcd'); + const buf = Buffer.from('abcd', 'utf8'); + assert.strictEqual(buf.slice(buf.length / 3).toString('utf8'), 'bcd'); assert.strictEqual( buf.slice(buf.length / 3, buf.length).toString(), 'bcd' @@ -74,13 +106,14 @@ assert.strictEqual(0, Buffer.from('hello').slice(0, 0).length); } { - const buf = Buffer.from('abcdefg'); - assert.strictEqual(buf.slice(-(-1 >>> 0) - 1).toString(), buf.toString()); + const buf = Buffer.from('abcdefg', 'utf8'); + assert.strictEqual(buf.slice(-(-1 >>> 0) - 1).toString('utf8'), + buf.toString('utf8')); } { - const buf = Buffer.from('abc'); - assert.strictEqual(buf.slice(-0.5).toString(), buf.toString()); + const buf = Buffer.from('abc', 'utf8'); + assert.strictEqual(buf.slice(-0.5).toString('utf8'), buf.toString('utf8')); } { From c30332daa66e466bdc67e99717899a97f5d4dc2a Mon Sep 17 00:00:00 2001 From: Ilya Potuzhnov Date: Thu, 1 Dec 2016 11:13:38 -0600 Subject: [PATCH 125/313] test: Modernize test-tls-peer-certificate.js Modernize `test/parallel/test-tls-peer-certificate.js` according to the following rules: * `var` --> `const`/`let` * `assert.equal` --> `assert.strictEqual` * `assert.ok(a === b)` --> `assert.strictEqual(a, b)` PR-URL: https://github.com/nodejs/node/pull/10014 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-by: Michael Dawson --- test/parallel/test-tls-peer-certificate.js | 38 ++++++++++++---------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/test/parallel/test-tls-peer-certificate.js b/test/parallel/test-tls-peer-certificate.js index 59d1a4fdbccc9e..ddbbf72a6309e7 100644 --- a/test/parallel/test-tls-peer-certificate.js +++ b/test/parallel/test-tls-peer-certificate.js @@ -1,32 +1,32 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const tls = require('tls'); -var fs = require('fs'); -var util = require('util'); -var join = require('path').join; +const fs = require('fs'); +const util = require('util'); +const join = require('path').join; -var options = { +const options = { key: fs.readFileSync(join(common.fixturesDir, 'keys', 'agent1-key.pem')), cert: fs.readFileSync(join(common.fixturesDir, 'keys', 'agent1-cert.pem')), ca: [ fs.readFileSync(join(common.fixturesDir, 'keys', 'ca1-cert.pem')) ] }; -var server = tls.createServer(options, function(cleartext) { +const server = tls.createServer(options, function(cleartext) { cleartext.end('World'); }); server.listen(0, common.mustCall(function() { - var socket = tls.connect({ + const socket = tls.connect({ port: this.address().port, rejectUnauthorized: false }, common.mustCall(function() { - var peerCert = socket.getPeerCertificate(); + let peerCert = socket.getPeerCertificate(); assert.ok(!peerCert.issuerCertificate); // Verify that detailed return value has all certs @@ -34,17 +34,19 @@ server.listen(0, common.mustCall(function() { assert.ok(peerCert.issuerCertificate); console.error(util.inspect(peerCert)); - assert.equal(peerCert.subject.emailAddress, 'ry@tinyclouds.org'); - assert.equal(peerCert.serialNumber, '9A84ABCFB8A72AC0'); - assert.equal(peerCert.exponent, '0x10001'); - assert.equal(peerCert.fingerprint, - '8D:06:3A:B3:E5:8B:85:29:72:4F:7D:1B:54:CD:95:19:3C:EF:6F:AA'); + assert.strictEqual(peerCert.subject.emailAddress, 'ry@tinyclouds.org'); + assert.strictEqual(peerCert.serialNumber, '9A84ABCFB8A72AC0'); + assert.strictEqual(peerCert.exponent, '0x10001'); + assert.strictEqual( + peerCert.fingerprint, + '8D:06:3A:B3:E5:8B:85:29:72:4F:7D:1B:54:CD:95:19:3C:EF:6F:AA' + ); assert.deepStrictEqual(peerCert.infoAccess['OCSP - URI'], [ 'http://ocsp.nodejs.org/' ]); - var issuer = peerCert.issuerCertificate; - assert.ok(issuer.issuerCertificate === issuer); - assert.equal(issuer.serialNumber, '8DF21C01468AF393'); + const issuer = peerCert.issuerCertificate; + assert.strictEqual(issuer.issuerCertificate, issuer); + assert.strictEqual(issuer.serialNumber, '8DF21C01468AF393'); server.close(); })); socket.end('Hello'); From dd4f9195f1ace9b895bf4ce3e2d1f0112bcadf6b Mon Sep 17 00:00:00 2001 From: Erez Weiss Date: Sat, 3 Dec 2016 20:32:28 +0200 Subject: [PATCH 126/313] test: implemented es6 conventions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit implemented arrow functions and changed var to const where appropriate. PR-URL: https://github.com/nodejs/node/pull/9669 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-fs-read-stream-err.js | 41 ++++++++++++------------ 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/test/parallel/test-fs-read-stream-err.js b/test/parallel/test-fs-read-stream-err.js index 1bc2b6f0b0239c..32e9b02455e20a 100644 --- a/test/parallel/test-fs-read-stream-err.js +++ b/test/parallel/test-fs-read-stream-err.js @@ -1,43 +1,42 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var fs = require('fs'); +const common = require('../common'); +const assert = require('assert'); +const fs = require('fs'); -var stream = fs.createReadStream(__filename, { +const stream = fs.createReadStream(__filename, { bufferSize: 64 }); -var err = new Error('BAM'); +const err = new Error('BAM'); -stream.on('error', common.mustCall(function errorHandler(err_) { - console.error('error event'); - process.nextTick(function() { - assert.equal(stream.fd, null); - assert.equal(err_, err); - }); +stream.on('error', common.mustCall((err_) => { + process.nextTick(common.mustCall(() => { + assert.strictEqual(stream.fd, null); + assert.strictEqual(err_, err); + })); })); -fs.close = common.mustCall(function(fd_, cb) { - assert.equal(fd_, stream.fd); +fs.close = common.mustCall((fd_, cb) => { + assert.strictEqual(fd_, stream.fd); process.nextTick(cb); }); -var read = fs.read; +const read = fs.read; fs.read = function() { // first time is ok. read.apply(fs, arguments); // then it breaks - fs.read = function() { - var cb = arguments[arguments.length - 1]; - process.nextTick(function() { + fs.read = common.mustCall(function() { + const cb = arguments[arguments.length - 1]; + process.nextTick(() => { cb(err); }); // and should not be called again! - fs.read = function() { + fs.read = () => { throw new Error('BOOM!'); }; - }; + }); }; -stream.on('data', function(buf) { - stream.on('data', common.fail); // no more 'data' events should follow +stream.on('data', (buf) => { + stream.on('data', () => common.fail("no more 'data' events should follow")); }); From f248c67da6c1b652e5916133bec74c8d86ddd7e4 Mon Sep 17 00:00:00 2001 From: Richard Karmazin Date: Thu, 1 Dec 2016 11:19:28 -0600 Subject: [PATCH 127/313] test: test-file-write-stream3.js refactor PR-URL: https://github.com/nodejs/node/pull/10035 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Michael Dawson --- test/parallel/test-file-write-stream3.js | 36 +++++++++++------------- 1 file changed, 16 insertions(+), 20 deletions(-) diff --git a/test/parallel/test-file-write-stream3.js b/test/parallel/test-file-write-stream3.js index 1243460f9f314f..961f51ba82be7a 100644 --- a/test/parallel/test-file-write-stream3.js +++ b/test/parallel/test-file-write-stream3.js @@ -9,7 +9,7 @@ const filepath = path.join(common.tmpDir, 'write_pos.txt'); const cb_expected = 'write open close write open close write open close '; -var cb_occurred = ''; +let cb_occurred = ''; const fileDataInitial = 'abcdefghijklmnopqrstuvwxyz'; @@ -34,10 +34,8 @@ common.refreshTmpDir(); function run_test_1() { - var file, buffer, options; - - options = {}; - file = fs.createWriteStream(filepath, options); + const options = {}; + const file = fs.createWriteStream(filepath, options); console.log(' (debug: start ', file.start); console.log(' (debug: pos ', file.pos); @@ -51,10 +49,10 @@ function run_test_1() { console.log(' (debug: start ', file.start); console.log(' (debug: pos ', file.pos); assert.strictEqual(file.bytesWritten, buffer.length); - var fileData = fs.readFileSync(filepath, 'utf8'); + const fileData = fs.readFileSync(filepath, 'utf8'); console.log(' (debug: file data ', fileData); console.log(' (debug: expected ', fileDataExpected_1); - assert.equal(fileData, fileDataExpected_1); + assert.strictEqual(fileData, fileDataExpected_1); run_test_2(); }); @@ -65,7 +63,7 @@ function run_test_1() { throw err; }); - buffer = Buffer.from(fileDataInitial); + const buffer = Buffer.from(fileDataInitial); file.write(buffer); cb_occurred += 'write '; @@ -74,13 +72,12 @@ function run_test_1() { function run_test_2() { - var file, buffer, options; - buffer = Buffer.from('123456'); + const buffer = Buffer.from('123456'); - options = { start: 10, - flags: 'r+' }; - file = fs.createWriteStream(filepath, options); + const options = { start: 10, + flags: 'r+' }; + const file = fs.createWriteStream(filepath, options); console.log(' (debug: start ', file.start); console.log(' (debug: pos ', file.pos); @@ -94,10 +91,10 @@ function run_test_2() { console.log(' (debug: start ', file.start); console.log(' (debug: pos ', file.pos); assert.strictEqual(file.bytesWritten, buffer.length); - var fileData = fs.readFileSync(filepath, 'utf8'); + const fileData = fs.readFileSync(filepath, 'utf8'); console.log(' (debug: file data ', fileData); console.log(' (debug: expected ', fileDataExpected_2); - assert.equal(fileData, fileDataExpected_2); + assert.strictEqual(fileData, fileDataExpected_2); run_test_3(); }); @@ -116,13 +113,12 @@ function run_test_2() { function run_test_3() { - var file, options; const data = '\u2026\u2026'; // 3 bytes * 2 = 6 bytes in UTF-8 - options = { start: 10, - flags: 'r+' }; - file = fs.createWriteStream(filepath, options); + const options = { start: 10, + flags: 'r+' }; + const file = fs.createWriteStream(filepath, options); console.log(' (debug: start ', file.start); console.log(' (debug: pos ', file.pos); @@ -139,7 +135,7 @@ function run_test_3() { const fileData = fs.readFileSync(filepath, 'utf8'); console.log(' (debug: file data ', fileData); console.log(' (debug: expected ', fileDataExpected_3); - assert.equal(fileData, fileDataExpected_3); + assert.strictEqual(fileData, fileDataExpected_3); run_test_4(); }); From 8ceca4a135b80c29be3c3ed81f8ba87d58a19678 Mon Sep 17 00:00:00 2001 From: Scott Smereka Date: Thu, 1 Dec 2016 10:32:32 -0600 Subject: [PATCH 128/313] test: changed assert.equal to assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/9936 Reviewed-By: Teddy Katz Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/parallel/test-exception-handler.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-exception-handler.js b/test/parallel/test-exception-handler.js index d163fb18916faa..e0e1b0086d9a7f 100644 --- a/test/parallel/test-exception-handler.js +++ b/test/parallel/test-exception-handler.js @@ -6,12 +6,12 @@ var MESSAGE = 'catch me if you can'; process.on('uncaughtException', common.mustCall(function(e) { console.log('uncaught exception! 1'); - assert.equal(MESSAGE, e.message); + assert.strictEqual(MESSAGE, e.message); })); process.on('uncaughtException', common.mustCall(function(e) { console.log('uncaught exception! 2'); - assert.equal(MESSAGE, e.message); + assert.strictEqual(MESSAGE, e.message); })); setTimeout(function() { From baa0adfe469f31ae09146112dc354cccc0887dcb Mon Sep 17 00:00:00 2001 From: Fabrice Tatieze Date: Thu, 1 Dec 2016 10:21:41 -0600 Subject: [PATCH 129/313] test: using const and strictEqual PR-URL: https://github.com/nodejs/node/pull/9926 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/parallel/test-console-instance.js | 10 +++++----- test/parallel/test-dgram-msgsize.js | 18 +++++++++--------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/test/parallel/test-console-instance.js b/test/parallel/test-console-instance.js index b8d9880865530b..4d2727d96b1a55 100644 --- a/test/parallel/test-console-instance.js +++ b/test/parallel/test-console-instance.js @@ -15,7 +15,7 @@ process.stdout.write = process.stderr.write = function() { }; // make sure that the "Console" function exists -assert.equal('function', typeof Console); +assert.strictEqual('function', typeof Console); // make sure that the Console constructor throws // when not given a writable stream instance @@ -35,7 +35,7 @@ out.write = err.write = function(d) {}; var c = new Console(out, err); out.write = err.write = function(d) { - assert.equal(d, 'test\n'); + assert.strictEqual(d, 'test\n'); called = true; }; @@ -48,7 +48,7 @@ c.error('test'); assert(called); out.write = function(d) { - assert.equal('{ foo: 1 }\n', d); + assert.strictEqual('{ foo: 1 }\n', d); called = true; }; @@ -60,10 +60,10 @@ assert(called); called = 0; out.write = function(d) { called++; - assert.equal(d, called + ' ' + (called - 1) + ' [ 1, 2, 3 ]\n'); + assert.strictEqual(d, called + ' ' + (called - 1) + ' [ 1, 2, 3 ]\n'); }; [1, 2, 3].forEach(c.log); -assert.equal(3, called); +assert.strictEqual(3, called); // Console() detects if it is called without `new` keyword assert.doesNotThrow(function() { diff --git a/test/parallel/test-dgram-msgsize.js b/test/parallel/test-dgram-msgsize.js index ec4021b99fd899..6cc415e83c00ca 100644 --- a/test/parallel/test-dgram-msgsize.js +++ b/test/parallel/test-dgram-msgsize.js @@ -1,18 +1,18 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var dgram = require('dgram'); +const common = require('../common'); +const assert = require('assert'); +const dgram = require('dgram'); // Send a too big datagram. The destination doesn't matter because it's // not supposed to get sent out anyway. -var buf = Buffer.allocUnsafe(256 * 1024); -var sock = dgram.createSocket('udp4'); +const buf = Buffer.allocUnsafe(256 * 1024); +const sock = dgram.createSocket('udp4'); sock.send(buf, 0, buf.length, 12345, '127.0.0.1', common.mustCall(cb)); function cb(err) { assert(err instanceof Error); - assert.equal(err.code, 'EMSGSIZE'); - assert.equal(err.address, '127.0.0.1'); - assert.equal(err.port, 12345); - assert.equal(err.message, 'send EMSGSIZE 127.0.0.1:12345'); + assert.strictEqual(err.code, 'EMSGSIZE'); + assert.strictEqual(err.address, '127.0.0.1'); + assert.strictEqual(err.port, 12345); + assert.strictEqual(err.message, 'send EMSGSIZE 127.0.0.1:12345'); sock.close(); } From 3b765cb231c66f122b53c52ca75437cc06383680 Mon Sep 17 00:00:00 2001 From: Uttam Pawar Date: Thu, 1 Dec 2016 08:19:10 -0800 Subject: [PATCH 130/313] test: use strictEqual instead of equal PR-URL: https://github.com/nodejs/node/pull/9921 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-debugger-util-regression.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-debugger-util-regression.js b/test/parallel/test-debugger-util-regression.js index 6378ea3e9b171c..07e52545814b14 100644 --- a/test/parallel/test-debugger-util-regression.js +++ b/test/parallel/test-debugger-util-regression.js @@ -46,8 +46,8 @@ proc.stdout.on('data', (data) => { proc.stderr.on('data', (data) => stderr += data); process.on('exit', (code) => { - assert.equal(code, 0, 'the program should exit cleanly'); - assert.equal(stdout.includes('{ a: \'b\' }'), true, - 'the debugger should print the result of util.inspect'); - assert.equal(stderr, '', 'stderr should be empty'); + assert.strictEqual(code, 0, 'the program should exit cleanly'); + assert.strictEqual(stdout.includes('{ a: \'b\' }'), true, + 'the debugger should print the result of util.inspect'); + assert.strictEqual(stderr, '', 'stderr should be empty'); }); From 8ce6dd2a57445fbf3e153a2bd2f318adfc7f552f Mon Sep 17 00:00:00 2001 From: Tracy Hinds Date: Thu, 1 Dec 2016 11:24:13 -0600 Subject: [PATCH 131/313] test: replace equal with strictEqual PR-URL: https://github.com/nodejs/node/pull/10011 Reviewed-By: Roman Reiss Reviewed-By: Myles Borins Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-domain-abort-on-uncaught.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-domain-abort-on-uncaught.js b/test/parallel/test-domain-abort-on-uncaught.js index 2a5eb804bc34ec..d61debc06067f6 100644 --- a/test/parallel/test-domain-abort-on-uncaught.js +++ b/test/parallel/test-domain-abort-on-uncaught.js @@ -227,7 +227,7 @@ if (process.argv[2] === 'child') { tests[testIndex](); process.on('exit', function onExit() { - assert.equal(errorHandlerCalled, true); + assert.strictEqual(errorHandlerCalled, true); }); } else { @@ -248,7 +248,7 @@ if (process.argv[2] === 'child') { var child = child_process.exec(testCmd); child.on('exit', function onExit(code, signal) { - assert.equal(code, 0, 'Test at index ' + testIndex + + assert.strictEqual(code, 0, 'Test at index ' + testIndex + ' should have exited with exit code 0 but instead exited with code ' + code + ' and signal ' + signal); }); From 09de7149f214e344fb51aec9f92353aec903b516 Mon Sep 17 00:00:00 2001 From: Matt Webb Date: Thu, 1 Dec 2016 10:36:05 -0600 Subject: [PATCH 132/313] test: refactor test-fs-read-stream-resume Update vars to const/let & equal to strictEqual. PR-URL: https://github.com/nodejs/node/pull/9927 Reviewed-By: Teddy Katz Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-fs-read-stream-resume.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-fs-read-stream-resume.js b/test/parallel/test-fs-read-stream-resume.js index abac0686c11944..3ff89644e5c018 100644 --- a/test/parallel/test-fs-read-stream-resume.js +++ b/test/parallel/test-fs-read-stream-resume.js @@ -1,13 +1,13 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); -var fs = require('fs'); -var path = require('path'); +const fs = require('fs'); +const path = require('path'); -var file = path.join(common.fixturesDir, 'x.txt'); -var data = ''; -var first = true; +const file = path.join(common.fixturesDir, 'x.txt'); +let data = ''; +let first = true; var stream = fs.createReadStream(file); stream.setEncoding('utf8'); @@ -27,5 +27,5 @@ process.nextTick(function() { }); process.on('exit', function() { - assert.equal(data, 'xyz\n'); + assert.strictEqual(data, 'xyz\n'); }); From 4a28eac54bab9d7d1c0f2dcab64e2449578c0403 Mon Sep 17 00:00:00 2001 From: Walter Beller-Morales Date: Thu, 1 Dec 2016 10:34:49 -0600 Subject: [PATCH 133/313] test: refactor test-fs-symlink-dir-junction * var -> const * assert.equal() -> assert.strictEqual() PR-URL: https://github.com/nodejs/node/pull/9928 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/parallel/test-fs-symlink-dir-junction.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-fs-symlink-dir-junction.js b/test/parallel/test-fs-symlink-dir-junction.js index 1dd3a903034102..58ddb7ca38ae1c 100644 --- a/test/parallel/test-fs-symlink-dir-junction.js +++ b/test/parallel/test-fs-symlink-dir-junction.js @@ -1,12 +1,12 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var path = require('path'); -var fs = require('fs'); +const common = require('../common'); +const assert = require('assert'); +const path = require('path'); +const fs = require('fs'); // test creating and reading symbolic link -var linkData = path.join(common.fixturesDir, 'cycles/'); -var linkPath = path.join(common.tmpDir, 'cycles_link'); +const linkData = path.join(common.fixturesDir, 'cycles/'); +const linkPath = path.join(common.tmpDir, 'cycles_link'); common.refreshTmpDir(); @@ -22,7 +22,7 @@ fs.symlink(linkData, linkPath, 'junction', common.mustCall(function(err) { fs.readlink(linkPath, common.mustCall(function(err, destination) { if (err) throw err; - assert.equal(destination, linkData); + assert.strictEqual(destination, linkData); fs.unlink(linkPath, common.mustCall(function(err) { if (err) throw err; From 75712a30322c98325d59db1701949be8ca4fc9f1 Mon Sep 17 00:00:00 2001 From: blugavere Date: Mon, 5 Dec 2016 00:03:15 -0500 Subject: [PATCH 134/313] test: refactor test-require-resolve * var => const * assert.equal() => assert.strictEqual() PR-URL: https://github.com/nodejs/node/pull/10120 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-require-resolve.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-require-resolve.js b/test/parallel/test-require-resolve.js index 13897c74da1752..202f3c5ef87f3d 100644 --- a/test/parallel/test-require-resolve.js +++ b/test/parallel/test-require-resolve.js @@ -1,18 +1,18 @@ 'use strict'; -var common = require('../common'); -var fixturesDir = common.fixturesDir; -var assert = require('assert'); -var path = require('path'); +const common = require('../common'); +const fixturesDir = common.fixturesDir; +const assert = require('assert'); +const path = require('path'); -assert.equal( +assert.strictEqual( path.join(__dirname, '../fixtures/a.js').toLowerCase(), require.resolve('../fixtures/a').toLowerCase()); -assert.equal( +assert.strictEqual( path.join(fixturesDir, 'a.js').toLowerCase(), require.resolve(path.join(fixturesDir, 'a')).toLowerCase()); -assert.equal( +assert.strictEqual( path.join(fixturesDir, 'nested-index', 'one', 'index.js').toLowerCase(), require.resolve('../fixtures/nested-index/one').toLowerCase()); -assert.equal('path', require.resolve('path')); +assert.strictEqual('path', require.resolve('path')); console.log('ok'); From 093adcac9ada4da33d641d8bda5344a9befff40c Mon Sep 17 00:00:00 2001 From: Punit Buch Date: Thu, 1 Dec 2016 10:16:49 -0600 Subject: [PATCH 135/313] test: update test-net-connect-handle-econnrefused * var -> const * assert.equal() -> assert.strictEqual() * assert.ok(false) -> common.fail() PR-URL: https://github.com/nodejs/node/pull/9932 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- .../test-net-connect-handle-econnrefused.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-net-connect-handle-econnrefused.js b/test/parallel/test-net-connect-handle-econnrefused.js index bbfb5c1bec1836..09b17ad29deb5e 100644 --- a/test/parallel/test-net-connect-handle-econnrefused.js +++ b/test/parallel/test-net-connect-handle-econnrefused.js @@ -1,18 +1,17 @@ 'use strict'; -var common = require('../common'); -var net = require('net'); -var assert = require('assert'); +const common = require('../common'); +const net = require('net'); +const assert = require('assert'); // Hopefully nothing is running on common.PORT -var c = net.createConnection(common.PORT); +const c = net.createConnection(common.PORT); c.on('connect', function() { - console.error('connected?!'); - assert.ok(false); + common.fail('connected?!'); }); c.on('error', common.mustCall(function(e) { console.error('couldn\'t connect.'); - assert.equal('ECONNREFUSED', e.code); + assert.strictEqual('ECONNREFUSED', e.code); })); From 75c37fa8a278294b44f63f1e593a8a0f6338f287 Mon Sep 17 00:00:00 2001 From: mark hughes Date: Thu, 1 Dec 2016 10:24:08 -0600 Subject: [PATCH 136/313] test: refactor test-signal-unregister * var -> const * assert.equal() -> assert.strictEqual() PR-URL: https://github.com/nodejs/node/pull/9920 Reviewed-By: Colin Ihrig Reviewed-By: Prince John Wesley Reviewed-By: Luigi Pinca --- test/parallel/test-signal-unregister.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-signal-unregister.js b/test/parallel/test-signal-unregister.js index b65ade73db9422..88c6a367a9cb37 100644 --- a/test/parallel/test-signal-unregister.js +++ b/test/parallel/test-signal-unregister.js @@ -1,13 +1,13 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var spawn = require('child_process').spawn; +const common = require('../common'); +const assert = require('assert'); +const spawn = require('child_process').spawn; -var child = spawn(process.argv[0], [common.fixturesDir + '/should_exit.js']); +const child = spawn(process.argv[0], [common.fixturesDir + '/should_exit.js']); child.stdout.once('data', function() { child.kill('SIGINT'); }); child.on('exit', common.mustCall(function(exitCode, signalCode) { - assert.equal(exitCode, null); - assert.equal(signalCode, 'SIGINT'); + assert.strictEqual(exitCode, null); + assert.strictEqual(signalCode, 'SIGINT'); })); From 2a514f20e1f74bd3d6c91cb47118ff0bcd97ddc2 Mon Sep 17 00:00:00 2001 From: Russell Sherman Date: Thu, 1 Dec 2016 10:15:03 -0600 Subject: [PATCH 137/313] test: refactor test-tls-connect-simple refactor var -> const/let refactor process.on('exit') into common.mustCall PR-URL: https://github.com/nodejs/node/pull/9934 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-tls-connect-simple.js | 51 +++++++++--------------- 1 file changed, 18 insertions(+), 33 deletions(-) diff --git a/test/parallel/test-tls-connect-simple.js b/test/parallel/test-tls-connect-simple.js index 5b18f7693ff7df..a6bcfcab519fdf 100644 --- a/test/parallel/test-tls-connect-simple.js +++ b/test/parallel/test-tls-connect-simple.js @@ -1,58 +1,43 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const tls = require('tls'); -var fs = require('fs'); +const fs = require('fs'); -var clientConnected = 0; -var serverConnected = 0; -var serverCloseCallbacks = 0; -var serverCloseEvents = 0; +let serverConnected = 0; -var options = { +const options = { key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem') }; -var server = tls.Server(options, function(socket) { +const server = tls.Server(options, common.mustCall(function(socket) { if (++serverConnected === 2) { - server.close(function() { - ++serverCloseCallbacks; - }); - server.on('close', function() { - ++serverCloseEvents; - }); + server.close(common.mustCall(function() {})); + server.on('close', common.mustCall(function() {})); } -}); +}, 2)); server.listen(0, function() { - var client1 = tls.connect({ + const client1options = { port: this.address().port, rejectUnauthorized: false - }, function() { - ++clientConnected; + }; + const client1 = tls.connect(client1options, common.mustCall(function() { client1.end(); - }); + })); - var client2 = tls.connect({ + const client2options = { port: this.address().port, rejectUnauthorized: false - }); - client2.on('secureConnect', function() { - ++clientConnected; + }; + const client2 = tls.connect(client2options); + client2.on('secureConnect', common.mustCall(function() { client2.end(); - }); -}); - -process.on('exit', function() { - assert.equal(clientConnected, 2); - assert.equal(serverConnected, 2); - assert.equal(serverCloseCallbacks, 1); - assert.equal(serverCloseEvents, 1); + })); }); From 050bae63f14d62f0f2b1873199f80e7134c07488 Mon Sep 17 00:00:00 2001 From: Nigel Kibodeaux Date: Thu, 1 Dec 2016 10:18:15 -0600 Subject: [PATCH 138/313] test: use assert.strictEqual in test-cli-eval PR-URL: https://github.com/nodejs/node/pull/9919 Reviewed-By: Teddy Katz Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-cli-eval.js | 35 +++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/test/parallel/test-cli-eval.js b/test/parallel/test-cli-eval.js index 3c38afd2ac4524..0198a0f1beda48 100644 --- a/test/parallel/test-cli-eval.js +++ b/test/parallel/test-cli-eval.js @@ -19,15 +19,15 @@ var filename = __filename.replace(/\\/g, '/'); // assert that nothing is written to stdout child.exec(nodejs + ' --eval 42', function(err, stdout, stderr) { - assert.equal(stdout, ''); - assert.equal(stderr, ''); + assert.strictEqual(stdout, ''); + assert.strictEqual(stderr, ''); }); // assert that "42\n" is written to stderr child.exec(nodejs + ' --eval "console.error(42)"', function(err, stdout, stderr) { - assert.equal(stdout, ''); - assert.equal(stderr, '42\n'); + assert.strictEqual(stdout, ''); + assert.strictEqual(stderr, '42\n'); }); // assert that the expected output is written to stdout @@ -36,21 +36,21 @@ child.exec(nodejs + ' --eval "console.error(42)"', child.exec(cmd + '42', function(err, stdout, stderr) { - assert.equal(stdout, '42\n'); - assert.equal(stderr, ''); + assert.strictEqual(stdout, '42\n'); + assert.strictEqual(stderr, ''); }); child.exec(cmd + "'[]'", common.mustCall( function(err, stdout, stderr) { - assert.equal(stdout, '[]\n'); - assert.equal(stderr, ''); + assert.strictEqual(stdout, '[]\n'); + assert.strictEqual(stderr, ''); })); }); // assert that module loading works child.exec(nodejs + ' --eval "require(\'' + filename + '\')"', function(status, stdout, stderr) { - assert.equal(status.code, 42); + assert.strictEqual(status.code, 42); }); // Check that builtin modules are pre-defined. @@ -63,7 +63,7 @@ child.exec(nodejs + ' --print "os.platform()"', // module path resolve bug, regression test child.exec(nodejs + ' --eval "require(\'./test/parallel/test-cli-eval.js\')"', function(status, stdout, stderr) { - assert.equal(status.code, 42); + assert.strictEqual(status.code, 42); }); // Missing argument should not crash @@ -74,28 +74,29 @@ child.exec(nodejs + ' -e', common.mustCall(function(status, stdout, stderr) { // empty program should do nothing child.exec(nodejs + ' -e ""', function(status, stdout, stderr) { - assert.equal(stdout, ''); - assert.equal(stderr, ''); + assert.strictEqual(stdout, ''); + assert.strictEqual(stderr, ''); }); // "\\-42" should be interpreted as an escaped expression, not a switch child.exec(nodejs + ' -p "\\-42"', function(err, stdout, stderr) { - assert.equal(stdout, '-42\n'); - assert.equal(stderr, ''); + assert.strictEqual(stdout, '-42\n'); + assert.strictEqual(stderr, ''); }); child.exec(nodejs + ' --use-strict -p process.execArgv', function(status, stdout, stderr) { - assert.equal(stdout, "[ '--use-strict', '-p', 'process.execArgv' ]\n"); + assert.strictEqual(stdout, + "[ '--use-strict', '-p', 'process.execArgv' ]\n"); }); // Regression test for https://github.com/nodejs/node/issues/3574 const emptyFile = path.join(common.fixturesDir, 'empty.js'); child.exec(nodejs + ` -e 'require("child_process").fork("${emptyFile}")'`, function(status, stdout, stderr) { - assert.equal(stdout, ''); - assert.equal(stderr, ''); + assert.strictEqual(stdout, ''); + assert.strictEqual(stderr, ''); }); // Regression test for https://github.com/nodejs/node/issues/8534. From c506b7be90967f001b3d829533c2894e43f1091f Mon Sep 17 00:00:00 2001 From: hirabhullar Date: Thu, 1 Dec 2016 09:01:51 -0800 Subject: [PATCH 139/313] test: refactor test-child-fork-exec-path.js Changed equal to strictEqual PR-URL: https://github.com/nodejs/node/pull/9982 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-child-process-fork-exec-path.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-child-process-fork-exec-path.js b/test/parallel/test-child-process-fork-exec-path.js index e42b72f2b85886..e2f7e4b4d20eef 100644 --- a/test/parallel/test-child-process-fork-exec-path.js +++ b/test/parallel/test-child-process-fork-exec-path.js @@ -9,7 +9,7 @@ var copyPath = path.join(common.tmpDir, 'node-copy.exe'); if (process.env.FORK) { assert(process.send); - assert.equal(process.argv[0], copyPath); + assert.strictEqual(process.argv[0], copyPath); process.send(msg); process.exit(); } else { @@ -34,6 +34,6 @@ if (process.env.FORK) { })); child.on('exit', common.mustCall(function(code) { fs.unlinkSync(copyPath); - assert.equal(code, 0); + assert.strictEqual(code, 0); })); } From b893dc986cef86772af3a64676c2fc06a9968fac Mon Sep 17 00:00:00 2001 From: hirabhullar Date: Thu, 1 Dec 2016 09:34:21 -0800 Subject: [PATCH 140/313] test: refactor test-fs-write.js Changed var to const and equal to strictEqual PR-URL: https://github.com/nodejs/node/pull/9982 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-fs-write.js | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/parallel/test-fs-write.js b/test/parallel/test-fs-write.js index 766cb0b2cea1d2..9960a91a4f7515 100644 --- a/test/parallel/test-fs-write.js +++ b/test/parallel/test-fs-write.js @@ -1,13 +1,13 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var path = require('path'); -var Buffer = require('buffer').Buffer; -var fs = require('fs'); -var fn = path.join(common.tmpDir, 'write.txt'); -var fn2 = path.join(common.tmpDir, 'write2.txt'); -var expected = 'ümlaut.'; -var constants = fs.constants; +const common = require('../common'); +const assert = require('assert'); +const path = require('path'); +const Buffer = require('buffer').Buffer; +const fs = require('fs'); +const fn = path.join(common.tmpDir, 'write.txt'); +const fn2 = path.join(common.tmpDir, 'write2.txt'); +const expected = 'ümlaut.'; +const constants = fs.constants; common.refreshTmpDir(); @@ -15,12 +15,12 @@ fs.open(fn, 'w', 0o644, common.mustCall(function(err, fd) { if (err) throw err; console.log('open done'); fs.write(fd, '', 0, 'utf8', function(err, written) { - assert.equal(0, written); + assert.strictEqual(0, written); }); fs.write(fd, expected, 0, 'utf8', common.mustCall(function(err, written) { console.log('write done'); if (err) throw err; - assert.equal(Buffer.byteLength(expected), written); + assert.strictEqual(Buffer.byteLength(expected), written); fs.closeSync(fd); const found = fs.readFileSync(fn, 'utf8'); console.log('expected: "%s"', expected); @@ -36,12 +36,12 @@ fs.open(fn2, constants.O_CREAT | constants.O_WRONLY | constants.O_TRUNC, 0o644, if (err) throw err; console.log('open done'); fs.write(fd, '', 0, 'utf8', (err, written) => { - assert.equal(0, written); + assert.strictEqual(0, written); }); fs.write(fd, expected, 0, 'utf8', common.mustCall((err, written) => { console.log('write done'); if (err) throw err; - assert.equal(Buffer.byteLength(expected), written); + assert.strictEqual(Buffer.byteLength(expected), written); fs.closeSync(fd); const found = fs.readFileSync(fn2, 'utf8'); console.log('expected: "%s"', expected); From 230d552a85104cf3f42caf4d9c2b609dbb58187f Mon Sep 17 00:00:00 2001 From: Wes Tyler Date: Thu, 1 Dec 2016 10:56:14 -0600 Subject: [PATCH 141/313] test: refactor test-domain-multi Replace assert.equal() with assert.strictEqual(). PR-URL: https://github.com/nodejs/node/pull/9963 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Evan Lucas --- test/parallel/test-domain-multi.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-domain-multi.js b/test/parallel/test-domain-multi.js index 1b0af1dd3f438f..cf85dbca460146 100644 --- a/test/parallel/test-domain-multi.js +++ b/test/parallel/test-domain-multi.js @@ -70,8 +70,8 @@ var server = http.createServer(function(req, res) { }); process.on('exit', function() { - assert.equal(caughtA, false); - assert.equal(caughtB, true); - assert.equal(caughtC, true); + assert.strictEqual(caughtA, false); + assert.strictEqual(caughtB, true); + assert.strictEqual(caughtC, true); console.log('ok - Errors went where they were supposed to go'); }); From 223ec1708002ed5289ed77d4c8d36805a226f786 Mon Sep 17 00:00:00 2001 From: Paul Chin Date: Thu, 1 Dec 2016 10:59:49 -0600 Subject: [PATCH 142/313] test: changed assert.Equal to asset.strictEqual test-dgram-send-callback-recursive.js PR-URL: https://github.com/nodejs/node/pull/9973 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Jeremiah Senkpiel --- test/parallel/test-dgram-send-callback-recursive.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-dgram-send-callback-recursive.js b/test/parallel/test-dgram-send-callback-recursive.js index c54b05c3f86ba1..bca888a46785e9 100644 --- a/test/parallel/test-dgram-send-callback-recursive.js +++ b/test/parallel/test-dgram-send-callback-recursive.js @@ -37,7 +37,7 @@ client.on('message', function(buf, info) { }); client.on('close', common.mustCall(function() { - assert.equal(received, limit); + assert.strictEqual(received, limit); })); client.bind(0); From 626d59f7a63baef7e9a6b143f0e0f104b901a2a5 Mon Sep 17 00:00:00 2001 From: scalkpdev Date: Thu, 1 Dec 2016 10:42:27 -0600 Subject: [PATCH 143/313] test: update test-stdout-to-file * changed vars to const * changed assert.equal to assert.strictEqual * added a common.mustCall in the childProcess.exec callback * replaced 2 console.log strings with template strings for readability * had to break up line 9 because it was causing a line max length (80) listing err PR-URL: https://github.com/nodejs/node/pull/9939 Reviewed-By: Prince John Wesley Reviewed-By: James M Snell --- test/parallel/test-stdout-to-file.js | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/test/parallel/test-stdout-to-file.js b/test/parallel/test-stdout-to-file.js index 5dce369aadb52e..10391c481a826d 100644 --- a/test/parallel/test-stdout-to-file.js +++ b/test/parallel/test-stdout-to-file.js @@ -1,13 +1,14 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var path = require('path'); -var childProcess = require('child_process'); -var fs = require('fs'); +const common = require('../common'); +const assert = require('assert'); +const path = require('path'); +const childProcess = require('child_process'); +const fs = require('fs'); -var scriptString = path.join(common.fixturesDir, 'print-chars.js'); -var scriptBuffer = path.join(common.fixturesDir, 'print-chars-from-buffer.js'); -var tmpFile = path.join(common.tmpDir, 'stdout.txt'); +const scriptString = path.join(common.fixturesDir, 'print-chars.js'); +const scriptBuffer = path.join(common.fixturesDir, + 'print-chars-from-buffer.js'); +const tmpFile = path.join(common.tmpDir, 'stdout.txt'); common.refreshTmpDir(); @@ -24,22 +25,22 @@ function test(size, useBuffer, cb) { fs.unlinkSync(tmpFile); } catch (e) {} - console.log(size + ' chars to ' + tmpFile + '...'); + console.log(`${size} chars to ${tmpFile}...`); - childProcess.exec(cmd, function(err) { + childProcess.exec(cmd, common.mustCall(function(err) { if (err) throw err; console.log('done!'); var stat = fs.statSync(tmpFile); - console.log(tmpFile + ' has ' + stat.size + ' bytes'); + console.log(`${tmpFile} has ${stat.size} bytes`); - assert.equal(size, stat.size); + assert.strictEqual(size, stat.size); fs.unlinkSync(tmpFile); cb(); - }); + })); } test(1024 * 1024, false, common.mustCall(function() { From f4c8044007b710858b25ba509e373b1c970cfcdf Mon Sep 17 00:00:00 2001 From: Danny Guo Date: Thu, 1 Dec 2016 10:41:38 -0600 Subject: [PATCH 144/313] test: clean up tls junk test PR-URL: https://github.com/nodejs/node/pull/9940 Reviewed-By: James M Snell --- test/parallel/test-tls-junk-closes-server.js | 30 +++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/test/parallel/test-tls-junk-closes-server.js b/test/parallel/test-tls-junk-closes-server.js index f12393515cbe47..38f90498f84e92 100644 --- a/test/parallel/test-tls-junk-closes-server.js +++ b/test/parallel/test-tls-junk-closes-server.js @@ -1,34 +1,30 @@ 'use strict'; -var common = require('../common'); +const common = require('../common'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); -var fs = require('fs'); -var net = require('net'); +const tls = require('tls'); +const fs = require('fs'); +const net = require('net'); -var options = { +const options = { key: fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'), cert: fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem') }; -var server = tls.createServer(options, function(s) { - s.write('welcome!\n'); - s.pipe(s); -}); +const server = tls.createServer(options, common.fail); -server.listen(0, function() { - var c = net.createConnection(this.address().port); +server.listen(0, common.mustCall(function() { + const c = net.createConnection(this.address().port); - c.on('connect', function() { + c.on('connect', common.mustCall(function() { c.write('blah\nblah\nblah\n'); - }); + })); - c.on('end', function() { + c.on('end', common.mustCall(function() { server.close(); - }); - -}); + })); +})); From 78b5a8d5c2eb4c1c28dd7b3bff5c85fba34e6a7f Mon Sep 17 00:00:00 2001 From: Matt Phillips Date: Thu, 1 Dec 2016 10:38:53 -0600 Subject: [PATCH 145/313] test: use assert.strictEqual and fix setTimeout Changes assert.equal to assert.strictEqual in two places and adds a second argument of 0 to setTimeout PR-URL: https://github.com/nodejs/node/pull/9957 Reviewed-By: James M Snell --- test/parallel/test-domain-timers.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-domain-timers.js b/test/parallel/test-domain-timers.js index faa57df1277083..d42afa7471791a 100644 --- a/test/parallel/test-domain-timers.js +++ b/test/parallel/test-domain-timers.js @@ -8,21 +8,22 @@ var timeout; var timeoutd = domain.create(); timeoutd.on('error', common.mustCall(function(e) { - assert.equal(e.message, 'Timeout UNREFd', 'Domain should catch timer error'); + assert.strictEqual(e.message, 'Timeout UNREFd', + 'Domain should catch timer error'); clearTimeout(timeout); })); timeoutd.run(function() { setTimeout(function() { throw new Error('Timeout UNREFd'); - }).unref(); + }, 0).unref(); }); var immediated = domain.create(); immediated.on('error', common.mustCall(function(e) { - assert.equal(e.message, 'Immediate Error', - 'Domain should catch immediate error'); + assert.strictEqual(e.message, 'Immediate Error', + 'Domain should catch immediate error'); })); immediated.run(function() { From cdb803d18b69e6356d25b65c8fcc27dc7fa27e6f Mon Sep 17 00:00:00 2001 From: k3kathy Date: Thu, 1 Dec 2016 10:16:42 -0600 Subject: [PATCH 146/313] test: refactor test-tls-ocsp-callback refactor all var to either const/let change all assert.equal to assert.strictEqual change all assert.ok(...===...) to assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/9970 Reviewed-By: Prince John Wesley Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-tls-ocsp-callback.js | 54 ++++++++++++------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/test/parallel/test-tls-ocsp-callback.js b/test/parallel/test-tls-ocsp-callback.js index 442f54791a0f54..c008613c2ccf9f 100644 --- a/test/parallel/test-tls-ocsp-callback.js +++ b/test/parallel/test-tls-ocsp-callback.js @@ -1,5 +1,5 @@ 'use strict'; -var common = require('../common'); +const common = require('../common'); if (!process.features.tls_ocsp) { common.skip('node compiled without OpenSSL or ' + @@ -15,33 +15,33 @@ if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const tls = require('tls'); -var assert = require('assert'); -var fs = require('fs'); -var join = require('path').join; +const assert = require('assert'); +const fs = require('fs'); +const join = require('path').join; const SSL_OP_NO_TICKET = require('crypto').constants.SSL_OP_NO_TICKET; -var pfx = fs.readFileSync(join(common.fixturesDir, 'keys', 'agent1-pfx.pem')); +const pfx = fs.readFileSync(join(common.fixturesDir, 'keys', 'agent1-pfx.pem')); function test(testOptions, cb) { - var keyFile = join(common.fixturesDir, 'keys', 'agent1-key.pem'); - var certFile = join(common.fixturesDir, 'keys', 'agent1-cert.pem'); - var caFile = join(common.fixturesDir, 'keys', 'ca1-cert.pem'); - var key = fs.readFileSync(keyFile); - var cert = fs.readFileSync(certFile); - var ca = fs.readFileSync(caFile); - var options = { + const keyFile = join(common.fixturesDir, 'keys', 'agent1-key.pem'); + const certFile = join(common.fixturesDir, 'keys', 'agent1-cert.pem'); + const caFile = join(common.fixturesDir, 'keys', 'ca1-cert.pem'); + const key = fs.readFileSync(keyFile); + const cert = fs.readFileSync(certFile); + const ca = fs.readFileSync(caFile); + const options = { key: key, cert: cert, ca: [ca] }; - var requestCount = 0; - var clientSecure = 0; - var ocspCount = 0; - var ocspResponse; + let requestCount = 0; + let clientSecure = 0; + let ocspCount = 0; + let ocspResponse; if (testOptions.pfx) { delete options.key; @@ -50,7 +50,7 @@ function test(testOptions, cb) { options.passphrase = testOptions.passphrase; } - var server = tls.createServer(options, function(cleartext) { + const server = tls.createServer(options, function(cleartext) { cleartext.on('error', function(er) { // We're ok with getting ECONNRESET in this test, but it's // timing-dependent, and thus unreliable. Any other errors @@ -73,7 +73,7 @@ function test(testOptions, cb) { }, 100); }); server.listen(0, function() { - var client = tls.connect({ + const client = tls.connect({ port: this.address().port, requestOCSP: testOptions.ocsp !== false, secureOptions: testOptions.ocsp === false ? @@ -94,23 +94,23 @@ function test(testOptions, cb) { process.on('exit', function() { if (testOptions.ocsp === false) { - assert.equal(requestCount, clientSecure); - assert.equal(requestCount, 1); + assert.strictEqual(requestCount, clientSecure); + assert.strictEqual(requestCount, 1); return; } if (testOptions.response) { - assert.equal(ocspResponse.toString(), testOptions.response); + assert.strictEqual(ocspResponse.toString(), testOptions.response); } else { - assert.ok(ocspResponse === null); + assert.strictEqual(ocspResponse, null); } - assert.equal(requestCount, testOptions.response ? 0 : 1); - assert.equal(clientSecure, requestCount); - assert.equal(ocspCount, 1); + assert.strictEqual(requestCount, testOptions.response ? 0 : 1); + assert.strictEqual(clientSecure, requestCount); + assert.strictEqual(ocspCount, 1); }); } -var tests = [ +const tests = [ { response: false }, { response: 'hello world' }, { ocsp: false } From d64cb1e04eb769ddf8653676131b8585b2719d27 Mon Sep 17 00:00:00 2001 From: Daryl Thayil Date: Thu, 1 Dec 2016 10:20:41 -0600 Subject: [PATCH 147/313] test: refactor test-require-extensions-main * var => const * assert test fixtures PR-URL: https://github.com/nodejs/node/pull/9912 Reviewed-By: James M Snell Reviewed-By: Franziska Hinkelmann --- test/parallel/test-require-extensions-main.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-require-extensions-main.js b/test/parallel/test-require-extensions-main.js index 0376082262dd78..e8420cd26cd512 100644 --- a/test/parallel/test-require-extensions-main.js +++ b/test/parallel/test-require-extensions-main.js @@ -1,4 +1,10 @@ 'use strict'; -var common = require('../common'); +const assert = require('assert'); +const common = require('../common'); +const fixturesRequire = require(`${common.fixturesDir}/require-bin/bin/req.js`); -require(common.fixturesDir + '/require-bin/bin/req.js'); +assert.strictEqual( + fixturesRequire, + '', + 'test-require-extensions-main failed to import fixture requirements' +); From fed9acd8af6772f35874923e18a41b254538b90c Mon Sep 17 00:00:00 2001 From: Deepti Agrawal Date: Thu, 1 Dec 2016 10:37:13 -0600 Subject: [PATCH 148/313] test: update parallel/test-crypto-hash.js changed equal to strictEqual in parallel/test-crypto-hash.js. Added a second regex argument to the assert.throws function. PR-URL: https://github.com/nodejs/node/pull/10009 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Jeremiah Senkpiel --- test/parallel/test-crypto-hash.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js index 81ee1d60c53977..9e212443453203 100644 --- a/test/parallel/test-crypto-hash.js +++ b/test/parallel/test-crypto-hash.js @@ -39,15 +39,15 @@ a8 = a8.read(); if (!common.hasFipsCrypto) { var a0 = crypto.createHash('md5').update('Test123').digest('latin1'); - assert.equal( + assert.strictEqual( a0, 'h\u00ea\u00cb\u0097\u00d8o\fF!\u00fa+\u000e\u0017\u00ca\u00bd\u008c', 'Test MD5 as latin1' ); } -assert.equal(a1, '8308651804facb7b9af8ffc53a33a22d6a1c8ac2', 'Test SHA1'); -assert.equal(a2, '2bX1jws4GYKTlxhloUB09Z66PoJZW+y+hq5R8dnx9l4=', - 'Test SHA256 as base64'); +assert.strictEqual(a1, '8308651804facb7b9af8ffc53a33a22d6a1c8ac2', 'Test SHA1'); +assert.strictEqual(a2, '2bX1jws4GYKTlxhloUB09Z66PoJZW+y+hq5R8dnx9l4=', + 'Test SHA256 as base64'); assert.deepStrictEqual( a3, Buffer.from( @@ -73,7 +73,7 @@ assert.notEqual(a8, undefined, 'empty string should generate data'); // Test multiple updates to same hash var h1 = crypto.createHash('sha1').update('Test123').digest('hex'); var h2 = crypto.createHash('sha1').update('Test').update('123').digest('hex'); -assert.equal(h1, h2, 'multipled updates'); +assert.strictEqual(h1, h2, 'multipled updates'); // Test hashing for binary files var fn = path.join(common.fixturesDir, 'sample.png'); @@ -83,19 +83,19 @@ fileStream.on('data', function(data) { sha1Hash.update(data); }); fileStream.on('close', function() { - assert.equal(sha1Hash.digest('hex'), - '22723e553129a336ad96e10f6aecdf0f45e4149e', - 'Test SHA1 of sample.png'); + assert.strictEqual(sha1Hash.digest('hex'), + '22723e553129a336ad96e10f6aecdf0f45e4149e', + 'Test SHA1 of sample.png'); }); // Issue #2227: unknown digest method should throw an error. assert.throws(function() { crypto.createHash('xyzzy'); -}); +}, /Digest method not supported/); // Default UTF-8 encoding var hutf8 = crypto.createHash('sha512').update('УТФ-8 text').digest('hex'); -assert.equal( +assert.strictEqual( hutf8, '4b21bbd1a68e690a730ddcb5a8bc94ead9879ffe82580767ad7ec6fa8ba2dea6' + '43a821af66afa9a45b6a78c712fecf0e56dc7f43aef4bcfc8eb5b4d8dca6ea5b'); From dd4586bd4127a346d0175ed4b2050558b57184a1 Mon Sep 17 00:00:00 2001 From: joyeecheung Date: Thu, 1 Dec 2016 10:33:24 -0600 Subject: [PATCH 149/313] test: fix test for buffer regression #649 pass a regexp to assert.throws() PR-URL: https://github.com/nodejs/node/pull/9924 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/parallel/test-buffer-regression-649.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-buffer-regression-649.js b/test/parallel/test-buffer-regression-649.js index b11e4a50e5d447..ab7228e84c1c13 100644 --- a/test/parallel/test-buffer-regression-649.js +++ b/test/parallel/test-buffer-regression-649.js @@ -6,8 +6,13 @@ const SlowBuffer = require('buffer').SlowBuffer; // Regression test for https://github.com/nodejs/node/issues/649. const len = 1422561062959; -assert.throws(() => Buffer(len).toString('utf8')); -assert.throws(() => SlowBuffer(len).toString('utf8')); -assert.throws(() => Buffer.alloc(len).toString('utf8')); -assert.throws(() => Buffer.allocUnsafe(len).toString('utf8')); -assert.throws(() => Buffer.allocUnsafeSlow(len).toString('utf8')); +const lenLimitMsg = new RegExp('^RangeError: (Invalid typed array length' + + '|Array buffer allocation failed' + + '|Invalid array buffer length)$'); + +assert.throws(() => Buffer(len).toString('utf8'), lenLimitMsg); +assert.throws(() => SlowBuffer(len).toString('utf8'), lenLimitMsg); +assert.throws(() => Buffer.alloc(len).toString('utf8'), lenLimitMsg); +assert.throws(() => Buffer.allocUnsafe(len).toString('utf8'), lenLimitMsg); +assert.throws(() => Buffer.allocUnsafeSlow(len).toString('utf8'), + lenLimitMsg); From 9af076e97d1dc6045a3d41444ee9e4d3b391a3b1 Mon Sep 17 00:00:00 2001 From: Jason Humphrey Date: Thu, 1 Dec 2016 10:22:34 -0600 Subject: [PATCH 150/313] test: use ES6 to update let & const Also updating assertStrict and moving the assert required. PR-URL: https://github.com/nodejs/node/pull/9917 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Franziska Hinkelmann --- .../test-child-process-stdout-flush-exit.js | 16 ++++----- test/parallel/test-crypto-cipher-decipher.js | 36 +++++++++---------- test/parallel/test-https-timeout-server.js | 16 ++++----- test/parallel/test-tls-on-empty-socket.js | 20 +++++------ 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/test/parallel/test-child-process-stdout-flush-exit.js b/test/parallel/test-child-process-stdout-flush-exit.js index b76a7cb5e5a8e2..9db74b51ce5864 100644 --- a/test/parallel/test-child-process-stdout-flush-exit.js +++ b/test/parallel/test-child-process-stdout-flush-exit.js @@ -1,23 +1,23 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); // if child process output to console and exit if (process.argv[2] === 'child') { console.log('hello'); - for (var i = 0; i < 200; i++) { + for (let i = 0; i < 200; i++) { console.log('filler'); } console.log('goodbye'); process.exit(0); } else { // parent process - var spawn = require('child_process').spawn; + const spawn = require('child_process').spawn; // spawn self as child - var child = spawn(process.argv[0], [process.argv[1], 'child']); + const child = spawn(process.argv[0], [process.argv[1], 'child']); - var stdout = ''; + let stdout = ''; child.stderr.setEncoding('utf8'); child.stderr.on('data', function(data) { @@ -32,7 +32,7 @@ if (process.argv[2] === 'child') { }); child.on('close', common.mustCall(function() { - assert.equal(stdout.slice(0, 6), 'hello\n'); - assert.equal(stdout.slice(stdout.length - 8), 'goodbye\n'); + assert.strictEqual(stdout.slice(0, 6), 'hello\n'); + assert.strictEqual(stdout.slice(stdout.length - 8), 'goodbye\n'); })); } diff --git a/test/parallel/test-crypto-cipher-decipher.js b/test/parallel/test-crypto-cipher-decipher.js index 5ea6d3899561a6..aa40e1766b9d73 100644 --- a/test/parallel/test-crypto-cipher-decipher.js +++ b/test/parallel/test-crypto-cipher-decipher.js @@ -1,6 +1,5 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); if (!common.hasCrypto) { common.skip('missing crypto'); @@ -10,21 +9,22 @@ if (common.hasFipsCrypto) { common.skip('not supported in FIPS mode'); return; } -var crypto = require('crypto'); +const crypto = require('crypto'); +const assert = require('assert'); function testCipher1(key) { // Test encryption and decryption - var plaintext = 'Keep this a secret? No! Tell everyone about node.js!'; - var cipher = crypto.createCipher('aes192', key); + const plaintext = 'Keep this a secret? No! Tell everyone about node.js!'; + const cipher = crypto.createCipher('aes192', key); // encrypt plaintext which is in utf8 format // to a ciphertext which will be in hex - var ciph = cipher.update(plaintext, 'utf8', 'hex'); + let ciph = cipher.update(plaintext, 'utf8', 'hex'); // Only use binary or hex, not base64. ciph += cipher.final('hex'); - var decipher = crypto.createDecipher('aes192', key); - var txt = decipher.update(ciph, 'hex', 'utf8'); + const decipher = crypto.createDecipher('aes192', key); + let txt = decipher.update(ciph, 'hex', 'utf8'); txt += decipher.final('utf8'); assert.strictEqual(txt, plaintext, 'encryption and decryption'); @@ -33,11 +33,11 @@ function testCipher1(key) { // NB: In real life, it's not guaranteed that you can get all of it // in a single read() like this. But in this case, we know it's // quite small, so there's no harm. - var cStream = crypto.createCipher('aes192', key); + const cStream = crypto.createCipher('aes192', key); cStream.end(plaintext); ciph = cStream.read(); - var dStream = crypto.createDecipher('aes192', key); + const dStream = crypto.createDecipher('aes192', key); dStream.end(ciph); txt = dStream.read().toString('utf8'); @@ -48,19 +48,19 @@ function testCipher1(key) { function testCipher2(key) { // encryption and decryption with Base64 // reported in https://github.com/joyent/node/issues/738 - var plaintext = + const plaintext = '32|RmVZZkFUVmpRRkp0TmJaUm56ZU9qcnJkaXNNWVNpTTU*|iXmckfRWZBGWWELw' + 'eCBsThSsfUHLeRe0KCsK8ooHgxie0zOINpXxfZi/oNG7uq9JWFVCk70gfzQH8ZUJ' + 'jAfaFg**'; - var cipher = crypto.createCipher('aes256', key); + const cipher = crypto.createCipher('aes256', key); // encrypt plaintext which is in utf8 format // to a ciphertext which will be in Base64 - var ciph = cipher.update(plaintext, 'utf8', 'base64'); + let ciph = cipher.update(plaintext, 'utf8', 'base64'); ciph += cipher.final('base64'); - var decipher = crypto.createDecipher('aes256', key); - var txt = decipher.update(ciph, 'base64', 'utf8'); + const decipher = crypto.createDecipher('aes256', key); + let txt = decipher.update(ciph, 'base64', 'utf8'); txt += decipher.final('utf8'); assert.strictEqual(txt, plaintext, 'encryption and decryption with Base64'); @@ -119,12 +119,12 @@ testCipher2(Buffer.from('0123456789abcdef')); const key = '0123456789abcdef'; const plaintext = 'Top secret!!!'; const c = crypto.createCipher('aes192', key); - var ciph = c.update(plaintext, 'utf16le', 'base64'); + let ciph = c.update(plaintext, 'utf16le', 'base64'); ciph += c.final('base64'); - var decipher = crypto.createDecipher('aes192', key); + let decipher = crypto.createDecipher('aes192', key); - var txt; + let txt; assert.doesNotThrow(() => txt = decipher.update(ciph, 'base64', 'ucs2')); assert.doesNotThrow(() => txt += decipher.final('ucs2')); assert.strictEqual(txt, plaintext, 'decrypted result in ucs2'); diff --git a/test/parallel/test-https-timeout-server.js b/test/parallel/test-https-timeout-server.js index 92b06f1495ddbf..04ccf0a64d2d7c 100644 --- a/test/parallel/test-https-timeout-server.js +++ b/test/parallel/test-https-timeout-server.js @@ -1,29 +1,29 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var https = require('https'); +const assert = require('assert'); +const https = require('https'); -var net = require('net'); -var fs = require('fs'); +const net = require('net'); +const fs = require('fs'); -var options = { +const options = { key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'), handshakeTimeout: 50 }; -var server = https.createServer(options, common.fail); +const server = https.createServer(options, common.fail); server.on('clientError', common.mustCall(function(err, conn) { // Don't hesitate to update the asserts if the internal structure of // the cleartext object ever changes. We're checking that the https.Server // has closed the client connection. - assert.equal(conn._secureEstablished, false); + assert.strictEqual(conn._secureEstablished, false); server.close(); conn.destroy(); })); diff --git a/test/parallel/test-tls-on-empty-socket.js b/test/parallel/test-tls-on-empty-socket.js index 58bc101333a583..84e27c5dd3067e 100644 --- a/test/parallel/test-tls-on-empty-socket.js +++ b/test/parallel/test-tls-on-empty-socket.js @@ -1,27 +1,27 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const assert = require('assert'); +const tls = require('tls'); -var fs = require('fs'); -var net = require('net'); +const fs = require('fs'); +const net = require('net'); -var out = ''; +let out = ''; -var server = tls.createServer({ +const server = tls.createServer({ key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem') }, function(c) { c.end('hello'); }).listen(0, function() { - var socket = new net.Socket(); + const socket = new net.Socket(); - var s = tls.connect({ + const s = tls.connect({ socket: socket, rejectUnauthorized: false }, function() { @@ -38,5 +38,5 @@ var server = tls.createServer({ }); process.on('exit', function() { - assert.equal(out, 'hello'); + assert.strictEqual(out, 'hello'); }); From 7c929591c1be5ded1b147af2276ff272738ece14 Mon Sep 17 00:00:00 2001 From: amrios Date: Thu, 1 Dec 2016 11:31:30 -0600 Subject: [PATCH 151/313] test: refactor test-stdin-from-file.js change var to const/let wrap common.mustCall on childProcess.exec callback remove unneeded fs.unlinkSync() refactor assert.equal to assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/10012 Reviewed-By: James M Snell Reviewed-By: Jeremiah Senkpiel --- test/parallel/test-stdin-from-file.js | 58 +++++++++++++-------------- 1 file changed, 27 insertions(+), 31 deletions(-) diff --git a/test/parallel/test-stdin-from-file.js b/test/parallel/test-stdin-from-file.js index d6e3afeae6fdee..f3a78192e5e5aa 100644 --- a/test/parallel/test-stdin-from-file.js +++ b/test/parallel/test-stdin-from-file.js @@ -1,44 +1,40 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var join = require('path').join; -var childProcess = require('child_process'); -var fs = require('fs'); - -var stdoutScript = join(common.fixturesDir, 'echo-close-check.js'); -var tmpFile = join(common.tmpDir, 'stdin.txt'); - -var cmd = '"' + process.argv[0] + '" "' + stdoutScript + '" < "' + - tmpFile + '"'; - -var string = 'abc\nümlaut.\nsomething else\n' + - '南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,' + - '疆域包括今天中国的广东、广西两省区的大部份地区,福建省、湖南、贵州、' + - '云南的一小部份地区和越南的北部。南越国是秦朝灭亡后,' + - '由南海郡尉赵佗于前203年起兵兼并桂林郡和象郡后建立。前196年和前179年,' + - '南越国曾先后两次名义上臣属于西汉,成为西汉的“外臣”。前112年,' + - '南越国末代君主赵建德与西汉发生战争,被汉武帝于前111年所灭。南越国共存在93年,' + - '历经五代君主。南越国是岭南地区的第一个有记载的政权国家,' + - '采用封建制和郡县制并存的制度,' + - '它的建立保证了秦末乱世岭南地区社会秩序的稳定,' + - '有效的改善了岭南地区落后的政治、##济现状。\n'; +const common = require('../common'); +const assert = require('assert'); +const join = require('path').join; +const childProcess = require('child_process'); +const fs = require('fs'); + +const stdoutScript = join(common.fixturesDir, 'echo-close-check.js'); +const tmpFile = join(common.tmpDir, 'stdin.txt'); + +const cmd = '"' + process.argv[0] + '" "' + stdoutScript + '" < "' + + tmpFile + '"'; + +const string = 'abc\nümlaut.\nsomething else\n' + + '南越国是前203年至前111年存在于岭南地区的一个国家,国都位于番禺,' + + '疆域包括今天中国的广东、广西两省区的大部份地区,福建省、湖南、贵州、' + + '云南的一小部份地区和越南的北部。南越国是秦朝灭亡后,' + + '由南海郡尉赵佗于前203年起兵兼并桂林郡和象郡后建立。前196年和前179年,' + + '南越国曾先后两次名义上臣属于西汉,成为西汉的“外臣”。前112年,' + + '南越国末代君主赵建德与西汉发生战争,被汉武帝于前111年所灭。南越国共存在93年,' + + '历经五代君主。南越国是岭南地区的第一个有记载的政权国家,' + + '采用封建制和郡县制并存的制度,' + + '它的建立保证了秦末乱世岭南地区社会秩序的稳定,' + + '有效的改善了岭南地区落后的政治、##济现状。\n'; common.refreshTmpDir(); console.log(cmd + '\n\n'); -try { - fs.unlinkSync(tmpFile); -} catch (e) {} - fs.writeFileSync(tmpFile, string); -childProcess.exec(cmd, function(err, stdout, stderr) { +childProcess.exec(cmd, common.mustCall(function(err, stdout, stderr) { fs.unlinkSync(tmpFile); if (err) throw err; console.log(stdout); - assert.equal(stdout, 'hello world\r\n' + string); - assert.equal('', stderr); -}); + assert.strictEqual(stdout, 'hello world\r\n' + string); + assert.strictEqual('', stderr); +})); From 5d9c22438462058e1141ef246e591fb7aee9470b Mon Sep 17 00:00:00 2001 From: Chris Henney Date: Thu, 1 Dec 2016 10:37:18 -0600 Subject: [PATCH 152/313] test: refactor test-domain-exit-dispose change equal to strictEqual, fix setTimeout PR-URL: https://github.com/nodejs/node/pull/9938 Reviewed-By: James M Snell Reviewed-By: Michael Dawson Reviewed-By: Luigi Pinca Reviewed-By: Jeremiah Senkpiel --- test/parallel/test-domain-exit-dispose.js | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-domain-exit-dispose.js b/test/parallel/test-domain-exit-dispose.js index 94b3dbd4ca5a37..508cec18dccb7d 100644 --- a/test/parallel/test-domain-exit-dispose.js +++ b/test/parallel/test-domain-exit-dispose.js @@ -1,8 +1,8 @@ 'use strict'; require('../common'); +var common = require('../common'); var assert = require('assert'); var domain = require('domain'); -var disposalFailed = false; // no matter what happens, we should increment a 10 times. var a = 0; @@ -22,11 +22,7 @@ function err() { function err2() { // this timeout should never be called, since the domain gets // disposed when the error happens. - setTimeout(function() { - console.error('This should not happen.'); - disposalFailed = true; - process.exit(1); - }); + setTimeout(common.mustCall(() => {}, 0), 1); // this function doesn't exist, and throws an error as a result. err3(); // eslint-disable-line no-undef @@ -41,7 +37,6 @@ function err() { } process.on('exit', function() { - assert.equal(a, 10); - assert.equal(disposalFailed, false); + assert.strictEqual(a, 10); console.log('ok'); }); From 290f3598573af468cfc04c304c309aa7e12006ed Mon Sep 17 00:00:00 2001 From: Yojan Shrestha Date: Thu, 1 Dec 2016 11:05:59 -0600 Subject: [PATCH 153/313] test: refactor tls-ticket-cluster - changes var to const/let - changes assert.equal to assert.strictEqual - changes `notEqual` to `notStrictEqual` PR-URL: https://github.com/nodejs/node/pull/10023 Reviewed-By: Matteo Collina Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig --- test/parallel/test-tls-ticket-cluster.js | 46 ++++++++++----------- test/parallel/test-tls-ticket.js | 52 ++++++++++++------------ 2 files changed, 49 insertions(+), 49 deletions(-) diff --git a/test/parallel/test-tls-ticket-cluster.js b/test/parallel/test-tls-ticket-cluster.js index 4d1667a7adcab2..fa630f4ec251bd 100644 --- a/test/parallel/test-tls-ticket-cluster.js +++ b/test/parallel/test-tls-ticket-cluster.js @@ -1,29 +1,29 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const tls = require('tls'); -var cluster = require('cluster'); -var fs = require('fs'); -var join = require('path').join; +const cluster = require('cluster'); +const fs = require('fs'); +const join = require('path').join; -var workerCount = 4; -var expectedReqCount = 16; +const workerCount = 4; +const expectedReqCount = 16; if (cluster.isMaster) { - var reusedCount = 0; - var reqCount = 0; - var lastSession = null; - var shootOnce = false; + let reusedCount = 0; + let reqCount = 0; + let lastSession = null; + let shootOnce = false; function shoot() { console.error('[master] connecting'); - var c = tls.connect(common.PORT, { + const c = tls.connect(common.PORT, { session: lastSession, rejectUnauthorized: false }, function() { @@ -41,7 +41,7 @@ if (cluster.isMaster) { } function fork() { - var worker = cluster.fork(); + const worker = cluster.fork(); worker.on('message', function(msg) { console.error('[master] got %j', msg); if (msg === 'reused') { @@ -56,27 +56,27 @@ if (cluster.isMaster) { console.error('[master] worker died'); }); } - for (var i = 0; i < workerCount; i++) { + for (let i = 0; i < workerCount; i++) { fork(); } process.on('exit', function() { - assert.equal(reqCount, expectedReqCount); - assert.equal(reusedCount + 1, reqCount); + assert.strictEqual(reqCount, expectedReqCount); + assert.strictEqual(reusedCount + 1, reqCount); }); return; } -var keyFile = join(common.fixturesDir, 'agent.key'); -var certFile = join(common.fixturesDir, 'agent.crt'); -var key = fs.readFileSync(keyFile); -var cert = fs.readFileSync(certFile); -var options = { +const keyFile = join(common.fixturesDir, 'agent.key'); +const certFile = join(common.fixturesDir, 'agent.crt'); +const key = fs.readFileSync(keyFile); +const cert = fs.readFileSync(certFile); +const options = { key: key, cert: cert }; -var server = tls.createServer(options, function(c) { +const server = tls.createServer(options, function(c) { if (c.isSessionReused()) { process.send('reused'); } else { diff --git a/test/parallel/test-tls-ticket.js b/test/parallel/test-tls-ticket.js index 8457b15e0cd325..0fa0c057f3e573 100644 --- a/test/parallel/test-tls-ticket.js +++ b/test/parallel/test-tls-ticket.js @@ -1,29 +1,29 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const tls = require('tls'); -var fs = require('fs'); -var net = require('net'); -var crypto = require('crypto'); +const fs = require('fs'); +const net = require('net'); +const crypto = require('crypto'); -var keys = crypto.randomBytes(48); -var serverLog = []; -var ticketLog = []; +const keys = crypto.randomBytes(48); +const serverLog = []; +const ticketLog = []; -var serverCount = 0; +let serverCount = 0; function createServer() { - var id = serverCount++; + const id = serverCount++; - var counter = 0; - var previousKey = null; + let counter = 0; + let previousKey = null; - var server = tls.createServer({ + const server = tls.createServer({ key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem'), ticketKeys: keys @@ -49,13 +49,13 @@ function createServer() { return server; } -var naturalServers = [ createServer(), createServer(), createServer() ]; +const naturalServers = [ createServer(), createServer(), createServer() ]; // 3x servers -var servers = naturalServers.concat(naturalServers).concat(naturalServers); +const servers = naturalServers.concat(naturalServers).concat(naturalServers); // Create one TCP server and balance sockets to multiple TLS server instances -var shared = net.createServer(function(c) { +const shared = net.createServer(function(c) { servers.shift().emit('connection', c); }).listen(0, function() { start(function() { @@ -64,11 +64,11 @@ var shared = net.createServer(function(c) { }); function start(callback) { - var sess = null; - var left = servers.length; + let sess = null; + let left = servers.length; function connect() { - var s = tls.connect(shared.address().port, { + const s = tls.connect(shared.address().port, { session: sess, rejectUnauthorized: false }, function() { @@ -87,15 +87,15 @@ function start(callback) { } process.on('exit', function() { - assert.equal(ticketLog.length, serverLog.length); - for (var i = 0; i < naturalServers.length - 1; i++) { - assert.notEqual(serverLog[i], serverLog[i + 1]); - assert.equal(ticketLog[i], ticketLog[i + 1]); + assert.strictEqual(ticketLog.length, serverLog.length); + for (let i = 0; i < naturalServers.length - 1; i++) { + assert.notStrictEqual(serverLog[i], serverLog[i + 1]); + assert.strictEqual(ticketLog[i], ticketLog[i + 1]); // 2nd connection should have different ticket - assert.notEqual(ticketLog[i], ticketLog[i + naturalServers.length]); + assert.notStrictEqual(ticketLog[i], ticketLog[i + naturalServers.length]); // 3rd connection should have the same ticket - assert.equal(ticketLog[i], ticketLog[i + naturalServers.length * 2]); + assert.strictEqual(ticketLog[i], ticketLog[i + naturalServers.length * 2]); } }); From e49c7bbae302319ca3c54199e8fa82b19eae6377 Mon Sep 17 00:00:00 2001 From: Rodrigo Palma Date: Thu, 1 Dec 2016 11:24:38 -0600 Subject: [PATCH 154/313] test: refactor test-event-emitter-method-names Improved test by using strictEqual instead of equal. PR-URL: https://github.com/nodejs/node/pull/10027 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Evan Lucas --- test/parallel/test-event-emitter-method-names.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-event-emitter-method-names.js b/test/parallel/test-event-emitter-method-names.js index c1e6540f0184af..e268e229b06b5b 100644 --- a/test/parallel/test-event-emitter-method-names.js +++ b/test/parallel/test-event-emitter-method-names.js @@ -4,10 +4,10 @@ var assert = require('assert'); var events = require('events'); var E = events.EventEmitter.prototype; -assert.equal(E.constructor.name, 'EventEmitter'); -assert.equal(E.on, E.addListener); // Same method. +assert.strictEqual(E.constructor.name, 'EventEmitter'); +assert.strictEqual(E.on, E.addListener); // Same method. Object.getOwnPropertyNames(E).forEach(function(name) { if (name === 'constructor' || name === 'on') return; if (typeof E[name] !== 'function') return; - assert.equal(E[name].name, name); + assert.strictEqual(E[name].name, name); }); From 0e3593a454de1e43a802657e6bbe1d755f461651 Mon Sep 17 00:00:00 2001 From: Richard Karmazin Date: Thu, 1 Dec 2016 11:12:40 -0600 Subject: [PATCH 155/313] test: refactor test-listen-fd-ebadf Replace var with const and assert.equal with assert.strictEqual. PR-URL: https://github.com/nodejs/node/pull/10034 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Evan Lucas --- test/parallel/test-listen-fd-ebadf.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-listen-fd-ebadf.js b/test/parallel/test-listen-fd-ebadf.js index 09beda067b5e71..86004e6af00437 100644 --- a/test/parallel/test-listen-fd-ebadf.js +++ b/test/parallel/test-listen-fd-ebadf.js @@ -1,7 +1,7 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var net = require('net'); +const common = require('../common'); +const assert = require('assert'); +const net = require('net'); net.createServer(common.fail).listen({fd: 2}) .on('error', common.mustCall(onError)); @@ -9,5 +9,5 @@ net.createServer(common.fail).listen({fd: 42}) .on('error', common.mustCall(onError)); function onError(ex) { - assert.equal(ex.code, 'EINVAL'); + assert.strictEqual(ex.code, 'EINVAL'); } From 3c46ab69af04d65d14b7f2f0d520b6e3da634574 Mon Sep 17 00:00:00 2001 From: Chris Bystrek Date: Thu, 1 Dec 2016 10:46:00 -0600 Subject: [PATCH 156/313] test: assert.throws() should include a RegExp PR-URL: https://github.com/nodejs/node/pull/9976 Reviewed-By: Prince John Wesley Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- test/parallel/test-child-process-detached.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-child-process-detached.js b/test/parallel/test-child-process-detached.js index d550401fae79e1..43cae6eeb02a88 100644 --- a/test/parallel/test-child-process-detached.js +++ b/test/parallel/test-child-process-detached.js @@ -18,7 +18,7 @@ process.on('exit', function() { assert.notStrictEqual(persistentPid, -1); assert.throws(function() { process.kill(child.pid); - }); + }, /^Error: kill ESRCH$/); assert.doesNotThrow(function() { process.kill(persistentPid); }); From c2d7e67458267f6a548b8519b7467e6ae1a6bae2 Mon Sep 17 00:00:00 2001 From: Michael-Bryant Choa Date: Thu, 1 Dec 2016 10:39:59 -0600 Subject: [PATCH 157/313] test: refactor test-dgram-bind-default-address - changes var to const/let - changes assert.equal to assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/9947 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/parallel/test-dgram-bind-default-address.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) mode change 100644 => 100755 test/parallel/test-dgram-bind-default-address.js diff --git a/test/parallel/test-dgram-bind-default-address.js b/test/parallel/test-dgram-bind-default-address.js old mode 100644 new mode 100755 index b2bd72f6db6a7c..142a5134c013c3 --- a/test/parallel/test-dgram-bind-default-address.js +++ b/test/parallel/test-dgram-bind-default-address.js @@ -1,7 +1,7 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var dgram = require('dgram'); +const common = require('../common'); +const assert = require('assert'); +const dgram = require('dgram'); // skip test in FreeBSD jails since 0.0.0.0 will resolve to default interface if (common.inFreeBSDJail) { @@ -13,7 +13,7 @@ dgram.createSocket('udp4').bind(0, common.mustCall(function() { assert.strictEqual(typeof this.address().port, 'number'); assert.ok(isFinite(this.address().port)); assert.ok(this.address().port > 0); - assert.equal(this.address().address, '0.0.0.0'); + assert.strictEqual(this.address().address, '0.0.0.0'); this.close(); })); @@ -26,9 +26,9 @@ dgram.createSocket('udp6').bind(0, common.mustCall(function() { assert.strictEqual(typeof this.address().port, 'number'); assert.ok(isFinite(this.address().port)); assert.ok(this.address().port > 0); - var address = this.address().address; + let address = this.address().address; if (address === '::ffff:0.0.0.0') address = '::'; - assert.equal(address, '::'); + assert.strictEqual(address, '::'); this.close(); })); From a696934faae87ca370f18b4b1d6dee4aabed32bc Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Mon, 5 Dec 2016 17:13:21 +0100 Subject: [PATCH 158/313] test: check result of uv_loop_init and uv_write Silence coverity warnings about the return value not being checked. PR-URL: https://github.com/nodejs/node/pull/10126 Reviewed-By: Colin Ihrig Reviewed-By: Eugene Ostroukhov Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/cctest/test_inspector_socket.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/cctest/test_inspector_socket.cc b/test/cctest/test_inspector_socket.cc index 697fa2bacca85a..741b5cfc95403e 100644 --- a/test/cctest/test_inspector_socket.cc +++ b/test/cctest/test_inspector_socket.cc @@ -112,8 +112,9 @@ static void do_write(const char* data, int len) { uv_buf_t buf[1]; buf[0].base = const_cast(data); buf[0].len = len; - uv_write(&req, reinterpret_cast(&client_socket), buf, 1, - write_done); + GTEST_ASSERT_EQ(0, + uv_write(&req, reinterpret_cast(&client_socket), + buf, 1, write_done)); SPIN_WHILE(req.data); } @@ -351,7 +352,7 @@ class InspectorSocketTest : public ::testing::Test { connected = false; inspector_ready = false; last_event = kInspectorHandshakeHttpGet; - uv_loop_init(&loop); + GTEST_ASSERT_EQ(0, uv_loop_init(&loop)); server = uv_tcp_t(); client_socket = uv_tcp_t(); server.data = &inspector; From faf0f2d2542f132ef8b53f39576b977e96c59551 Mon Sep 17 00:00:00 2001 From: CodeVana Date: Thu, 1 Dec 2016 08:09:01 -0800 Subject: [PATCH 159/313] test: use const and strictEqual in test-os-homedir-no-envvar PR-URL: https://github.com/nodejs/node/pull/9899 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- test/parallel/test-os-homedir-no-envvar.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/test/parallel/test-os-homedir-no-envvar.js b/test/parallel/test-os-homedir-no-envvar.js index cb4be4e6efcd4e..94d8ab5a08fa14 100644 --- a/test/parallel/test-os-homedir-no-envvar.js +++ b/test/parallel/test-os-homedir-no-envvar.js @@ -1,28 +1,28 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var cp = require('child_process'); -var os = require('os'); -var path = require('path'); +const common = require('../common'); +const assert = require('assert'); +const cp = require('child_process'); +const os = require('os'); +const path = require('path'); if (process.argv[2] === 'child') { if (common.isWindows) - assert.equal(process.env.USERPROFILE, undefined); + assert.strictEqual(process.env.USERPROFILE, undefined); else - assert.equal(process.env.HOME, undefined); + assert.strictEqual(process.env.HOME, undefined); - var home = os.homedir(); + const home = os.homedir(); - assert.ok(typeof home === 'string'); - assert.ok(home.indexOf(path.sep) !== -1); + assert.strictEqual(typeof home, 'string'); + assert(home.includes(path.sep)); } else { if (common.isWindows) delete process.env.USERPROFILE; else delete process.env.HOME; - var child = cp.spawnSync(process.execPath, [__filename, 'child'], { + const child = cp.spawnSync(process.execPath, [__filename, 'child'], { env: process.env }); From 793addf585a8650926a0b9916f37e8071f6e9994 Mon Sep 17 00:00:00 2001 From: Ethan Arrowood Date: Thu, 1 Dec 2016 11:22:14 -0600 Subject: [PATCH 160/313] test: refactor test-domain-exit-dispose-again setTimeout at 49:5 requires two arguments. On lines 72 and 73 changed assert.equal() to assert.strictEqual(). PR-URL: https://github.com/nodejs/node/pull/10003 Reviewed-By: James M Snell Reviewed-By: Jeremiah Senkpiel Reviewed-By: Rich Trott --- test/parallel/test-domain-exit-dispose-again.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-domain-exit-dispose-again.js b/test/parallel/test-domain-exit-dispose-again.js index 0928addd9ace55..b1911bb40e0c93 100644 --- a/test/parallel/test-domain-exit-dispose-again.js +++ b/test/parallel/test-domain-exit-dispose-again.js @@ -51,7 +51,7 @@ setTimeout(function firstTimer() { 'a domain that should be disposed.'); disposalFailed = true; process.exit(1); - }); + }, 1); // Make V8 throw an unreferenced error. As a result, the domain's error // handler is called, which disposes the domain "d" and should prevent the @@ -69,8 +69,8 @@ setTimeout(function secondTimer() { }, TIMEOUT_DURATION); process.on('exit', function() { - assert.equal(a, 10); - assert.equal(disposalFailed, false); + assert.strictEqual(a, 10); + assert.strictEqual(disposalFailed, false); assert(secondTimerRan); console.log('ok'); }); From a6bc868bf9811b3017e34406414476cea71d062f Mon Sep 17 00:00:00 2001 From: Daniel Sims Date: Thu, 1 Dec 2016 10:02:15 -0600 Subject: [PATCH 161/313] test: refactor test-domain-from-timer In this change, the setTimeout needed a second argument, so I set that value to 1. In addition, I changed the assertion to be a strictEquals instead of equals. I changed the var declarations to const in this test. PR-URL: https://github.com/nodejs/node/pull/9889 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- test/parallel/test-domain-from-timer.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/parallel/test-domain-from-timer.js b/test/parallel/test-domain-from-timer.js index f0115018ec1879..2ffae758ef6490 100644 --- a/test/parallel/test-domain-from-timer.js +++ b/test/parallel/test-domain-from-timer.js @@ -2,17 +2,17 @@ // Simple tests of most basic domain functionality. require('../common'); -var assert = require('assert'); +const assert = require('assert'); // timeouts call the callback directly from cc, so need to make sure the // domain will be used regardless setTimeout(function() { - var domain = require('domain'); - var d = domain.create(); + const domain = require('domain'); + const d = domain.create(); d.run(function() { process.nextTick(function() { console.trace('in nexttick', process.domain === d); - assert.equal(process.domain, d); + assert.strictEqual(process.domain, d); }); }); -}); +}, 1); From 314b04d2d9eaa4a5fab5ab7cc9407025e9900198 Mon Sep 17 00:00:00 2001 From: Jenna Vuong Date: Tue, 15 Nov 2016 16:10:43 -0800 Subject: [PATCH 162/313] test: improve test-fs-read-stream.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit var -> const assert.equal() -> assert.strictEqual() PR-URL: https://github.com/nodejs/node/pull/9629 Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: Michael Dawson Reviewed-By: James M Snell Reviewed-By: Michaël Zasso Reviewed-By: Luigi Pinca Reviewed-By: Ben Noordhuis Reviewed-By: Gibson Fahnestock Reviewed-By: Franziska Hinkelmann --- test/parallel/test-fs-read-stream.js | 38 ++++++++++++++-------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/test/parallel/test-fs-read-stream.js b/test/parallel/test-fs-read-stream.js index 7b133022511910..c8da0275c53c9b 100644 --- a/test/parallel/test-fs-read-stream.js +++ b/test/parallel/test-fs-read-stream.js @@ -1,11 +1,11 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); -var path = require('path'); -var fs = require('fs'); -var fn = path.join(common.fixturesDir, 'elipses.txt'); -var rangeFile = path.join(common.fixturesDir, 'x.txt'); +const path = require('path'); +const fs = require('fs'); +const fn = path.join(common.fixturesDir, 'elipses.txt'); +const rangeFile = path.join(common.fixturesDir, 'x.txt'); var callbacks = { open: 0, end: 0, close: 0 }; @@ -20,7 +20,7 @@ assert.strictEqual(file.bytesRead, 0); file.on('open', function(fd) { file.length = 0; callbacks.open++; - assert.equal('number', typeof fd); + assert.strictEqual('number', typeof fd); assert.strictEqual(file.bytesRead, 0); assert.ok(file.readable); @@ -67,12 +67,12 @@ file.on('close', function() { var file3 = fs.createReadStream(fn, {encoding: 'utf8'}); file3.length = 0; file3.on('data', function(data) { - assert.equal('string', typeof data); + assert.strictEqual('string', typeof data); file3.length += data.length; for (var i = 0; i < data.length; i++) { // http://www.fileformat.info/info/unicode/char/2026/index.htm - assert.equal('\u2026', data[i]); + assert.strictEqual('\u2026', data[i]); } }); @@ -81,11 +81,11 @@ file3.on('close', function() { }); process.on('exit', function() { - assert.equal(1, callbacks.open); - assert.equal(1, callbacks.end); - assert.equal(2, callbacks.close); - assert.equal(30000, file.length); - assert.equal(10000, file3.length); + assert.strictEqual(1, callbacks.open); + assert.strictEqual(1, callbacks.end); + assert.strictEqual(2, callbacks.close); + assert.strictEqual(30000, file.length); + assert.strictEqual(10000, file3.length); console.error('ok'); }); @@ -95,7 +95,7 @@ file4.on('data', function(data) { contentRead += data.toString('utf-8'); }); file4.on('end', function(data) { - assert.equal(contentRead, 'yz'); + assert.strictEqual(contentRead, 'yz'); }); var file5 = fs.createReadStream(rangeFile, {bufferSize: 1, start: 1}); @@ -104,7 +104,7 @@ file5.on('data', function(data) { file5.data += data.toString('utf-8'); }); file5.on('end', function() { - assert.equal(file5.data, 'yz\n'); + assert.strictEqual(file5.data, 'yz\n'); }); // https://github.com/joyent/node/issues/2320 @@ -114,7 +114,7 @@ file6.on('data', function(data) { file6.data += data.toString('utf-8'); }); file6.on('end', function() { - assert.equal(file6.data, 'yz\n'); + assert.strictEqual(file6.data, 'yz\n'); }); assert.throws(function() { @@ -129,7 +129,7 @@ stream.on('data', function(chunk) { }); stream.on('end', function() { - assert.equal('x', stream.data); + assert.strictEqual('x', stream.data); }); // pause and then resume immediately. @@ -155,7 +155,7 @@ function file7Next() { file7.data += data; }); file7.on('end', function(err) { - assert.equal(file7.data, 'xyz\n'); + assert.strictEqual(file7.data, 'xyz\n'); }); } From 3686687cd22a054435a03f2d4bdb7713e813db4e Mon Sep 17 00:00:00 2001 From: Rob Adelmann Date: Sun, 4 Dec 2016 11:21:37 -0800 Subject: [PATCH 163/313] test: refactor test-beforeexit-event - replaced var with const/let. - removed all console.log() statements. - removed deaths and revivals vars. - wrapped beforexit listener callbacks with common.mustCall(). - removed exit event listener. PR-URL: https://github.com/nodejs/node/pull/10121 Reviewed-By: Jeremiah Senkpiel Reviewed-By: Brian White Reviewed-By: James M Snell Reviewed-By: Michael Dawson --- test/parallel/test-beforeexit-event.js | 40 ++++++++------------------ 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/test/parallel/test-beforeexit-event.js b/test/parallel/test-beforeexit-event.js index 4decbcf9f921f3..ef94da76af3883 100644 --- a/test/parallel/test-beforeexit-event.js +++ b/test/parallel/test-beforeexit-event.js @@ -1,42 +1,26 @@ 'use strict'; -require('../common'); -var assert = require('assert'); -var net = require('net'); -var revivals = 0; -var deaths = 0; +const common = require('../common'); +const net = require('net'); -process.on('beforeExit', function() { deaths++; }); - -process.once('beforeExit', tryImmediate); +process.once('beforeExit', common.mustCall(tryImmediate)); function tryImmediate() { - console.log('set immediate'); - setImmediate(function() { - revivals++; - process.once('beforeExit', tryTimer); - }); + setImmediate(common.mustCall(() => { + process.once('beforeExit', common.mustCall(tryTimer)); + })); } function tryTimer() { - console.log('set a timeout'); - setTimeout(function() { - console.log('timeout cb, do another once beforeExit'); - revivals++; - process.once('beforeExit', tryListen); - }, 1); + setTimeout(common.mustCall(() => { + process.once('beforeExit', common.mustCall(tryListen)); + }), 1); } function tryListen() { - console.log('create a server'); net.createServer() .listen(0) - .on('listening', function() { - revivals++; + .on('listening', common.mustCall(function() { this.close(); - }); + process.on('beforeExit', common.mustCall(() => {})); + })); } - -process.on('exit', function() { - assert.strictEqual(4, deaths); - assert.strictEqual(3, revivals); -}); From 780d444d3ffb3be8508087d2a79644cb8faaef8f Mon Sep 17 00:00:00 2001 From: Diego Paez Date: Sat, 3 Dec 2016 16:21:11 +0000 Subject: [PATCH 164/313] test: refactor test-https-agent-session-reuse Use const and let instead of var and assert.strictEqual() instead of assert.equal() PR-URL: https://github.com/nodejs/node/pull/10105 Reviewed-By: Colin Ihrig Reviewed-By: Santiago Gimeno Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- .../test-https-agent-session-reuse.js | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/test/parallel/test-https-agent-session-reuse.js b/test/parallel/test-https-agent-session-reuse.js index 01f161574b29db..73465aa5a98fb9 100644 --- a/test/parallel/test-https-agent-session-reuse.js +++ b/test/parallel/test-https-agent-session-reuse.js @@ -1,39 +1,39 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var https = require('https'); -var crypto = require('crypto'); +const https = require('https'); +const crypto = require('crypto'); -var fs = require('fs'); +const fs = require('fs'); -var options = { +const options = { key: fs.readFileSync(common.fixturesDir + '/keys/agent1-key.pem'), cert: fs.readFileSync(common.fixturesDir + '/keys/agent1-cert.pem') }; -var ca = fs.readFileSync(common.fixturesDir + '/keys/ca1-cert.pem'); +const ca = fs.readFileSync(common.fixturesDir + '/keys/ca1-cert.pem'); -var clientSessions = {}; -var serverRequests = 0; +const clientSessions = {}; +let serverRequests = 0; -var agent = new https.Agent({ +const agent = new https.Agent({ maxCachedSessions: 1 }); -var server = https.createServer(options, function(req, res) { +const server = https.createServer(options, function(req, res) { if (req.url === '/drop-key') server.setTicketKeys(crypto.randomBytes(48)); serverRequests++; res.end('ok'); }).listen(0, function() { - var queue = [ + const queue = [ { name: 'first', @@ -97,7 +97,7 @@ var server = https.createServer(options, function(req, res) { ]; function request() { - var options = queue.shift(); + const options = queue.shift(); options.agent = agent; https.request(options, function(res) { clientSessions[options.name] = res.socket.getSession(); @@ -114,9 +114,9 @@ var server = https.createServer(options, function(req, res) { }); process.on('exit', function() { - assert.equal(serverRequests, 6); - assert.equal(clientSessions['first'].toString('hex'), - clientSessions['first-reuse'].toString('hex')); + assert.strictEqual(serverRequests, 6); + assert.strictEqual(clientSessions['first'].toString('hex'), + clientSessions['first-reuse'].toString('hex')); assert.notEqual(clientSessions['first'].toString('hex'), clientSessions['cipher-change'].toString('hex')); assert.notEqual(clientSessions['first'].toString('hex'), @@ -125,6 +125,6 @@ process.on('exit', function() { clientSessions['before-drop'].toString('hex')); assert.notEqual(clientSessions['before-drop'].toString('hex'), clientSessions['after-drop'].toString('hex')); - assert.equal(clientSessions['after-drop'].toString('hex'), - clientSessions['after-drop-reuse'].toString('hex')); + assert.strictEqual(clientSessions['after-drop'].toString('hex'), + clientSessions['after-drop-reuse'].toString('hex')); }); From 690cc2a88fcd4a0817dba4753cbb269ad6a92c19 Mon Sep 17 00:00:00 2001 From: Paul Graham Date: Thu, 1 Dec 2016 10:22:06 -0600 Subject: [PATCH 165/313] test: improves test-tls-client-verify Swaps var -> const/let assert.equal becomes assert.strictEqual common.mustCall on single-use functions PR-URL: https://github.com/nodejs/node/pull/10051 Reviewed-By: Rich Trott Reviewed-By: Michael Dawson Reviewed-By: Anna Henningsen --- test/parallel/test-tls-client-verify.js | 54 ++++++++++++------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/test/parallel/test-tls-client-verify.js b/test/parallel/test-tls-client-verify.js index 7844253db9c15f..983d88296eb26f 100644 --- a/test/parallel/test-tls-client-verify.js +++ b/test/parallel/test-tls-client-verify.js @@ -1,17 +1,17 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const tls = require('tls'); -var fs = require('fs'); +const fs = require('fs'); -var hosterr = /Hostname\/IP doesn't match certificate's altnames/g; -var testCases = +const hosterr = /Hostname\/IP doesn't match certificate's altnames/g; +const testCases = [{ ca: ['ca1-cert'], key: 'agent2-key', cert: 'agent2-cert', @@ -52,16 +52,16 @@ function loadPEM(n) { return fs.readFileSync(filenamePEM(n)); } -var successfulTests = 0; +let successfulTests = 0; function testServers(index, servers, clientOptions, cb) { - var serverOptions = servers[index]; + const serverOptions = servers[index]; if (!serverOptions) { cb(); return; } - var ok = serverOptions.ok; + const ok = serverOptions.ok; if (serverOptions.key) { serverOptions.key = loadPEM(serverOptions.key); @@ -71,37 +71,37 @@ function testServers(index, servers, clientOptions, cb) { serverOptions.cert = loadPEM(serverOptions.cert); } - var server = tls.createServer(serverOptions, function(s) { + const server = tls.createServer(serverOptions, common.mustCall(function(s) { s.end('hello world\n'); - }); + })); - server.listen(0, function() { - var b = ''; + server.listen(0, common.mustCall(function() { + let b = ''; console.error('connecting...'); clientOptions.port = this.address().port; - var client = tls.connect(clientOptions, function() { - var authorized = client.authorized || - hosterr.test(client.authorizationError); + const client = tls.connect(clientOptions, common.mustCall(function() { + const authorized = client.authorized || + hosterr.test(client.authorizationError); console.error('expected: ' + ok + ' authed: ' + authorized); - assert.equal(ok, authorized); + assert.strictEqual(ok, authorized); server.close(); - }); + })); client.on('data', function(d) { b += d.toString(); }); - client.on('end', function() { - assert.equal('hello world\n', b); - }); + client.on('end', common.mustCall(function() { + assert.strictEqual('hello world\n', b); + })); - client.on('close', function() { + client.on('close', common.mustCall(function() { testServers(index + 1, servers, clientOptions, cb); - }); - }); + })); + })); } @@ -109,7 +109,7 @@ function runTest(testIndex) { var tcase = testCases[testIndex]; if (!tcase) return; - var clientOptions = { + const clientOptions = { port: undefined, ca: tcase.ca.map(loadPEM), key: loadPEM(tcase.key), @@ -118,10 +118,10 @@ function runTest(testIndex) { }; - testServers(0, tcase.servers, clientOptions, function() { + testServers(0, tcase.servers, clientOptions, common.mustCall(function() { successfulTests++; runTest(testIndex + 1); - }); + })); } From 70c5e4fca2b328a882e88e4bb9bfb9b25dd3df6b Mon Sep 17 00:00:00 2001 From: vazina robertson Date: Thu, 1 Dec 2016 11:22:42 -0600 Subject: [PATCH 166/313] test: changed assert.equal to assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/10015 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen --- test/parallel/test-child-process-stdio-big-write-end.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-child-process-stdio-big-write-end.js b/test/parallel/test-child-process-stdio-big-write-end.js index 4b0f9d2cf3216f..4c9f4159d0d8bc 100644 --- a/test/parallel/test-child-process-stdio-big-write-end.js +++ b/test/parallel/test-child-process-stdio-big-write-end.js @@ -23,7 +23,7 @@ function parent() { n += c; }); child.stdout.on('end', function() { - assert.equal(+n, sent); + assert.strictEqual(+n, sent); console.log('ok'); }); From 653f2b76f3c3340fea0f1329ff9fe36144f9c6a2 Mon Sep 17 00:00:00 2001 From: Aileen Date: Thu, 1 Dec 2016 10:36:13 -0600 Subject: [PATCH 167/313] test: change assert.equal to assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/9946 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- test/parallel/test-cluster-send-handle-twice.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-cluster-send-handle-twice.js b/test/parallel/test-cluster-send-handle-twice.js index f1552d79265a0c..172a5563f306f5 100644 --- a/test/parallel/test-cluster-send-handle-twice.js +++ b/test/parallel/test-cluster-send-handle-twice.js @@ -14,7 +14,7 @@ if (cluster.isMaster) { for (var i = 0; i < workers.toStart; ++i) { var worker = cluster.fork(); worker.on('exit', function(code, signal) { - assert.equal(code, 0, 'Worker exited with an error code'); + assert.strictEqual(code, 0, 'Worker exited with an error code'); assert(!signal, 'Worker exited by a signal'); }); } From 1288d074abc9ed10f1c2fcb1471dd3029370a871 Mon Sep 17 00:00:00 2001 From: anoff Date: Thu, 1 Dec 2016 10:59:09 -0600 Subject: [PATCH 168/313] test: use `assert.strictEqual` * use `assert.strictEqual` PR-URL: https://github.com/nodejs/node/pull/9975 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- test/parallel/test-debug-port-from-cmdline.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-debug-port-from-cmdline.js b/test/parallel/test-debug-port-from-cmdline.js index 527d72ee74a75f..cd92764df29c8e 100644 --- a/test/parallel/test-debug-port-from-cmdline.js +++ b/test/parallel/test-debug-port-from-cmdline.js @@ -42,7 +42,7 @@ function assertOutputLines() { 'Debugger listening on (\\[::\\]|0\\.0\\.0\\.0):' + debugPort, ]; - assert.equal(outputLines.length, expectedLines.length); + assert.strictEqual(outputLines.length, expectedLines.length); for (var i = 0; i < expectedLines.length; i++) assert(RegExp(expectedLines[i]).test(outputLines[i])); } From fb525f1507b8283f52469cd26f3888e180df082a Mon Sep 17 00:00:00 2001 From: Bruce Lai Date: Thu, 1 Dec 2016 10:49:39 -0600 Subject: [PATCH 169/313] test: fix error in test-cluster-worker-death.js Replaced calls to assert.equal with assert.strictEqual in order to fix the following error: "Please use assert.strictEqual() instead of assert.strictEqual()" PR-URL: https://github.com/nodejs/node/pull/9981 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- test/parallel/test-cluster-worker-death.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-cluster-worker-death.js b/test/parallel/test-cluster-worker-death.js index 8bbf46de568eb0..ac32705106e03c 100644 --- a/test/parallel/test-cluster-worker-death.js +++ b/test/parallel/test-cluster-worker-death.js @@ -8,10 +8,10 @@ if (!cluster.isMaster) { } else { var worker = cluster.fork(); worker.on('exit', common.mustCall(function(exitCode, signalCode) { - assert.equal(exitCode, 42); - assert.equal(signalCode, null); + assert.strictEqual(exitCode, 42); + assert.strictEqual(signalCode, null); })); cluster.on('exit', common.mustCall(function(worker_) { - assert.equal(worker_, worker); + assert.strictEqual(worker_, worker); })); } From 70062f7cd77c68d388ea74781e61781308af38f7 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 30 Oct 2016 20:12:25 -0700 Subject: [PATCH 170/313] repl: refactor lib/repl.js * remove unnecessary backslash (`\`) escaping in regular expressions * favor `===` over `==` * multiline arrays indentation consistent with other indentation PR-URL: https://github.com/nodejs/node/pull/9374 Ref: https://github.com/nodejs/node/pull/9747 Reviewed-By: Rod Vagg Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Roman Reiss --- lib/repl.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/repl.js b/lib/repl.js index c4ecced77837fc..2a101e9a171fd9 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -40,12 +40,12 @@ const parentModule = module; const replMap = new WeakMap(); const GLOBAL_OBJECT_PROPERTIES = ['NaN', 'Infinity', 'undefined', - 'eval', 'parseInt', 'parseFloat', 'isNaN', 'isFinite', 'decodeURI', - 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', - 'Object', 'Function', 'Array', 'String', 'Boolean', 'Number', - 'Date', 'RegExp', 'Error', 'EvalError', 'RangeError', - 'ReferenceError', 'SyntaxError', 'TypeError', 'URIError', - 'Math', 'JSON']; + 'eval', 'parseInt', 'parseFloat', 'isNaN', 'isFinite', 'decodeURI', + 'decodeURIComponent', 'encodeURI', 'encodeURIComponent', + 'Object', 'Function', 'Array', 'String', 'Boolean', 'Number', + 'Date', 'RegExp', 'Error', 'EvalError', 'RangeError', + 'ReferenceError', 'SyntaxError', 'TypeError', 'URIError', + 'Math', 'JSON']; const GLOBAL_OBJECT_PROPERTY_MAP = {}; GLOBAL_OBJECT_PROPERTIES.forEach((p) => GLOBAL_OBJECT_PROPERTY_MAP[p] = p); @@ -783,7 +783,7 @@ ArrayStream.prototype.writable = true; ArrayStream.prototype.resume = function() {}; ArrayStream.prototype.write = function() {}; -const requireRE = /\brequire\s*\(['"](([\w\.\/-]+\/)?([\w\.\/-]*))/; +const requireRE = /\brequire\s*\(['"](([\w./-]+\/)?([\w./-]*))/; const simpleExpressionRE = /(([a-zA-Z_$](?:\w|\$)*)\.)*([a-zA-Z_$](?:\w|\$)*)\.?$/; @@ -1036,7 +1036,7 @@ function complete(line, callback) { var newCompletionGroups = []; for (i = 0; i < completionGroups.length; i++) { group = completionGroups[i].filter(function(elem) { - return elem.indexOf(filter) == 0; + return elem.indexOf(filter) === 0; }); if (group.length) { newCompletionGroups.push(group); @@ -1339,8 +1339,8 @@ function regexpEscape(s) { * @return {String} The converted command. */ REPLServer.prototype.convertToContext = function(cmd) { - const scopeVar = /^\s*var\s*([_\w\$]+)(.*)$/m; - const scopeFunc = /^\s*function\s*([_\w\$]+)/; + const scopeVar = /^\s*var\s*([\w$]+)(.*)$/m; + const scopeFunc = /^\s*function\s*([\w$]+)/; var matches; // Replaces: var foo = "bar"; with: self.context.foo = bar; From a8909b833edb491a73006b4c5a038d2642c60e6e Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 3 Nov 2016 11:32:06 -0700 Subject: [PATCH 171/313] benchmark,lib,test,tools: remove unneeded . escape The `.` character does not need to be escaped when it appears inside a regular expression character class. This removes instances of unnecessary escapes of the `.` character. This also removes a few unnecessary escapes of the `(` and `)` characters within character classes too. PR-URL: https://github.com/nodejs/node/pull/9449 Ref: https://github.com/nodejs/node/pull/9749 Reviewed-By: Roman Reiss Reviewed-By: Colin Ihrig Reviewed-By: Minwoo Jung Reviewed-By: James Snell --- lib/_tls_wrap.js | 2 +- test/parallel/test-repl.js | 2 +- tools/doc/json.js | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 96099388529c20..a1e00fd3e0fe52 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -936,7 +936,7 @@ Server.prototype.addContext = function(servername, context) { } var re = new RegExp('^' + - servername.replace(/([\.^$+?\-\\[\]{}])/g, '\\$1') + servername.replace(/([.^$+?\-\\[\]{}])/g, '\\$1') .replace(/\*/g, '[^.]*') + '$'); this._contexts.push([re, tls.createSecureContext(context).context]); diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index fc8efc695433f0..5564e670c8d934 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -72,7 +72,7 @@ function error_test() { if (read_buffer !== client_unix.expect) { let expect = client_unix.expect; if (expect === prompt_multiline) - expect = /[\.]{3} /; + expect = /[.]{3} /; assert.ok(read_buffer.match(expect)); console.error('match'); } diff --git a/tools/doc/json.js b/tools/doc/json.js index a194c7f7231423..a782c54028d756 100644 --- a/tools/doc/json.js +++ b/tools/doc/json.js @@ -545,12 +545,12 @@ function deepCopy_(src) { // these parse out the contents of an H# tag var eventExpr = /^Event(?::|\s)+['"]?([^"']+).*$/i; var classExpr = /^Class:\s*([^ ]+).*?$/i; -var propExpr = /^(?:property:?\s*)?[^\.]+\.([^ \.\(\)]+)\s*?$/i; -var braceExpr = /^(?:property:?\s*)?[^\.\[]+(\[[^\]]+\])\s*?$/i; +var propExpr = /^(?:property:?\s*)?[^.]+\.([^ .()]+)\s*?$/i; +var braceExpr = /^(?:property:?\s*)?[^.\[]+(\[[^\]]+\])\s*?$/i; var classMethExpr = - /^class\s*method\s*:?[^\.]+\.([^ \.\(\)]+)\([^\)]*\)\s*?$/i; + /^class\s*method\s*:?[^.]+\.([^ .()]+)\([^)]*\)\s*?$/i; var methExpr = - /^(?:method:?\s*)?(?:[^\.]+\.)?([^ \.\(\)]+)\([^\)]*\)\s*?$/i; + /^(?:method:?\s*)?(?:[^.]+\.)?([^ .()]+)\([^)]*\)\s*?$/i; var newExpr = /^new ([A-Z][a-zA-Z]+)\([^\)]*\)\s*?$/; var paramExpr = /\((.*)\);?$/; From 10222128e9ba64b259ab3a198e49b940821446e2 Mon Sep 17 00:00:00 2001 From: Stewart Addison Date: Mon, 14 Nov 2016 13:41:31 +0000 Subject: [PATCH 172/313] deps: backport GYP fix to fix AIX shared suffix Required to support the shared library builds on AIX - this sets the shared library suffix within GYP to .a instead of .so on AIX My patch: https://codereview.chromium.org/2492233002/ was landed as as part of this one which fixed some other (not required, but included for completeness of the backport) changes: Ref: https://codereview.chromium.org/2511733005/ PR-URL: https://github.com/nodejs/node/pull/9675 Reviewed-By: James M Snell Reviewed-By: Ben Noordhuis Reviewed-By: Michael Dawson --- tools/gyp/AUTHORS | 7 ++++--- tools/gyp/PRESUBMIT.py | 26 ++++++++++++++------------ tools/gyp/pylib/gyp/generator/make.py | 10 ++++++++-- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/tools/gyp/AUTHORS b/tools/gyp/AUTHORS index 9389ca0a23e48f..dcd231ceb2d341 100644 --- a/tools/gyp/AUTHORS +++ b/tools/gyp/AUTHORS @@ -1,9 +1,10 @@ # Names should be added to this file like so: # Name or Organization -Google Inc. -Bloomberg Finance L.P. -Yandex LLC +Google Inc. <*@google.com> +Bloomberg Finance L.P. <*@bloomberg.net> +IBM Inc. <*@*.ibm.com> +Yandex LLC <*@yandex-team.ru> Steven Knight Ryan Norton diff --git a/tools/gyp/PRESUBMIT.py b/tools/gyp/PRESUBMIT.py index dde025383c3276..f6c8a357afe149 100644 --- a/tools/gyp/PRESUBMIT.py +++ b/tools/gyp/PRESUBMIT.py @@ -73,23 +73,15 @@ ] -def CheckChangeOnUpload(input_api, output_api): - report = [] - report.extend(input_api.canned_checks.PanProjectChecks( - input_api, output_api)) - return report - - -def CheckChangeOnCommit(input_api, output_api): - report = [] - +def _LicenseHeader(input_api): # Accept any year number from 2009 to the current year. current_year = int(input_api.time.strftime('%Y')) allowed_years = (str(s) for s in reversed(xrange(2009, current_year + 1))) + years_re = '(' + '|'.join(allowed_years) + ')' # The (c) is deprecated, but tolerate it until it's removed from all files. - license = ( + return ( r'.*? Copyright (\(c\) )?%(year)s Google Inc\. All rights reserved\.\n' r'.*? Use of this source code is governed by a BSD-style license that ' r'can be\n' @@ -98,8 +90,18 @@ def CheckChangeOnCommit(input_api, output_api): 'year': years_re, } +def CheckChangeOnUpload(input_api, output_api): + report = [] + report.extend(input_api.canned_checks.PanProjectChecks( + input_api, output_api, license_header=_LicenseHeader(input_api))) + return report + + +def CheckChangeOnCommit(input_api, output_api): + report = [] + report.extend(input_api.canned_checks.PanProjectChecks( - input_api, output_api, license_header=license)) + input_api, output_api, license_header=_LicenseHeader(input_api))) report.extend(input_api.canned_checks.CheckTreeIsOpen( input_api, output_api, 'http://gyp-status.appspot.com/status', diff --git a/tools/gyp/pylib/gyp/generator/make.py b/tools/gyp/pylib/gyp/generator/make.py index 4a6b283f152329..39373b9844e49e 100644 --- a/tools/gyp/pylib/gyp/generator/make.py +++ b/tools/gyp/pylib/gyp/generator/make.py @@ -92,7 +92,10 @@ def CalculateVariables(default_variables, params): if flavor == 'android': operating_system = 'linux' # Keep this legacy behavior for now. default_variables.setdefault('OS', operating_system) - default_variables.setdefault('SHARED_LIB_SUFFIX', '.so') + if flavor == 'aix': + default_variables.setdefault('SHARED_LIB_SUFFIX', '.a') + else: + default_variables.setdefault('SHARED_LIB_SUFFIX', '.so') default_variables.setdefault('SHARED_LIB_DIR','$(builddir)/lib.$(TOOLSET)') default_variables.setdefault('LIB_DIR', '$(obj).$(TOOLSET)') @@ -1349,7 +1352,10 @@ def ComputeOutputBasename(self, spec): if target[:3] == 'lib': target = target[3:] target_prefix = 'lib' - target_ext = '.so' + if self.flavor == 'aix': + target_ext = '.a' + else: + target_ext = '.so' elif self.type == 'none': target = '%s.stamp' % target elif self.type != 'executable': From 168241a98a97bebc68f3d352b19760029b216a4b Mon Sep 17 00:00:00 2001 From: Stewart Addison Date: Mon, 14 Nov 2016 13:43:41 +0000 Subject: [PATCH 173/313] build: add shared library support to AIX build Updates to build the shared library version of node on AIX. Adds the same functionality to AIX that was added on Linux under this: Ref: https://github.com/nodejs/node/pull/6994/ PR-URL: https://github.com/nodejs/node/pull/9675 Reviewed-By: James M Snell Reviewed-By: Ben Noordhuis Reviewed-By: Michael Dawson --- configure | 9 ++++++++- node.gyp | 10 +++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 42dac5ff64ce94..53fed14efccae4 100755 --- a/configure +++ b/configure @@ -841,7 +841,14 @@ def configure_node(o): o['variables']['node_no_browser_globals'] = b(options.no_browser_globals) o['variables']['node_shared'] = b(options.shared) node_module_version = getmoduleversion.get_version() - shlib_suffix = '%s.dylib' if sys.platform == 'darwin' else 'so.%s' + + if sys.platform == 'darwin': + shlib_suffix = '%s.dylib' + elif sys.platform.startswith('aix'): + shlib_suffix = '%s.a' + else: + shlib_suffix = 'so.%s' + shlib_suffix %= node_module_version o['variables']['node_module_version'] = int(node_module_version) o['variables']['shlib_suffix'] = shlib_suffix diff --git a/node.gyp b/node.gyp index 4043269930da27..f252ad2563a0c6 100644 --- a/node.gyp +++ b/node.gyp @@ -916,7 +916,15 @@ 'targets': [ { 'target_name': 'node', - 'type': 'executable', + 'conditions': [ + ['node_shared=="true"', { + 'type': 'shared_library', + 'ldflags': ['--shared'], + 'product_extension': '<(shlib_suffix)', + }, { + 'type': 'executable', + }], + ], 'dependencies': ['<(node_core_target_name)', 'node_exp'], 'include_dirs': [ From ee09828622a90b893bacc44876cd47e8cca194fb Mon Sep 17 00:00:00 2001 From: Cristian Cavalli Date: Wed, 16 Nov 2016 13:14:46 -0800 Subject: [PATCH 174/313] deps: backport 2bd7464 from upstream V8 Original commit message: For global object property cells, we did not check that the map on the previous object is still the same for which we actually optimized. So the optimized code was not in sync with the actual state of the property cell. When loading from such a global object property cell, Crankshaft optimizes away any map checks (based on the stable map assumption), leading to arbitrary memory access in the worst case. TurboFan has the same bug for stores, but is safe on loads because we do appropriate map checks there. However mixing TurboFan and Crankshaft still exposes the bug. R=yangguo@chromium.org BUG=chromium:659475 Review-Url: https://codereview.chromium.org/2444233004 Cr-Commit-Position: refs/heads/master@{#40592} PR-URL: https://github.com/nodejs/node/pull/10169 Reviewed-By: bnoordhuis - Ben Noordhuis Reviewed-By: ofrobots - Ali Ijaz Sheikh --- deps/v8/include/v8-version.h | 2 +- deps/v8/src/bailout-reason.h | 1 + .../js-global-object-specialization.cc | 9 ++++-- deps/v8/src/crankshaft/hydrogen.cc | 16 +++++++--- deps/v8/src/runtime/runtime-utils.h | 8 +++-- .../mjsunit/regress/regress-crbug-659475-1.js | 30 ++++++++++++++++++ .../mjsunit/regress/regress-crbug-659475-2.js | 31 +++++++++++++++++++ 7 files changed, 87 insertions(+), 10 deletions(-) create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-659475-1.js create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-659475-2.js diff --git a/deps/v8/include/v8-version.h b/deps/v8/include/v8-version.h index 4723fe3b9d4a98..fb83ab5c6ca287 100644 --- a/deps/v8/include/v8-version.h +++ b/deps/v8/include/v8-version.h @@ -11,7 +11,7 @@ #define V8_MAJOR_VERSION 5 #define V8_MINOR_VERSION 1 #define V8_BUILD_NUMBER 281 -#define V8_PATCH_LEVEL 88 +#define V8_PATCH_LEVEL 89 // Use 1 for candidates and 0 otherwise. // (Boolean macro values are not supported by all preprocessors.) diff --git a/deps/v8/src/bailout-reason.h b/deps/v8/src/bailout-reason.h index 92929cf38c24bb..37fb64a87aac31 100644 --- a/deps/v8/src/bailout-reason.h +++ b/deps/v8/src/bailout-reason.h @@ -257,6 +257,7 @@ namespace internal { V(kUnexpectedReturnFromThrow, "Unexpectedly returned from a throw") \ V(kUnsupportedSwitchStatement, "Unsupported switch statement") \ V(kUnsupportedTaggedImmediate, "Unsupported tagged immediate") \ + V(kUnstableConstantTypeHeapObject, "Unstable constant-type heap object") \ V(kVariableResolvedToWithContext, "Variable resolved to with context") \ V(kWeShouldNotHaveAnEmptyLexicalContext, \ "We should not have an empty lexical context") \ diff --git a/deps/v8/src/compiler/js-global-object-specialization.cc b/deps/v8/src/compiler/js-global-object-specialization.cc index d8c9f17fd4c207..6239bf66d2881d 100644 --- a/deps/v8/src/compiler/js-global-object-specialization.cc +++ b/deps/v8/src/compiler/js-global-object-specialization.cc @@ -182,6 +182,13 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) { Node* check = graph()->NewNode(simplified()->ObjectIsSmi(), value); Type* property_cell_value_type = Type::TaggedSigned(); if (property_cell_value->IsHeapObject()) { + // We cannot do anything if the {property_cell_value}s map is no + // longer stable. + Handle property_cell_value_map( + Handle::cast(property_cell_value)->map(), isolate()); + if (!property_cell_value_map->is_stable()) return NoChange(); + dependencies()->AssumeMapStable(property_cell_value_map); + // Deoptimize if the {value} is a Smi. control = graph()->NewNode(common()->DeoptimizeIf(), check, frame_state, effect, control); @@ -190,8 +197,6 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) { Node* value_map = effect = graph()->NewNode(simplified()->LoadField(AccessBuilder::ForMap()), value, effect, control); - Handle property_cell_value_map( - Handle::cast(property_cell_value)->map(), isolate()); check = graph()->NewNode( simplified()->ReferenceEqual(Type::Any()), value_map, jsgraph()->HeapConstant(property_cell_value_map)); diff --git a/deps/v8/src/crankshaft/hydrogen.cc b/deps/v8/src/crankshaft/hydrogen.cc index 295b2c94557ecc..5a37411834e72c 100644 --- a/deps/v8/src/crankshaft/hydrogen.cc +++ b/deps/v8/src/crankshaft/hydrogen.cc @@ -6908,11 +6908,19 @@ void HOptimizedGraphBuilder::HandleGlobalVariableAssignment( access = access.WithRepresentation(Representation::Smi()); break; case PropertyCellConstantType::kStableMap: { - // The map may no longer be stable, deopt if it's ever different from - // what is currently there, which will allow for restablization. - Handle map(HeapObject::cast(cell->value())->map()); + // First check that the previous value of the {cell} still has the + // map that we are about to check the new {value} for. If not, then + // the stable map assumption was invalidated and we cannot continue + // with the optimized code. + Handle cell_value(HeapObject::cast(cell->value())); + Handle cell_value_map(cell_value->map()); + if (!cell_value_map->is_stable()) { + return Bailout(kUnstableConstantTypeHeapObject); + } + top_info()->dependencies()->AssumeMapStable(cell_value_map); + // Now check that the new {value} is a HeapObject with the same map. Add(value); - value = Add(value, map); + value = Add(value, cell_value_map); access = access.WithRepresentation(Representation::HeapObject()); break; } diff --git a/deps/v8/src/runtime/runtime-utils.h b/deps/v8/src/runtime/runtime-utils.h index 17c78d5a0b5ca5..7f2829861d55b2 100644 --- a/deps/v8/src/runtime/runtime-utils.h +++ b/deps/v8/src/runtime/runtime-utils.h @@ -115,9 +115,11 @@ namespace internal { // Assert that the given argument has a valid value for a LanguageMode // and store it in a LanguageMode variable with the given name. #define CONVERT_LANGUAGE_MODE_ARG_CHECKED(name, index) \ - RUNTIME_ASSERT(args[index]->IsSmi()); \ - RUNTIME_ASSERT(is_valid_language_mode(args.smi_at(index))); \ - LanguageMode name = static_cast(args.smi_at(index)); + RUNTIME_ASSERT(args[index]->IsNumber()); \ + int32_t __tmp_##name = 0; \ + RUNTIME_ASSERT(args[index]->ToInt32(&__tmp_##name)); \ + RUNTIME_ASSERT(is_valid_language_mode(__tmp_##name)); \ + LanguageMode name = static_cast(__tmp_##name); // Assert that the given argument is a number within the Int32 range diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-659475-1.js b/deps/v8/test/mjsunit/regress/regress-crbug-659475-1.js new file mode 100644 index 00000000000000..7b996237412e25 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-659475-1.js @@ -0,0 +1,30 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +var n; + +function Ctor() { + n = new Set(); +} + +function Check() { + n.xyz = 0x826852f4; +} + +Ctor(); +Ctor(); +%OptimizeFunctionOnNextCall(Ctor); +Ctor(); + +Check(); +Check(); +%OptimizeFunctionOnNextCall(Check); +Check(); + +Ctor(); +Check(); + +parseInt('AAAAAAAA'); \ No newline at end of file diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-659475-2.js b/deps/v8/test/mjsunit/regress/regress-crbug-659475-2.js new file mode 100644 index 00000000000000..a992570af4e09b --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-659475-2.js @@ -0,0 +1,31 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --allow-natives-syntax + +var n; + +function Ctor() { + try { } catch (e) {} + n = new Set(); +} + +function Check() { + n.xyz = 0x826852f4; +} + +Ctor(); +Ctor(); +%OptimizeFunctionOnNextCall(Ctor); +Ctor(); + +Check(); +Check(); +%OptimizeFunctionOnNextCall(Check); +Check(); + +Ctor(); +Check(); + +parseInt('AAAAAAAA'); \ No newline at end of file From 5c0d82bae63949d6f35c35dbb9c2fd5d09f4068a Mon Sep 17 00:00:00 2001 From: Wayne Andrews Date: Fri, 14 Oct 2016 13:33:25 +0100 Subject: [PATCH 175/313] build: Add option to compile for coverage reports Add --coverage option to configure to support compiling for generation of C based coverage reports PR-URL: https://github.com/nodejs/node/pull/9463 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Michael Dawson --- configure | 10 ++++++++++ node.gyp | 13 ++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 53fed14efccae4..377e82d095d642 100755 --- a/configure +++ b/configure @@ -59,6 +59,11 @@ parser.add_option('--prefix', default='/usr/local', help='select the install prefix [default: %default]') +parser.add_option('--coverage', + action='store_true', + dest='coverage', + help='Build node with code coverage enabled') + parser.add_option('--debug', action='store_true', dest='debug', @@ -863,6 +868,11 @@ def configure_node(o): if options.use_xcode and options.use_ninja: raise Exception('--xcode and --ninja cannot be used together.') + if options.coverage: + o['variables']['coverage'] = 'true' + else: + o['variables']['coverage'] = 'false' + def configure_library(lib, output): shared_lib = 'shared_' + lib output['variables']['node_' + shared_lib] = b(getattr(options, shared_lib)) diff --git a/node.gyp b/node.gyp index f252ad2563a0c6..23a71cc96b9311 100644 --- a/node.gyp +++ b/node.gyp @@ -547,11 +547,22 @@ 'NODE_PLATFORM="sunos"', ], }], - [ '(OS=="freebsd" or OS=="linux") and node_shared=="false"', { + [ '(OS=="freebsd" or OS=="linux") and node_shared=="false" and coverage=="false"', { 'ldflags': [ '-Wl,-z,noexecstack', '-Wl,--whole-archive <(V8_BASE)', '-Wl,--no-whole-archive' ] }], + [ '(OS=="freebsd" or OS=="linux") and node_shared=="false" and coverage=="true"', { + 'ldflags': [ '-Wl,-z,noexecstack', + '-Wl,--whole-archive <(V8_BASE)', + '-Wl,--no-whole-archive', + '--coverage', + '-g', + '-O0' ], + 'cflags': [ '--coverage', + '-g', + '-O0' ] + }], [ 'OS=="sunos"', { 'ldflags': [ '-Wl,-M,/usr/lib/ld/map.noexstk' ], }], From f707b006eb874bdb86ef19b00966ae5004832d39 Mon Sep 17 00:00:00 2001 From: Oscar Morrison Date: Wed, 27 Jul 2016 08:39:18 -0400 Subject: [PATCH 176/313] doc: add npm link to README PR-URL: https://github.com/nodejs/node/pull/7894 Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Roman Reiss Reviewed-By: Luigi Pinca --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 86eef0065cd7af..f8cc58c8310136 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@ Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and -efficient. The Node.js package ecosystem, npm, is the largest ecosystem of open -source libraries in the world. +efficient. The Node.js package ecosystem, [npm][], is the largest ecosystem of +open source libraries in the world. The Node.js project is supported by the [Node.js Foundation](https://nodejs.org/en/foundation/). Contributions, @@ -391,6 +391,7 @@ keys: * **Timothy J Fontaine** <tjfontaine@gmail.com> `7937DFD2AB06298B2293C3187D33FF9D0246406D` +[npm]: https://www.npmjs.com [Website]: https://nodejs.org/en/ [Contributing to the project]: CONTRIBUTING.md [Node.js Help]: https://github.com/nodejs/help From 2ffd13e90de5275c1dd12115a3c7b07d0386ece1 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 7 Nov 2016 13:34:54 -0800 Subject: [PATCH 177/313] test: move tick-processor tests to own directory The tick-processor tests are inherently non-deterministic. They therefore have false negatives from time to time. They also sometimes leave extra processes running. Move them to their own directory until these issues are sorted. Note that this means that the tests will not be run in CI. Like the inspector tests and other tests, they will have to be run manually when they are wanted. PR-URL: https://github.com/nodejs/node/pull/9506 Reviewed-By: Daniel Bevenius Reviewed-By: Matthew Loring Reviewed-By: Gibson Fahnestock --- Makefile | 3 +++ test/README.md | 11 +++++++++++ test/parallel/parallel.status | 1 - .../test-tick-processor-builtin.js | 0 .../test-tick-processor-cpp-core.js | 0 .../test-tick-processor-unknown.js | 6 +++--- test/tick-processor/testcfg.py | 6 ++++++ .../tick-processor-base.js | 0 vcbuild.bat | 1 + 9 files changed, 24 insertions(+), 4 deletions(-) rename test/{parallel => tick-processor}/test-tick-processor-builtin.js (100%) rename test/{parallel => tick-processor}/test-tick-processor-cpp-core.js (100%) rename test/{parallel => tick-processor}/test-tick-processor-unknown.js (82%) create mode 100644 test/tick-processor/testcfg.py rename test/{parallel => tick-processor}/tick-processor-base.js (100%) diff --git a/Makefile b/Makefile index cd4c582741df0a..efd4e7599c5efe 100644 --- a/Makefile +++ b/Makefile @@ -238,6 +238,9 @@ test-debugger: all test-inspector: all $(PYTHON) tools/test.py inspector +test-tick-processor: all + $(PYTHON) tools/test.py tick-processor + test-known-issues: all $(PYTHON) tools/test.py known_issues diff --git a/test/README.md b/test/README.md index ca4f515ced4407..736de97b71a848 100644 --- a/test/README.md +++ b/test/README.md @@ -122,6 +122,17 @@ Various tests that are run sequentially. Test configuration utility used by various test suites. +### tick-processor + +Tests for the V8 tick processor integration. The tests are for the logic in +`lib/internal/v8_prof_processor.js` and `lib/internal/v8_prof_polyfill.js`. The +tests confirm that the profile processor packages the correct set of scripts +from V8 and introduces the correct platform specific logic. + +| Runs on CI | +|:----------:| +| No | + ### timers Tests for [timing utilities](https://nodejs.org/api/timers.html) (`setTimeout` diff --git a/test/parallel/parallel.status b/test/parallel/parallel.status index a58d09fc156519..9acedf015f9e9e 100644 --- a/test/parallel/parallel.status +++ b/test/parallel/parallel.status @@ -16,7 +16,6 @@ prefix parallel [$system==solaris] # Also applies to SmartOS test-debug-signal-cluster : PASS,FLAKY -test-tick-processor-unknown: PASS,FLAKY [$system==freebsd] diff --git a/test/parallel/test-tick-processor-builtin.js b/test/tick-processor/test-tick-processor-builtin.js similarity index 100% rename from test/parallel/test-tick-processor-builtin.js rename to test/tick-processor/test-tick-processor-builtin.js diff --git a/test/parallel/test-tick-processor-cpp-core.js b/test/tick-processor/test-tick-processor-cpp-core.js similarity index 100% rename from test/parallel/test-tick-processor-cpp-core.js rename to test/tick-processor/test-tick-processor-cpp-core.js diff --git a/test/parallel/test-tick-processor-unknown.js b/test/tick-processor/test-tick-processor-unknown.js similarity index 82% rename from test/parallel/test-tick-processor-unknown.js rename to test/tick-processor/test-tick-processor-unknown.js index c886f648be4dc5..ab3d110ccff012 100644 --- a/test/parallel/test-tick-processor-unknown.js +++ b/test/tick-processor/test-tick-processor-unknown.js @@ -2,12 +2,12 @@ const common = require('../common'); // TODO(mhdawson) Currently the test-tick-processor functionality in V8 -// depends on addresses being smaller than a full 64 bits. Aix supports +// depends on addresses being smaller than a full 64 bits. AIX supports // the full 64 bits and the result is that it does not process the // addresses correctly and runs out of memory // Disabling until we get a fix upstreamed into V8 if (common.isAix) { - common.skip('Aix address range too big for scripts.'); + common.skip('AIX address range too big for scripts.'); return; } @@ -21,7 +21,7 @@ const base = require('./tick-processor-base.js'); // Unknown checked for to prevent flakiness, if pattern is not found, // then a large number of unknown ticks should be present base.runTest({ - pattern: /LazyCompile.*\[eval\]:1|.*% UNKNOWN/, + pattern: /LazyCompile.*\[eval]:1|.*% UNKNOWN/, code: `function f() { for (var i = 0; i < 1000000; i++) { i++; diff --git a/test/tick-processor/testcfg.py b/test/tick-processor/testcfg.py new file mode 100644 index 00000000000000..42e98355a5823f --- /dev/null +++ b/test/tick-processor/testcfg.py @@ -0,0 +1,6 @@ +import sys, os +sys.path.append(os.path.join(os.path.dirname(__file__), '..')) +import testpy + +def GetConfiguration(context, root): + return testpy.SimpleTestConfiguration(context, root, 'tick-processor') diff --git a/test/parallel/tick-processor-base.js b/test/tick-processor/tick-processor-base.js similarity index 100% rename from test/parallel/tick-processor-base.js rename to test/tick-processor/tick-processor-base.js diff --git a/vcbuild.bat b/vcbuild.bat index 6856050cbaeae9..3cf7fe910a6f26 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -63,6 +63,7 @@ if /i "%1"=="test-simple" set test_args=%test_args% sequential parallel -J&got if /i "%1"=="test-message" set test_args=%test_args% message&goto arg-ok if /i "%1"=="test-gc" set test_args=%test_args% gc&set buildnodeweak=1&goto arg-ok if /i "%1"=="test-inspector" set test_args=%test_args% inspector&goto arg-ok +if /i "%1"=="test-tick-processor" set test_args=%test_args% tick-processor&goto arg-ok if /i "%1"=="test-internet" set test_args=%test_args% internet&goto arg-ok if /i "%1"=="test-pummel" set test_args=%test_args% pummel&goto arg-ok if /i "%1"=="test-all" set test_args=%test_args% sequential parallel message gc inspector internet pummel&set buildnodeweak=1&set jslint=1&goto arg-ok From 2d581f1cb55b85ecdc6b3d4d4a90d3d72d3875cb Mon Sep 17 00:00:00 2001 From: Andreas Lind Date: Wed, 2 Nov 2016 23:21:54 +0100 Subject: [PATCH 178/313] doc: Fix inaccuracy in https.request docs PR-URL: https://github.com/nodejs/node/pull/9453 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Roman Reiss Reviewed-By: Sam Roberts Reviewed-By: Michael Dawson --- doc/api/https.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/doc/api/https.md b/doc/api/https.md index 3af6dedcd914e7..c2231dca1830e5 100644 --- a/doc/api/https.md +++ b/doc/api/https.md @@ -192,8 +192,7 @@ The options argument has the following options - `false`: opts out of connection pooling with an Agent, defaults request to `Connection: close`. -The following options from [`tls.connect()`][] can also be specified. However, a -[`globalAgent`][] silently ignores these. +The following options from [`tls.connect()`][] can also be specified: - `pfx`: Certificate, Private key and CA certificates to use for SSL. Default `null`. - `key`: Private key to use for SSL. Default `null`. From 16b53141f7cce6e3f692f41f526f96eb62d308ab Mon Sep 17 00:00:00 2001 From: timathon Date: Wed, 9 Nov 2016 12:07:49 +0800 Subject: [PATCH 179/313] doc: fix link to Event Loop page PR-URL: https://github.com/nodejs/node/pull/9527 Reviewed-By: Roman Reiss Reviewed-By: Colin Ihrig --- doc/guides/timers-in-node.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/guides/timers-in-node.md b/doc/guides/timers-in-node.md index 6cdbd35b21ffa7..818cc793437cad 100644 --- a/doc/guides/timers-in-node.md +++ b/doc/guides/timers-in-node.md @@ -10,7 +10,7 @@ period of time. Timers do not need to be imported via `require()`, since all the methods are available globally to emulate the browser JavaScript API. To fully understand when timer functions will be executed, it's a good idea to read up on the the Node.js -[Event Loop](../topics/event-loop-timers-and-nexttick). +[Event Loop](../topics/event-loop-timers-and-nexttick.md). ## Controlling the Time Continuum with Node.js @@ -96,7 +96,7 @@ some major ways they differ. The first is that `process.nextTick()` will run *before* any `Immediate`s that are set as well as before any scheduled I/O. The second is that `process.nextTick()` is non-clearable, meaning once code has been scheduled to execute with `process.nextTick()`, the execution -cannot be stopped, just like with a normal function. Refer to [this guide](../topics/event-loop-timers-and-nexttick#processnexttick) +cannot be stopped, just like with a normal function. Refer to [this guide](../topics/event-loop-timers-and-nexttick.md#processnexttick) to better understand the operation of `process.nextTick()`. ### "Infinite Loop" Execution ~ *`setInterval()`* From 6f850f4037df96ff10c557ef8ecec41032867155 Mon Sep 17 00:00:00 2001 From: Jeremiah Senkpiel Date: Mon, 7 Nov 2016 09:27:37 -0500 Subject: [PATCH 180/313] doc: clarify the exit code part of writing_tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/9502 Reviewed-By: Santiago Gimeno Reviewed-By: James M Snell Reviewed-By: Michaël Zasso Reviewed-By: Daniel Bevenius Reviewed-By: Luigi Pinca --- doc/guides/writing_tests.md | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/doc/guides/writing_tests.md b/doc/guides/writing_tests.md index 169a9c8e5fa11f..d00be9cdbcc4c6 100644 --- a/doc/guides/writing_tests.md +++ b/doc/guides/writing_tests.md @@ -3,11 +3,13 @@ ## What is a test? A test must be a node script that exercises a specific functionality provided -by node and checks that it behaves as expected. It should return 0 on success, +by node and checks that it behaves as expected. It should exit with code `0` on success, otherwise it will fail. A test will fail if: -- It exits by calling `process.exit(code)` where `code != 0` -- It exits due to an uncaught exception. +- It exits by setting `process.exitCode` to a non-zero number. + - This is most often done by having an assertion throw an uncaught + Error. + - Occasionally, using `process.exit(code)` may be appropriate. - It never exits. In this case, the test runner will terminate the test because it sets a maximum time limit. From ff8c31abfd73a8740015a676bacd99450a28137b Mon Sep 17 00:00:00 2001 From: Ryan Lewis Date: Sun, 6 Nov 2016 13:29:59 -0800 Subject: [PATCH 181/313] doc: grammar and structure revisions of wg doc PR-URL: https://github.com/nodejs/node/pull/9495 Reviewed-By: James M Snell Reviewed-By: Roman Reiss --- WORKING_GROUPS.md | 203 ++++++++++++++++++++++------------------------ 1 file changed, 99 insertions(+), 104 deletions(-) diff --git a/WORKING_GROUPS.md b/WORKING_GROUPS.md index ab24942aecffcf..4be238b4ac4ace 100644 --- a/WORKING_GROUPS.md +++ b/WORKING_GROUPS.md @@ -41,66 +41,65 @@ back in to the CTC. ### [Website](https://github.com/nodejs/nodejs.org) -The website working group's purpose is to build and maintain a public -website for the `Node.js` project. +The website Working Group's purpose is to build and maintain a public +website for the Node.js project. -Its responsibilities are: -* Develop and maintain a build and automation system for `nodejs.org`. -* Ensure the site is regularly updated with changes made to `Node.js` like -releases and features. -* Foster and enable a community of translators. +Responsibilities include: +* Developing and maintaining a build and automation system for nodejs.org. +* Ensuring the site is regularly updated with changes made to Node.js, like + releases and features. +* Fostering and enabling a community of translators. ### [Streams](https://github.com/nodejs/readable-stream) -The Streams WG is dedicated to the support and improvement of the Streams API -as used in Node.js and the npm ecosystem. We seek to create a composable API that -solves the problem of representing multiple occurrences of an event over time -in a humane, low-overhead fashion. Improvements to the API will be driven by -the needs of the ecosystem; interoperability and backwards compatibility with -other solutions and prior versions are paramount in importance. Our -responsibilities include: +The Streams Working Group is dedicated to the support and improvement of the +Streams API as used in Node.js and the npm ecosystem. We seek to create a +composable API that solves the problem of representing multiple occurrences +of an event over time in a humane, low-overhead fashion. Improvements to the +API will be driven by the needs of the ecosystem; interoperability and +backwards compatibility with other solutions and prior versions are paramount +in importance. +Responsibilities include: * Addressing stream issues on the Node.js issue tracker. * Authoring and editing stream documentation within the Node.js project. * Reviewing changes to stream subclasses within the Node.js project. * Redirecting changes to streams from the Node.js project to this project. * Assisting in the implementation of stream providers within Node.js. -* Recommending versions of readable-stream to be included in Node.js. -* Messaging about the future of streams to give the community advance notice of changes. - +* Recommending versions of `readable-stream` to be included in Node.js. +* Messaging about the future of streams to give the community advance notice of + changes. ### [Build](https://github.com/nodejs/build) -The build working group's purpose is to create and maintain a -distributed automation infrastructure. - -Its responsibilities are: -* Produce Packages for all target platforms. -* Run tests. -* Run performance testing and comparisons. -* Creates and manages build-containers. +The Build Working Group's purpose is to create and maintain a distributed +automation infrastructure. +Responsibilities include: +* Producing packages for all target platforms. +* Running tests. +* Running performance testing and comparisons. +* Creating and managing build-containers. ### [Diagnostics](https://github.com/nodejs/diagnostics) -The diagnostics working group's purpose is to surface a set of comprehensive, -documented, and extensible diagnostic interfaces for use by -Node.js tools and JavaScript VMs. - -Its responsibilities are: - -* Collaborate with V8 to integrate `v8_inspector` into Node.js. -* Collaborate with V8 to integrate `trace_event` into Node.js. -* Collaborate with Core to refine `async_wrap` and `async_hooks`. -* Maintain and improve OS trace system integration (e.g. ETW, LTTNG, dtrace). -* Document diagnostic capabilities and APIs in Node.js and its components. -* Explore opportunities and gaps, discuss feature requests, and address +The Diagnostics Working Group's purpose is to surface a set of comprehensive, +documented, and extensible diagnostic interfaces for use by Node.js tools and +JavaScript VMs. + +Responsibilities include: +* Collaborating with V8 to integrate `v8_inspector` into Node.js. +* Collaborating with V8 to integrate `trace_event` into Node.js. +* Collaborating with Core to refine `async_wrap` and `async_hooks`. +* Maintaining and improving OS trace system integration (e.g. ETW, LTTNG, dtrace). +* Documenting diagnostic capabilities and APIs in Node.js and its components. +* Exploring opportunities and gaps, discussing feature requests, and addressing conflicts in Node.js diagnostics. -* Foster an ecosystem of diagnostics tools for Node.js. +* Fostering an ecosystem of diagnostics tools for Node.js. ### i18n -The i18n working groups handle more than just translations. They +The i18n Working Groups handle more than just translations. They are endpoints for community members to collaborate with each other in their language of choice. @@ -108,16 +107,14 @@ Each team is organized around a common spoken language. Each language community might then produce multiple localizations for various project resources. -Their responsibilities are: -* Translations of any Node.js materials they believe are relevant to their -community. -* Review processes for keeping translations up -to date and of high quality. -* Social media channels in their language. -* Promotion of Node.js speakers for meetups and conferences in their -language. +Responsibilities include: +* Translating any Node.js materials they believe are relevant to their + community. +* Reviewing processes for keeping translations up to date and of high quality. +* Managing and monitoring social media channels in their language. +* Promoting Node.js speakers for meetups and conferences in their language. -Note that the i18n working groups are distinct from the [Intl](#Intl) working group. +Note that the i18n Working Groups are distinct from the [Intl](#Intl) Working Group. Each language community maintains its own membership. @@ -159,33 +156,37 @@ Each language community maintains its own membership. ### [Intl](https://github.com/nodejs/Intl) The Intl Working Group is dedicated to support and improvement of -Internationalization (i18n) and Localization (l10n) in Node. Its responsibilities are: +Internationalization (i18n) and Localization (l10n) in Node. -1. Functionality & compliance (standards: ECMA, Unicode…) -2. Support for Globalization and Internationalization issues that come up in the tracker -3. Guidance and Best Practices -4. Refinement of existing `Intl` implementation +Responsibilities include: +* Ensuring functionality & compliance (standards: ECMA, Unicode…) +* Supporting Globalization and Internationalization issues that come up + in the tracker +* Communicating guidance and best practices +* Refining the existing `Intl` implementation -The Intl WG is not responsible for translation of content. That is the responsibility of the specific [i18n](#i18n) group for each language. +The Intl Working Group is not responsible for translation of content. That is the +responsibility of the specific [i18n](#i18n) group for each language. ### [Evangelism](https://github.com/nodejs/evangelism) -The evangelism working group promotes the accomplishments +The Evangelism Working Group promotes the accomplishments of Node.js and lets the community know how they can get involved. -Their responsibilities are: -* Project messaging. -* Official project social media. -* Promotion of speakers for meetups and conferences. -* Promotion of community events. +Responsibilities include: +* Facilitating project messaging. +* Managing official project social media. +* Handling the promotion of speakers for meetups and conferences. +* Handling the promotion of community events. * Publishing regular update summaries and other promotional -content. + content. ### [HTTP](https://github.com/nodejs/http) -The HTTP working group is chartered for the support and improvement of the -HTTP implementation in Node. Its responsibilities are: +The HTTP Working Group is chartered for the support and improvement of the +HTTP implementation in Node.js. +Responsibilities include: * Addressing HTTP issues on the Node.js issue tracker. * Authoring and editing HTTP documentation within the Node.js project. * Reviewing changes to HTTP functionality within the Node.js project. @@ -197,39 +198,36 @@ HTTP implementation in Node. Its responsibilities are: ### [Roadmap](https://github.com/nodejs/roadmap) -The roadmap working group is responsible for user community outreach +The Roadmap Working Group is responsible for user community outreach and the translation of their concerns into a plan of action for Node.js. The final [ROADMAP](./ROADMAP.md) document is still owned by the TC and requires the same approval for changes as any other project asset. Their responsibilities are: -* Attract and summarize user community needs and feedback. -* Find or potentially create tools that allow for broader participation. -* Create Pull Requests for relevant changes to [Roadmap.md](./ROADMAP.md) - +* Attracting and summarizing user community needs and feedback. +* Finding or potentially creating tools that allow for broader participation. +* Creating Pull Requests for relevant changes to [ROADMAP.md](./ROADMAP.md) ### [Docker](https://github.com/nodejs/docker-iojs) -The Docker working group's purpose is to build, maintain, and improve official -Docker images for the `Node.js` project. +The Docker Working Group's purpose is to build, maintain, and improve official +Docker images for the Node.js project. -Their responsibilities are: -* Keep the official Docker images updated in line with new `Node.js` releases. +Responsibilities include: +* Keeping the official Docker images updated in line with new Node.js releases. * Decide and implement image improvements and/or fixes. * Maintain and improve the images' documentation. - ### [Addon API](https://github.com/nodejs/nan) The Addon API Working Group is responsible for maintaining the NAN project and corresponding _nan_ package in npm. The NAN project makes available an -abstraction layer for native add-on authors for both Node.js and Node.js, +abstraction layer for native add-on authors for Node.js, assisting in the writing of code that is compatible with many actively used -versions of Node.js, Node.js, V8 and libuv. - -Their responsibilities are: +versions of Node.js, V8 and libuv. +Responsibilities include: * Maintaining the [NAN](https://github.com/nodejs/nan) GitHub repository, including code, issues and documentation. * Maintaining the [addon-examples](https://github.com/nodejs/node-addon-examples) @@ -247,48 +245,46 @@ The current members can be found in their ### [Benchmarking](https://github.com/nodejs/benchmarking) -The purpose of the Benchmark working group is to gain consensus -for an agreed set of benchmarks that can be used to: +The purpose of the Benchmark Working Group is to gain consensus +on an agreed set of benchmarks that can be used to: -+ track and evangelize performance gains made between Node releases -+ avoid performance regressions between releases +* track and evangelize performance gains made between Node.js releases +* avoid performance regressions between releases -Its responsibilities are: - -+ Identify 1 or more benchmarks that reflect customer usage. - Likely need more than one to cover typical Node use cases - including low-latency and high concurrency -+ Work to get community consensus on the list chosen -+ Add regular execution of chosen benchmarks to Node builds -+ Track/publicize performance between builds/releases +Responsibilities include: +* Identifying 1 or more benchmarks that reflect customer usage. + Likely will need more than one to cover typical Node.js use cases + including low-latency and high concurrency +* Working to get community consensus on the list chosen +* Adding regular execution of chosen benchmarks to Node.js builds +* Tracking/publicizing performance between builds/releases ### [Post-mortem](https://github.com/nodejs/post-mortem) -The Post-mortem Diagnostics working group is dedicated to the support +The Post-mortem Diagnostics Working Group is dedicated to the support and improvement of postmortem debugging for Node.js. It seeks to elevate the role of postmortem debugging for Node, to assist in the development of techniques and tools, and to make techniques and tools known and available to Node.js users. -Its responsibilities are: - -+ Defining and adding interfaces/APIs in order to allow dumps - to be generated when needed -+ Defining and adding common structures to the dumps generated - in order to support tools that want to introspect those dumps +Responsibilities include: +* Defining and adding interfaces/APIs in order to allow dumps + to be generated when needed. +* Defining and adding common structures to the dumps generated + in order to support tools that want to introspect those dumps. ### [Documentation](https://github.com/nodejs/docs) -The Documentation working group exists to support the improvement of Node.js +The Documentation Working Group exists to support the improvement of Node.js documentation, both in the core API documentation, and elsewhere, such as the -Node.js website. Its intent is to work closely with Evangelism, Website, and -Intl working groups to make excellent documentation available and accessible +Node.js website. Its intent is to work closely with the Evangelism, Website, and +Intl Working Groups to make excellent documentation available and accessible to all. -Its responsibilities are: - +Responsibilities include: * Defining and maintaining documentation style and content standards. -* Producing documentation in a format acceptable for the Website WG to consume. +* Producing documentation in a format acceptable for the Website Working Group + to consume. * Ensuring that Node's documentation addresses a wide variety of audiences. * Creating and operating a process for documentation review that produces quality documentation and avoids impeding the progress of Core work. @@ -298,8 +294,7 @@ Its responsibilities are: The Node.js Testing Working Group's purpose is to extend and improve testing of the Node.js source code. -Its responsibilities are: - +Responsibilities include: * Coordinating an overall strategy for improving testing. * Documenting guidelines around tests. * Working with the Build Working Group to improve continuous integration. From cb367ec1b3fe831c28a10b341043928f2f165144 Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 10 Nov 2016 20:19:56 +0100 Subject: [PATCH 182/313] doc: fix minor style issue in code examples I've noticed that a few of the code examples have an minor indentation issue with the first line, for example: https://nodejs.org/api/child_process.html#child_process_child_process This commit attempt to fix this issue by using the solution provided provided by silverwind and hiendv. Fixes: https://github.com/nodejs/node/issues/9381 PR-URL: https://github.com/nodejs/node/pull/9482 Reviewed-By: James M Snell Reviewed-By: Roman Reiss --- doc/api_assets/style.css | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/api_assets/style.css b/doc/api_assets/style.css index 1e82464cc93b79..c187079a26f98e 100644 --- a/doc/api_assets/style.css +++ b/doc/api_assets/style.css @@ -274,6 +274,7 @@ pre { pre > code { font-size: .8em; + padding: 0; } pre + h3 { From 3219ecea2a55e63945aefd1aea01ef9435bd5421 Mon Sep 17 00:00:00 2001 From: Timothy Date: Mon, 7 Nov 2016 18:36:40 -0500 Subject: [PATCH 183/313] doc: fix fs constants link https://nodejs.org/api/fs.html#fs_fs_constants links to itself rather than to https://nodejs.org/api/fs.html#fs_fs_constants_1 PR-URL: https://github.com/nodejs/node/pull/9508 Reviewed-By: Luigi Pinca Reviewed-By: Evan Lucas Reviewed-By: Colin Ihrig Reviewed-By: Prince John Wesley Reviewed-By: Roman Reiss --- doc/api/fs.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 863b697446e50e..0802cdade17499 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -2209,7 +2209,7 @@ The following constants are meant for use with the [`fs.Stats`][] object's [Readable Stream]: stream.html#stream_class_stream_readable [Writable Stream]: stream.html#stream_class_stream_writable [inode]: https://en.wikipedia.org/wiki/Inode -[FS Constants]: #fs_fs_constants +[FS Constants]: #fs_fs_constants_1 [`inotify`]: http://man7.org/linux/man-pages/man7/inotify.7.html [`kqueue`]: https://www.freebsd.org/cgi/man.cgi?kqueue [`FSEvents`]: https://developer.apple.com/library/mac/documentation/Darwin/Conceptual/FSEvents_ProgGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40005289-CH1-SW1 From 0088ed87ea2da7e29c013d3284fed768809e12b0 Mon Sep 17 00:00:00 2001 From: William Kapke Date: Thu, 10 Nov 2016 23:20:43 +0000 Subject: [PATCH 184/313] doc: remove Roadmap Working Group MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs: https://github.com/nodejs/CTC/issues/16 PR-URL: https://github.com/nodejs/node/pull/9545 Reviewed-By: Ben Noordhuis Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: Evan Lucas Reviewed-By: Colin Ihrig Reviewed-By: Johan Bergström Reviewed-By: Michael Dawson Reviewed-By: Roman Reiss --- WORKING_GROUPS.md | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/WORKING_GROUPS.md b/WORKING_GROUPS.md index 4be238b4ac4ace..694325a0bfcf95 100644 --- a/WORKING_GROUPS.md +++ b/WORKING_GROUPS.md @@ -24,7 +24,6 @@ back in to the CTC. * [Diagnostics](#diagnostics) * [i18n](#i18n) * [Evangelism](#evangelism) -* [Roadmap](#roadmap) * [Docker](#docker) * [Addon API](#addon-api) * [Benchmarking](#benchmarking) @@ -196,19 +195,6 @@ Responsibilities include: * Messaging about the future of HTTP to give the community advance notice of changes. -### [Roadmap](https://github.com/nodejs/roadmap) - -The Roadmap Working Group is responsible for user community outreach -and the translation of their concerns into a plan of action for Node.js. - -The final [ROADMAP](./ROADMAP.md) document is still owned by the TC and requires -the same approval for changes as any other project asset. - -Their responsibilities are: -* Attracting and summarizing user community needs and feedback. -* Finding or potentially creating tools that allow for broader participation. -* Creating Pull Requests for relevant changes to [ROADMAP.md](./ROADMAP.md) - ### [Docker](https://github.com/nodejs/docker-iojs) The Docker Working Group's purpose is to build, maintain, and improve official From caa0a7876dd1bcbd723618bbfb5e794a8f45cfdc Mon Sep 17 00:00:00 2001 From: kohta ito Date: Sat, 12 Nov 2016 16:18:05 +0900 Subject: [PATCH 185/313] doc: fix the index order in pseudocode of modules fix the index order in pseudocode of modules. PR-URL: https://github.com/nodejs/node/pull/9562 Reviewed-By: Shigeki Ohtsu Reviewed-By: Yosuke Furukawa Reviewed-By: Roman Reiss --- doc/api/modules.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/modules.md b/doc/api/modules.md index 66ac1ce22c2bca..e496dbe1ac52e2 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -181,9 +181,9 @@ NODE_MODULES_PATHS(START) 3. let DIRS = [] 4. while I >= 0, a. if PARTS[I] = "node_modules" CONTINUE - c. DIR = path join(PARTS[0 .. I] + "node_modules") - b. DIRS = DIRS + DIR - c. let I = I - 1 + b. DIR = path join(PARTS[0 .. I] + "node_modules") + c. DIRS = DIRS + DIR + d. let I = I - 1 5. return DIRS ``` From 97093314c2d2d891af692c0b740c139f9ddeef38 Mon Sep 17 00:00:00 2001 From: ikasumi_wt Date: Sat, 12 Nov 2016 16:19:47 +0900 Subject: [PATCH 186/313] doc: fix e.g., to e.g. in doc/http.md fix e.g., to e.g. in doc/http.md Fixes: https://github.com/nodejs/code-and-learn/issues/58 PR-URL: https://github.com/nodejs/node/pull/9564 Reviewed-By: Yosuke Furukawa Reviewed-By: Roman Reiss Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: Shigeki Ohtsu --- doc/api/http.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/http.md b/doc/api/http.md index ecdde9b5d0f82e..60d141db6f34d3 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -550,7 +550,7 @@ with a `100 Continue` as appropriate. Handling this event involves calling [`response.writeContinue()`][] if the client should continue to send the request body, or generating an appropriate HTTP -response (e.g., 400 Bad Request) if the client should not continue to send the +response (e.g. 400 Bad Request) if the client should not continue to send the request body. Note that when this event is emitted and handled, the [`'request'`][] event will @@ -853,7 +853,7 @@ This method adds HTTP trailing headers (a header but at the end of the message) to the response. Trailers will **only** be emitted if chunked encoding is used for the -response; if it is not (e.g., if the request was HTTP/1.0), they will +response; if it is not (e.g. if the request was HTTP/1.0), they will be silently discarded. Note that HTTP requires the `Trailer` header to be sent if you intend to From 1bbc2c682a63a3f4ae3a20892aeebf2e17a1b738 Mon Sep 17 00:00:00 2001 From: Syuhei Kobayashi Date: Sat, 12 Nov 2016 16:36:09 +0900 Subject: [PATCH 187/313] doc: fix typo in doc/tls.md fix doc/tls.md: line 762 836 1026 e.g., => e.g. Fixes: https://github.com/nodejs/code-and-learn/issues/58 PR-URL: https://github.com/nodejs/node/pull/9566 Reviewed-By: Roman Reiss Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: Shigeki Ohtsu --- doc/api/tls.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/tls.md b/doc/api/tls.md index 6180d91b667e67..e1edcc8d053f71 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -759,7 +759,7 @@ added: v0.11.3 to be used when checking the server's hostname against the certificate. This should throw an error if verification fails. The method should return `undefined` if the `servername` and `cert` are verified. - * `secureProtocol` {string} The SSL method to use, e.g., `SSLv3_method` to + * `secureProtocol` {string} The SSL method to use, e.g. `SSLv3_method` to force SSL version 3. The possible values depend on the version of OpenSSL installed in the environment and are defined in the constant [SSL_METHODS][]. @@ -833,7 +833,7 @@ added: v0.11.3 to be used when checking the server's hostname against the certificate. This should throw an error if verification fails. The method should return `undefined` if the `servername` and `cert` are verified. - * `secureProtocol` {string} The SSL method to use, e.g., `SSLv3_method` to + * `secureProtocol` {string} The SSL method to use, e.g. `SSLv3_method` to force SSL version 3. The possible values depend on the version of OpenSSL installed in the environment and are defined in the constant [SSL_METHODS][]. @@ -1023,7 +1023,7 @@ added: v0.3.2 session resumption. If `requestCert` is `true`, the default is a 128 bit truncated SHA1 hash value generated from the command-line. Otherwise, a default is not provided. - * `secureProtocol` {string} The SSL method to use, e.g., `SSLv3_method` to + * `secureProtocol` {string} The SSL method to use, e.g. `SSLv3_method` to force SSL version 3. The possible values depend on the version of OpenSSL installed in the environment and are defined in the constant [SSL_METHODS][]. From 82fd0e192f839d609038f7a7db62763e90911f1d Mon Sep 17 00:00:00 2001 From: YutamaKotaro Date: Sat, 12 Nov 2016 16:36:06 +0900 Subject: [PATCH 188/313] doc: fix typo about cluster doc, (eg. -> e.g.) Fixes: https://github.com/nodejs/code-and-learn/issues/58 PR-URL: https://github.com/nodejs/node/pull/9568 Reviewed-By: Roman Reiss Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Shigeki Ohtsu --- doc/api/cluster.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/cluster.md b/doc/api/cluster.md index c239c44ffb7d5d..07fdfb67458dab 100644 --- a/doc/api/cluster.md +++ b/doc/api/cluster.md @@ -144,7 +144,7 @@ added: v0.11.2 --> * `code` {Number} the exit code, if it exited normally. -* `signal` {String} the name of the signal (eg. `'SIGHUP'`) that caused +* `signal` {String} the name of the signal (e.g. `'SIGHUP'`) that caused the process to be killed. Similar to the `cluster.on('exit')` event, but specific to this worker. @@ -496,7 +496,7 @@ added: v0.7.9 * `worker` {cluster.Worker} * `code` {Number} the exit code, if it exited normally. -* `signal` {String} the name of the signal (eg. `'SIGHUP'`) that caused +* `signal` {String} the name of the signal (e.g. `'SIGHUP'`) that caused the process to be killed. When any of the workers die the cluster module will emit the `'exit'` event. From c286f5719c4d67c4599c331884e721a5848ce88b Mon Sep 17 00:00:00 2001 From: Daijiro Yamada Date: Sat, 12 Nov 2016 16:24:46 +0900 Subject: [PATCH 189/313] doc: fix typo e.g., => e.g. Fixes: https://github.com/nodejs/code-and-learn/issues/58 PR-URL: https://github.com/nodejs/node/pull/9563 Reviewed-By: Yosuke Furukawa Reviewed-By: Roman Reiss Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: Shigeki Ohtsu --- doc/api/dns.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/dns.md b/doc/api/dns.md index 95592f9cc3f144..bfb0074e3c68e4 100644 --- a/doc/api/dns.md +++ b/doc/api/dns.md @@ -260,7 +260,7 @@ added: v0.1.90 Uses the DNS protocol to resolve name server records (`NS` records) for the `hostname`. The `addresses` argument passed to the `callback` function will contain an array of name server records available for `hostname` -(e.g., `['ns1.example.com', 'ns2.example.com']`). +(e.g. `['ns1.example.com', 'ns2.example.com']`). ## dns.resolveSoa(hostname, callback) As [`socket.connect(options[, connectListener])`][`socket.connect(options, connectListener)`], -with options either as either `{port: port, host: host}` or `{path: path}`. +with options as either `{port: port, host: host}` or `{path: path}`. ### socket.connecting -The `v8.setFlagsFromString()` method can be used to programmatically set +The `v8.setFlagsFromString()` method can be used to programmatically set V8 command line flags. This method should be used with care. Changing settings after the VM has started may result in unpredictable behavior, including crashes and data loss; or it may simply do nothing. From cf131bfa9072f8ad932b642d21054575831b54fc Mon Sep 17 00:00:00 2001 From: Ali Ijaz Sheikh Date: Wed, 23 Nov 2016 17:50:31 -0800 Subject: [PATCH 206/313] doc: add guide for maintaining V8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Ref: https://github.com/nodejs/LTS/pull/137 PR-URL: https://github.com/nodejs/node/pull/9777 Reviewed-By: mhdawson - Michael Dawson Reviewed-By: targos - Michaël Zasso --- doc/guides/maintaining-V8.md | 279 +++++++++++++++++++++++++++++++++++ 1 file changed, 279 insertions(+) create mode 100644 doc/guides/maintaining-V8.md diff --git a/doc/guides/maintaining-V8.md b/doc/guides/maintaining-V8.md new file mode 100644 index 00000000000000..82312cf6bcf4d1 --- /dev/null +++ b/doc/guides/maintaining-V8.md @@ -0,0 +1,279 @@ +# Maintaining V8 in Node + +# Background + +V8 follows the Chromium release schedule. The support horizon for Chromium is very different from the support horizon that Node.js needs to provide to its users. As a result Node.js needs to support a version of V8 for quite a bit longer than what upstream needs to support. Since V8 doesn't have an LTS supported branch, there is no official process around how the V8 branches in Node are maintained. + +This document attempts to document the current processes and proposes a workflow for maintaining the V8 branches in Node.js LTS and Current releases and how the Node and V8 teams at Google can help. + +# V8 Release Schedule + +V8 and Chromium follow a [roughly 6-week release cadence](https://www.chromium.org/developers/calendar). At any given time there are three V8 branches that are **active**. + +For example, at the time of this writing: + +* **Stable**: V8 5.4 is currently shipping as part of Chromium stable. This branch was created approx. 6 weeks before from when V8 5.3 shipped as stable. +* **Beta**: V8 5.5 is currently in beta. It will be promoted to stable next; approximately 6 weeks after V8 5.4 shipped as stable. +* **Master**: V8 tip-of-tree corresponds to V8 5.6. This branch gets regularly released as part of the Chromium **canary** builds. This branch will be promoted to beta next when V8 5.5 ships as stable. + +All older branches are considered **abandoned**, and are not maintained by the V8 team. + +## V8 merge process overview + +The process for backporting bug fixes to active branches is officially documented [on the V8 wiki](https://github.com/v8/v8/wiki/Merging%20&%20Patching). The summary of the process is: + +* V8 only supports active branches. There is no testing done on any branches older than the current stable/beta/master. +* A fix needing backport is tagged w/ *merge-request-x.x* tag. This can be done by anyone interested in getting the fix backported. Issues with this tag are reviewed by the V8 team regularly as candidates for backporting. +* Fixes need some 'baking time' before they can be approved for backporting. This means waiting a few days to ensure that no issues are detected on the canary/beta builds. +* Once ready, the issue is tagged w/ *merge-approved-x.x* and one can do the actual merge by using the scripts on the [wiki page](https://github.com/v8/v8/wiki/Merging%20&%20Patching). +* Merge requests to an abandoned branch will be rejected. +* Only bug fixes are accepted for backporting. + +# Node Support Requirements + +At any given time Node needs to be maintaining a few different V8 branches for the various Current, LTS, and nightly releases. At present this list includes the following branches1: + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Release + Support Start + Support End + V8 version + V8 branch released + V8 branch abandoned +
Node v4.x + 2015-10-01 + 2018-04-01 + 4.5 + 2015-09-01 + 2015-10-13 +
Node v6.x + 2016-04-01 + 2019-04-01 + 5.1 + 2016-05-31 + 2016-06-26 +
Node v7.x + 2016-10-01 + 2017-04-01 + 5.4 + 2016-10-18 + ~2016-12-01 +
master + N/A + N/A + 5.4 + 2016-10-18 + ~2016-12-01 +
+ + +The versions of V8 used in Node v4.x and v6.x have already been abandoned by upstream V8. However, Node.js needs to continue supporting these branches for many months (Current branches) or several years (LTS branches). + +# Maintenance Process + +Once a bug in Node.js has been identified to be caused by V8, the first step is to identify the versions of Node and V8 affected. The bug may be present in multiple different locations, each of which follows a slightly different process. + +* Unfixed bugs. The bug exists in the V8 master branch. +* Fixed, but needs backport. The bug may need porting to one or more branches. + * Backporting to active branches. + * Backporting to abandoned branches. +* Backports identified by the V8 team. Bugs identified by upstream V8 that we haven't encountered in Node yet. + +## Unfixed Upstream Bugs + +If the bug can be reproduced on the [`vee-eight-lkgr` branch](https://github.com/v8/node/tree/vee-eight-lkgr), Chromium canary, or V8 tip-of-tree, and the test case is valid, then the bug needs to be fixed upstream first. + +* Start by opening a bug upstream [using this template](https://bugs.chromium.org/p/v8/issues/entry?template=Node.js%20upstream%20bug). +* Make sure to include a link to the corresponding Node.js issue (if one exists). +* If the fix is simple enough, you may fix it yourself; [contributions](https://github.com/v8/v8/wiki/Contributing) are welcome. +* V8's build waterfall tests your change. +* Once the bug is fixed it may still need backporting, if it exists in other V8 branches that are still active or are branches that Node cares about. Follow the process for backporting below. + +## Backporting to Active Branches + +If the bug exists in any of the active V8 branches, we may need to get the fix backported. At any given time there are [two active branches](https://build.chromium.org/p/client.v8.branches/console) (beta and stable) in addition to master. The following steps are needed to backport the fix: + +* Identify which version of V8 the bug was fixed in. +* Identify if any active V8 branches still contain the bug: +* A tracking bug is needed to request a backport. + * If there isn't already a V8 bug tracking the fix, open a new merge request bug using this [Node.js specific template](https://bugs.chromium.org/p/v8/issues/entry?template=Node.js%20merge%20request). + * If a bug already exists + * Add a reference to the GitHub issue. + * Attach *merge-request-x.x* labels to the bug for any active branches that still contain the bug. (e.g. merge-request-5.3, merge-request-5.4) + * Add ofrobots-at-google.com to the cc list. +* Once the merge has been approved, it should be merged using the [merge script documented in the V8 wiki](https://github.com/v8/v8/wiki/Merging%20&%20Patching). Merging requires commit access to the V8 repository. If you don't have commit access you can indicate someone on the V8 team can do the merge for you. +* It is possible that the merge request may not get approved, for example if it is considered to be a feature or otherwise too risky for V8 stable. In such cases we float the patch on the Node side. See the process on 'Backporting to Abandoned branches'. +* Once the fix has been merged upstream, it can be picked up during an update of the V8 branch, (see below). + +## Backporting to Abandoned Branches + +Abandoned V8 branches are supported in the Node.js V8 repository. The fix needs to be cherry-picked in the Node.js repository and V8-CI must test the change. + +* For each abandoned V8 branch corresponding to an LTS branch that is affected by the bug: + * Open a cherry-pick PR on nodejs/node targeting the appropriate *vY.x-staging* branch (e.g. *v6.x-staging* to fix an issue in V8-5.1). + * Increase the patch level version in v8-version.h. This will not cause any problems with versioning because V8 will not publish other patches for this branch, so Node.js can effectively bump the patch version. + * In some cases the patch may require extra effort to merge in case V8 has changed substantially. For important issues we may be able to lean on the V8 team to get help with reimplementing the patch. + * Run Node's [V8-CI](https://ci.nodejs.org/job/node-test-commit-v8-linux/) in addition to the [Node CI](https://ci.nodejs.org/job/node-test-pull-request/). + +An example for workflow how to cherry-pick consider the following bug: https://crbug.com/v8/5199. From the bug we can see that it was merged by V8 into 5.2 and 5.3, and not into V8 5.1 (since it was already abandoned). Since Node.js `v6.x` uses V8 5.1, the fix needed to cherry-picked. To cherry-pick, here's an example workflow: + +* Download and apply the commit linked-to in the issue (in this case a51f429). `curl -L https://github.com/v8/v8/commit/a51f429.patch | git apply --directory=deps/v8`. If the branches have diverged significantly, this may not apply cleanly. It may help to try to cherry-pick the merge to the oldest branch that was done upstream in V8. In this example, this would be the patch from the merge to 5.2. The hope is that this would be closer to the V8 5.1, and has a better chance of applying cleanly. If you're stuck, feel free to ping @ofrobots for help. +* Modify the commit message to match the format we use for V8 backports. You may want to add extra description if necessary to indicate the impact of the fix on Node. In this case the original issue was descriptive enough. Example: +``` +deps: cherry-pick a51f429 from V8 upstream + +Original commit message: + [regexp] Fix case-insensitive matching for one-byte subjects. + + The bug occurs because we do not canonicalize character class ranges + before adding case equivalents. While adding case equivalents, we abort + early for one-byte subject strings, assuming that the ranges are sorted. + Which they are not. + + R=marja@chromium.org + BUG=v8:5199 + + Review-Url: https://codereview.chromium.org/2159683002 + Cr-Commit-Position: refs/heads/master@{#37833} + +PR-URL: +``` +* Open a PR against the `v6.x-staging` branch in the Node.js repo. Launch the normal and [V8-CI](https://ci.nodejs.org/job/node-test-commit-v8-linux/) using the Node.js CI system. We only needed to backport to `v6.x` as the other LTS branches weren't affected by this bug. + +## Backports Identified by the V8 team + +For bugs found through the browser or other channels, the V8 team marks bugs that might be applicable to the abandoned branches in use by Node.js. This is done through manual tagging by the V8 team and through an automated process that tags any fix that gets backported to the stable branch (as it is likely candidate for backporting further). + +Such fixes are tagged with the following labels in the V8 issue tracker: + +* `NodeJS-Backport-Review` ([V8](https://bugs.chromium.org/p/v8/issues/list?can=1&q=label%3ANodeJS-Backport-Review), [Chromium](https://bugs.chromium.org/p/chromium/issues/list?can=1&q=label%3ANodeJS-Backport-Review)): to be reviewed if this is applicable to abandoned branches in use by Node.js. This list if regularly reviewed by the node team at Google to determine applicability to Node.js. +* `NodeJS-Backport-Approved` ([V8](https://bugs.chromium.org/p/v8/issues/list?can=1&q=label%3ANodeJS-Backport-Approved), [Chromium](https://bugs.chromium.org/p/chromium/issues/list?can=1&q=label%3ANodeJS-Backport-Approved)): marks bugs that are deemed relevant to Node.js and should be backported. +* `NodeJS-Backport-Done` ([V8](https://bugs.chromium.org/p/v8/issues/list?can=1&q=label%3ANodeJS-Backport-Done), [Chromium](https://bugs.chromium.org/p/chromium/issues/list?can=1&q=label%3ANodeJS-Backport-Done)): Backport for Node.js has been performed already. +* `NodeJS-Backport-Rejected` ([V8](https://bugs.chromium.org/p/v8/issues/list?can=1&q=label%3ANodeJS-Backport-Rejected), [Chromium](https://bugs.chromium.org/p/chromium/issues/list?can=1&q=label%3ANodeJS-Backport-Rejected)): Backport for Node.js is not desired. + +The backlog of issues with such is regularly reviewed by the node-team at Google to shepherd through the backport process. External contributors are welcome to collaborate on the backport process as well. Note that some of the bugs may be security issues and will not be visible to external collaborators. + +# Updating V8 + +Node keeps a vendored copy of V8 inside of deps/ directory. In addition Node may need to float patches that do not exist upstream. This means that some care may need to be taken to update the vendored copy of V8. + +## Minor updates (patch level) + +Because there may be floating patches on the version of V8 in Node.js, it is safest to apply the patch level updates as a patch. For example, imagine that upstream V8 is at 5.0.71.47 and Node.js is at 5.0.71.32. It would be best to compute the diff between these tags on the V8 repository, and then apply that patch on the copy of V8 in Node.js. This should preserve the patches/backports that Node.js may be floating (or else cause a merge conflict). + +The rough outline of the process is: + +```shell +# Assuming your fork of Node.js is checked out in $NODE_DIR +# and you want to update the Node.js master branch. +# Find the current (OLD) version in +# $NODE_DIR/deps/v8/include/v8-version.h +cd $NODE_DIR +git checkout master +git merge --ff-only origin/master +git checkout -b V8_NEW_VERSION +curl -L https://github.com/v8/v8/compare/${V8_OLD_VERSION}...${V8_NEW_VERSION}.patch | git apply --directory=deps/v8 +# You may want to amend the commit message to describe the nature of the update +``` + +V8 also keeps tags of the form *5.4-lkgr* which point to the *Last Known Good Revision* from the 5.4 branch that can be useful in the update process above. + + +## Major Updates + +We upgrade the version of V8 in Node.js master whenever a V8 release goes stable upstream, that is, whenever a new release of Chrome comes out. + +Upgrading major versions would be much harder to do with the patch mechanism above. A better strategy is to + +1. Audit the current master branch and look at the patches that have been floated since the last major V8 update. +1. Replace the copy of V8 in Node.js with a fresh checkout of the latest stable V8 branch. Special care must be taken to recursively update the DEPS that V8 has a compile time dependency on (at the moment of this writing, these are only trace_event and gtest_prod.h) +1. Refloat (cherry-pick) all the patches from list computed in 1) as necessary. Some of the patches may no longer be necessary. + +To audit for floating patches: + +```shell +git log --oneline deps/v8 +``` + +To replace the copy of V8 in Node, use the '[update-v8](https://gist.github.com/targos/8da405e96e98fdff01a395bed365b816)' script2. For example, if you want to replace the copy of V8 in Node.js with the branch-head for V8 5.1 branch: + +```shell +cd $NODE_DIR +rm -rf deps/v8 +path/to/update-v8 branch-heads/5.1 +``` + +You may want to look at the commits created by the above scripts, and squash them once you have reviewed them. + +This should be followed up with manual refloating of all relevant patches. + +# Proposal: Using a fork repo to track upstream V8 + +The fact that Node.js keeps a vendored, potentially edited copy of V8 in deps/ makes the above processes a bit complicated. An alternative proposal would be to create a fork of V8 at nodejs/v8 that would be used to maintain the V8 branches. This has several benefits: + +* The process to update the version of V8 in Node.js could be automated to track the tips of various V8 branches in nodejs/v8. +* It would simplify cherry-picking and porting of fixes between branches as the version bumps in v8-version.h would happen as part of this update instead of on every change. +* It would simplify the V8-CI and make it more automatable. +* The history of the V8 branch in nodejs/v8 becomes purer and it would make it easier to pull in the V8 team for help with reviewing. +* It would make it simpler to setup an automated build that tracks Node.js master + V8 lkgr integration build. + +This would require some tooling to: + +* A script that would update the V8 in a specific Node branch with V8 from upstream (dependent on branch abandoned vs. active). +* We need a script to bump V8 version numbers when a new version of V8 is promoted from nodejs/v8 to nodejs/node. +* Enabled the V8-CI build in Jenkins to build from the nodejs/v8 fork. + +# Proposal: Dealing with the need to float patches to a stable/beta + +Sometimes upstream V8 may not want to merge a fix to their stable branches, but we might. An example of this would be a fix for a performance regression that only affects Node.js and not the browser. At the moment we don't have a mechanism to deal with this situation. If we float a patch and bump the V8 version, we might run into a problem if upstream releases a fix with the same version number. + +One idea we have been kicking around is that we could move to a 5-place version number in V8, e.g.: 5.4.500.30.${embedder}. The ${embedder} represents the number of patches an embedder is floating on top of an official V8 version. This would also help with auditing the floating patches in the Node commit history. + +We are trying this out in https://github.com/nodejs/node/pull/9754. If this ends up working, we will investigate making this change upstream. + + +## Notes + +1Node.js 0.12 and older are intentionally omitted from this document as their support is ending soon. + +2It seems that @targos is working on port of this script here https://github.com/targos/update-v8. From 284d3cc3b79278250cc7a51129d30de5ddd22103 Mon Sep 17 00:00:00 2001 From: Rebecca Turner Date: Mon, 21 Nov 2016 15:19:45 -0800 Subject: [PATCH 207/313] deps: upgrade npm to 3.10.10 PR-URL: https://github.com/nodejs/node/pull/9847 Reviewed-By: Jeremiah Senkpiel --- deps/npm/.npmignore | 2 + deps/npm/.travis.yml | 41 +++++++++++++------ deps/npm/CHANGELOG.md | 31 ++++++++++++++ deps/npm/appveyor.yml | 13 ++---- deps/npm/html/doc/README.html | 2 +- deps/npm/html/doc/cli/npm-access.html | 2 +- deps/npm/html/doc/cli/npm-adduser.html | 2 +- deps/npm/html/doc/cli/npm-bin.html | 2 +- deps/npm/html/doc/cli/npm-bugs.html | 2 +- deps/npm/html/doc/cli/npm-build.html | 2 +- deps/npm/html/doc/cli/npm-bundle.html | 2 +- deps/npm/html/doc/cli/npm-cache.html | 2 +- deps/npm/html/doc/cli/npm-completion.html | 2 +- deps/npm/html/doc/cli/npm-config.html | 2 +- deps/npm/html/doc/cli/npm-dedupe.html | 2 +- deps/npm/html/doc/cli/npm-deprecate.html | 2 +- deps/npm/html/doc/cli/npm-dist-tag.html | 2 +- deps/npm/html/doc/cli/npm-docs.html | 2 +- deps/npm/html/doc/cli/npm-edit.html | 2 +- deps/npm/html/doc/cli/npm-explore.html | 2 +- deps/npm/html/doc/cli/npm-help-search.html | 2 +- deps/npm/html/doc/cli/npm-help.html | 2 +- deps/npm/html/doc/cli/npm-init.html | 2 +- deps/npm/html/doc/cli/npm-install-test.html | 2 +- deps/npm/html/doc/cli/npm-install.html | 2 +- deps/npm/html/doc/cli/npm-link.html | 2 +- deps/npm/html/doc/cli/npm-logout.html | 2 +- deps/npm/html/doc/cli/npm-ls.html | 4 +- deps/npm/html/doc/cli/npm-outdated.html | 2 +- deps/npm/html/doc/cli/npm-owner.html | 2 +- deps/npm/html/doc/cli/npm-pack.html | 2 +- deps/npm/html/doc/cli/npm-ping.html | 2 +- deps/npm/html/doc/cli/npm-prefix.html | 2 +- deps/npm/html/doc/cli/npm-prune.html | 2 +- deps/npm/html/doc/cli/npm-publish.html | 2 +- deps/npm/html/doc/cli/npm-rebuild.html | 2 +- deps/npm/html/doc/cli/npm-repo.html | 2 +- deps/npm/html/doc/cli/npm-restart.html | 2 +- deps/npm/html/doc/cli/npm-root.html | 2 +- deps/npm/html/doc/cli/npm-run-script.html | 2 +- deps/npm/html/doc/cli/npm-search.html | 2 +- deps/npm/html/doc/cli/npm-shrinkwrap.html | 2 +- deps/npm/html/doc/cli/npm-star.html | 2 +- deps/npm/html/doc/cli/npm-stars.html | 2 +- deps/npm/html/doc/cli/npm-start.html | 2 +- deps/npm/html/doc/cli/npm-stop.html | 2 +- deps/npm/html/doc/cli/npm-tag.html | 2 +- deps/npm/html/doc/cli/npm-team.html | 2 +- deps/npm/html/doc/cli/npm-test.html | 2 +- deps/npm/html/doc/cli/npm-uninstall.html | 2 +- deps/npm/html/doc/cli/npm-unpublish.html | 2 +- deps/npm/html/doc/cli/npm-update.html | 2 +- deps/npm/html/doc/cli/npm-version.html | 2 +- deps/npm/html/doc/cli/npm-view.html | 2 +- deps/npm/html/doc/cli/npm-whoami.html | 2 +- deps/npm/html/doc/cli/npm.html | 6 +-- deps/npm/html/doc/files/npm-folders.html | 2 +- deps/npm/html/doc/files/npm-global.html | 2 +- deps/npm/html/doc/files/npm-json.html | 2 +- deps/npm/html/doc/files/npmrc.html | 2 +- deps/npm/html/doc/files/package.json.html | 2 +- deps/npm/html/doc/index.html | 2 +- deps/npm/html/doc/misc/npm-coding-style.html | 2 +- deps/npm/html/doc/misc/npm-config.html | 2 +- deps/npm/html/doc/misc/npm-developers.html | 2 +- deps/npm/html/doc/misc/npm-disputes.html | 8 ++-- deps/npm/html/doc/misc/npm-index.html | 2 +- deps/npm/html/doc/misc/npm-orgs.html | 2 +- deps/npm/html/doc/misc/npm-registry.html | 2 +- deps/npm/html/doc/misc/npm-scope.html | 2 +- deps/npm/html/doc/misc/npm-scripts.html | 2 +- deps/npm/html/doc/misc/removing-npm.html | 2 +- deps/npm/html/doc/misc/semver.html | 2 +- deps/npm/lib/install/deps.js | 8 ++-- deps/npm/lib/install/inflate-shrinkwrap.js | 6 ++- deps/npm/man/man1/npm-README.1 | 2 +- deps/npm/man/man1/npm-access.1 | 2 +- deps/npm/man/man1/npm-adduser.1 | 2 +- deps/npm/man/man1/npm-bin.1 | 2 +- deps/npm/man/man1/npm-bugs.1 | 2 +- deps/npm/man/man1/npm-build.1 | 2 +- deps/npm/man/man1/npm-bundle.1 | 2 +- deps/npm/man/man1/npm-cache.1 | 2 +- deps/npm/man/man1/npm-completion.1 | 2 +- deps/npm/man/man1/npm-config.1 | 2 +- deps/npm/man/man1/npm-dedupe.1 | 2 +- deps/npm/man/man1/npm-deprecate.1 | 2 +- deps/npm/man/man1/npm-dist-tag.1 | 2 +- deps/npm/man/man1/npm-docs.1 | 2 +- deps/npm/man/man1/npm-edit.1 | 2 +- deps/npm/man/man1/npm-explore.1 | 2 +- deps/npm/man/man1/npm-help-search.1 | 2 +- deps/npm/man/man1/npm-help.1 | 2 +- deps/npm/man/man1/npm-init.1 | 2 +- deps/npm/man/man1/npm-install-test.1 | 2 +- deps/npm/man/man1/npm-install.1 | 2 +- deps/npm/man/man1/npm-link.1 | 2 +- deps/npm/man/man1/npm-logout.1 | 2 +- deps/npm/man/man1/npm-ls.1 | 4 +- deps/npm/man/man1/npm-outdated.1 | 2 +- deps/npm/man/man1/npm-owner.1 | 2 +- deps/npm/man/man1/npm-pack.1 | 2 +- deps/npm/man/man1/npm-ping.1 | 2 +- deps/npm/man/man1/npm-prefix.1 | 2 +- deps/npm/man/man1/npm-prune.1 | 2 +- deps/npm/man/man1/npm-publish.1 | 2 +- deps/npm/man/man1/npm-rebuild.1 | 2 +- deps/npm/man/man1/npm-repo.1 | 2 +- deps/npm/man/man1/npm-restart.1 | 2 +- deps/npm/man/man1/npm-root.1 | 2 +- deps/npm/man/man1/npm-run-script.1 | 2 +- deps/npm/man/man1/npm-search.1 | 2 +- deps/npm/man/man1/npm-shrinkwrap.1 | 2 +- deps/npm/man/man1/npm-star.1 | 2 +- deps/npm/man/man1/npm-stars.1 | 2 +- deps/npm/man/man1/npm-start.1 | 2 +- deps/npm/man/man1/npm-stop.1 | 2 +- deps/npm/man/man1/npm-tag.1 | 2 +- deps/npm/man/man1/npm-team.1 | 2 +- deps/npm/man/man1/npm-test.1 | 2 +- deps/npm/man/man1/npm-uninstall.1 | 2 +- deps/npm/man/man1/npm-unpublish.1 | 2 +- deps/npm/man/man1/npm-update.1 | 2 +- deps/npm/man/man1/npm-version.1 | 2 +- deps/npm/man/man1/npm-view.1 | 2 +- deps/npm/man/man1/npm-whoami.1 | 2 +- deps/npm/man/man1/npm.1 | 4 +- deps/npm/man/man5/npm-folders.5 | 2 +- deps/npm/man/man5/npm-global.5 | 2 +- deps/npm/man/man5/npm-json.5 | 2 +- deps/npm/man/man5/npmrc.5 | 2 +- deps/npm/man/man5/package.json.5 | 2 +- deps/npm/man/man7/npm-coding-style.7 | 2 +- deps/npm/man/man7/npm-config.7 | 2 +- deps/npm/man/man7/npm-developers.7 | 2 +- deps/npm/man/man7/npm-disputes.7 | 2 +- deps/npm/man/man7/npm-index.7 | 2 +- deps/npm/man/man7/npm-orgs.7 | 2 +- deps/npm/man/man7/npm-registry.7 | 2 +- deps/npm/man/man7/npm-scope.7 | 2 +- deps/npm/man/man7/npm-scripts.7 | 2 +- deps/npm/man/man7/removing-npm.7 | 2 +- deps/npm/man/man7/semver.7 | 2 +- deps/npm/package.json | 12 +++--- deps/npm/scripts/changelog.js | 4 +- deps/npm/scripts/maketest | 4 +- .../lifecycle-path.js | 4 +- .../whoami.js | 0 .../{tap => slow}/legacy-npm-self-install.js | 0 deps/npm/test/tap/invalid-cmd-exit-code.js | 24 +++++++---- .../test/tap/shrinkwrap-optional-platform.js | 20 +++++++-- 151 files changed, 264 insertions(+), 195 deletions(-) rename deps/npm/test/{tap => broken-under-nyc-and-travis}/lifecycle-path.js (93%) rename deps/npm/test/{tap => broken-under-nyc-and-travis}/whoami.js (100%) rename deps/npm/test/{tap => slow}/legacy-npm-self-install.js (100%) diff --git a/deps/npm/.npmignore b/deps/npm/.npmignore index 93398c04aa252f..8aa0c3e0aff3a5 100644 --- a/deps/npm/.npmignore +++ b/deps/npm/.npmignore @@ -30,3 +30,5 @@ html/*.png /test/tap/builtin-config .nyc_output + +npm-shrinkwrap.json \ No newline at end of file diff --git a/deps/npm/.travis.yml b/deps/npm/.travis.yml index 988ee7e30a770f..12b8a8add810df 100644 --- a/deps/npm/.travis.yml +++ b/deps/npm/.travis.yml @@ -7,25 +7,42 @@ language: node_js matrix: include: # LTS is our most important target - - node_js: "4" + - node_js: "6" # DEPLOY_VERSION is used to set the couchapp setup mode for test/tap/registry.js # only gather coverage info for LTS env: DEPLOY_VERSION=testing COVERALLS_REPO_TOKEN="$COVERALLS_OPTIONAL_TOKEN" - # next LTS and master is next most important - - node_js: "6" - env: DEPLOY_VERSION=testing - # still in LTS maintenance until fall 2016 (also still in wide use) - - node_js: "0.10" - env: DEPLOY_VERSION=testing - # will be unsupported as soon as 6 becomes LTS and 7 released - - node_js: "5" + script: + - "node . run tap-cover -- \"test/tap/*.js\"" + - "unset COVERALLS_REPO_TOKEN ; node . run tap -- \"test/slow/*.js\" \"test/broken-under-*/*.js\"" + # previous LTS is next most important + - node_js: "4" env: DEPLOY_VERSION=testing - # technically in LTS / distros, unbeloved - - node_js: "0.12" + # then master + - node_js: "7" env: DEPLOY_VERSION=testing before_install: - - "node . install -g ." # required by test/tap/registry.js - "mkdir -p /var/run/couchdb" notifications: slack: npm-inc:kRqQjto7YbINqHPb1X6nS3g8 +cache: + directories: + - $HOME/.npm + - node_modules/.bin + - node_modules/deep-equal + - node_modules/marked + - node_modules/marked-man + - node_modules/npm-registry-couchapp + - node_modules/npm-registry-mock + - node_modules/require-inject + - node_modules/sprintf-js + - node_modules/standard + - node_modules/tacks + - node_modules/tap +install: + - "node . prune" + - "node . rebuild --depth=0" + - "node . install --ignore-scripts" + - "make -j4 doc" +script: + - "node . run tap -- \"test/tap/*.js\" \"test/slow/*.js\" \"test/broken-under-nyc/*.js\"" diff --git a/deps/npm/CHANGELOG.md b/deps/npm/CHANGELOG.md index e4f0ab3cdc705f..bbef5af2e2ab90 100644 --- a/deps/npm/CHANGELOG.md +++ b/deps/npm/CHANGELOG.md @@ -1,3 +1,34 @@ +### v3.10.10 (2016-11-04) + +See the discussion on [#14042](https://github.com/npm/npm/issues/14042) for +more context on this release, which is intended to address a serious regression +in shrinkwrap behavior in the version of the CLI currently bundled with Node.js +6 LTS "Boron". You should never install this version directly; instead update +to `npm@4`, which has everything in this release and more. + +#### REGRESSION FIX + +* [`9aebe98`](https://github.com/npm/npm/commit/9aebe982114ea2107f46baa1dcb11713b4aaad04) + [#14117](https://github.com/npm/npm/pull/14117) + Fixes a bug where installing a shrinkwrapped package would fail if the + platform failed to install an optional dependency included in the shrinkwrap. + ([@watilde](https://github.com/watilde)) + +#### UPDATE SUPPORT MATRIX + +With the advent of the second official Node.js LTS release, Node 6.x +'Boron', the Node.js project has now officially dropped versions 0.10 +and 0.12 out of the maintenance phase of LTS. (Also, Node 5 was never +part of LTS, and will see no further support now that Node 7 has been +released.) As a small team with limited resources, the npm CLI team is +following suit and dropping those versions of Node from its CI test +matrix. + +* [`c82ecfd`](https://github.com/npm/npm/commit/c82ecfdbe0b5f318a175714a8753efe4dfd3e4b3) + [#14503](https://github.com/npm/npm/pull/14503) + Node 6 is LTS; 5.x, 0.10, and 0.12 are unsupported. + ([@othiym23](https://github.com/othiym23)) + ### v3.10.9 (2016-10-06) Hi everyone! This is the last of our monthly releases. We're going to give diff --git a/deps/npm/appveyor.yml b/deps/npm/appveyor.yml index 6bec7c49389b91..1dd58c7b78ad59 100644 --- a/deps/npm/appveyor.yml +++ b/deps/npm/appveyor.yml @@ -1,16 +1,11 @@ environment: matrix: # LTS is our most important target - - nodejs_version: "4" - # next LTS and master is next most important - nodejs_version: "6" - # still in LTS maintenance until fall 2016 - # (also still in wide use) - - nodejs_version: "0.10" - # will be unsupported as soon as 6 becomes LTS and 7 released + # previous LTS is next most important + - nodejs_version: "4" + # then master - nodejs_version: "5" - # technically in LTS / distros, unbeloved - - nodejs_version: "0.12" COVERALLS_REPO_TOKEN: secure: XdC0aySefK0HLh1GNk6aKrzZPbCfPQLyA4mYtFGEp4DrTuZA/iuCUS0LDqFYO8JQ platform: @@ -26,7 +21,7 @@ install: test_script: - node --version - npm --version - - npm test + - npm run test -- --reporter=classic notifications: - provider: Slack incoming_webhook: diff --git a/deps/npm/html/doc/README.html b/deps/npm/html/doc/README.html index cb3d79f7848ba9..4aa3cc5e4798ca 100644 --- a/deps/npm/html/doc/README.html +++ b/deps/npm/html/doc/README.html @@ -126,5 +126,5 @@

SEE ALSO

       -
+ diff --git a/deps/npm/html/doc/cli/npm-access.html b/deps/npm/html/doc/cli/npm-access.html index bc2f2bab0666c7..fdc0cb756e4014 100644 --- a/deps/npm/html/doc/cli/npm-access.html +++ b/deps/npm/html/doc/cli/npm-access.html @@ -84,5 +84,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-adduser.html b/deps/npm/html/doc/cli/npm-adduser.html index 09625e36dc34b2..9ade2746aa3435 100644 --- a/deps/npm/html/doc/cli/npm-adduser.html +++ b/deps/npm/html/doc/cli/npm-adduser.html @@ -72,5 +72,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-bin.html b/deps/npm/html/doc/cli/npm-bin.html index 234be15e8bcd2b..8d408216a905d6 100644 --- a/deps/npm/html/doc/cli/npm-bin.html +++ b/deps/npm/html/doc/cli/npm-bin.html @@ -35,5 +35,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-bugs.html b/deps/npm/html/doc/cli/npm-bugs.html index e32a74a474f793..d5b9edea5655d2 100644 --- a/deps/npm/html/doc/cli/npm-bugs.html +++ b/deps/npm/html/doc/cli/npm-bugs.html @@ -55,5 +55,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-build.html b/deps/npm/html/doc/cli/npm-build.html index 4538085259ec11..73c796c233d885 100644 --- a/deps/npm/html/doc/cli/npm-build.html +++ b/deps/npm/html/doc/cli/npm-build.html @@ -40,5 +40,5 @@

DESCRIPTION

       - + diff --git a/deps/npm/html/doc/cli/npm-bundle.html b/deps/npm/html/doc/cli/npm-bundle.html index 466f587d3a7bc4..1f256d222da801 100644 --- a/deps/npm/html/doc/cli/npm-bundle.html +++ b/deps/npm/html/doc/cli/npm-bundle.html @@ -31,5 +31,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-cache.html b/deps/npm/html/doc/cli/npm-cache.html index b9e4911910e95d..883f07ffb52018 100644 --- a/deps/npm/html/doc/cli/npm-cache.html +++ b/deps/npm/html/doc/cli/npm-cache.html @@ -81,5 +81,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-completion.html b/deps/npm/html/doc/cli/npm-completion.html index 9486761c4250fe..1be550a7dd7f3e 100644 --- a/deps/npm/html/doc/cli/npm-completion.html +++ b/deps/npm/html/doc/cli/npm-completion.html @@ -43,5 +43,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-config.html b/deps/npm/html/doc/cli/npm-config.html index 1a8b8de3841cce..8940698b4a0e2c 100644 --- a/deps/npm/html/doc/cli/npm-config.html +++ b/deps/npm/html/doc/cli/npm-config.html @@ -67,5 +67,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-dedupe.html b/deps/npm/html/doc/cli/npm-dedupe.html index 782b555da18223..40cbd9f23a410b 100644 --- a/deps/npm/html/doc/cli/npm-dedupe.html +++ b/deps/npm/html/doc/cli/npm-dedupe.html @@ -61,5 +61,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-deprecate.html b/deps/npm/html/doc/cli/npm-deprecate.html index a3e2502a899bab..a8476c51b1d1df 100644 --- a/deps/npm/html/doc/cli/npm-deprecate.html +++ b/deps/npm/html/doc/cli/npm-deprecate.html @@ -38,5 +38,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-dist-tag.html b/deps/npm/html/doc/cli/npm-dist-tag.html index 0a083b5ef17a73..3b66f87f789bd4 100644 --- a/deps/npm/html/doc/cli/npm-dist-tag.html +++ b/deps/npm/html/doc/cli/npm-dist-tag.html @@ -87,5 +87,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-docs.html b/deps/npm/html/doc/cli/npm-docs.html index 0aa7cc48bf73c4..265c35be15eecc 100644 --- a/deps/npm/html/doc/cli/npm-docs.html +++ b/deps/npm/html/doc/cli/npm-docs.html @@ -56,5 +56,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-edit.html b/deps/npm/html/doc/cli/npm-edit.html index 6c4c65e3508bec..60e0a3b5168119 100644 --- a/deps/npm/html/doc/cli/npm-edit.html +++ b/deps/npm/html/doc/cli/npm-edit.html @@ -49,5 +49,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-explore.html b/deps/npm/html/doc/cli/npm-explore.html index 1a88b7862862e4..29d5829b5dbfc3 100644 --- a/deps/npm/html/doc/cli/npm-explore.html +++ b/deps/npm/html/doc/cli/npm-explore.html @@ -49,5 +49,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-help-search.html b/deps/npm/html/doc/cli/npm-help-search.html index fda38c968381d2..107687584db571 100644 --- a/deps/npm/html/doc/cli/npm-help-search.html +++ b/deps/npm/html/doc/cli/npm-help-search.html @@ -45,5 +45,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-help.html b/deps/npm/html/doc/cli/npm-help.html index c09967a4bd1893..feb154a521c0e5 100644 --- a/deps/npm/html/doc/cli/npm-help.html +++ b/deps/npm/html/doc/cli/npm-help.html @@ -50,5 +50,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-init.html b/deps/npm/html/doc/cli/npm-init.html index 6440631492c545..5474d8392aee18 100644 --- a/deps/npm/html/doc/cli/npm-init.html +++ b/deps/npm/html/doc/cli/npm-init.html @@ -48,5 +48,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-install-test.html b/deps/npm/html/doc/cli/npm-install-test.html index 3ab56462b574d0..428e0c77391070 100644 --- a/deps/npm/html/doc/cli/npm-install-test.html +++ b/deps/npm/html/doc/cli/npm-install-test.html @@ -42,5 +42,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-install.html b/deps/npm/html/doc/cli/npm-install.html index 5760520c468729..8c4575f94998c8 100644 --- a/deps/npm/html/doc/cli/npm-install.html +++ b/deps/npm/html/doc/cli/npm-install.html @@ -313,5 +313,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-link.html b/deps/npm/html/doc/cli/npm-link.html index c257e9af2ba32d..d7aed7df348e04 100644 --- a/deps/npm/html/doc/cli/npm-link.html +++ b/deps/npm/html/doc/cli/npm-link.html @@ -74,5 +74,5 @@

SYNOPSIS

       - + diff --git a/deps/npm/html/doc/cli/npm-logout.html b/deps/npm/html/doc/cli/npm-logout.html index 03b2c3fb15ab40..a6d86e64b50fa0 100644 --- a/deps/npm/html/doc/cli/npm-logout.html +++ b/deps/npm/html/doc/cli/npm-logout.html @@ -51,5 +51,5 @@

scope

       - + diff --git a/deps/npm/html/doc/cli/npm-ls.html b/deps/npm/html/doc/cli/npm-ls.html index 5ce106d2603f7e..e3e3e6034300a0 100644 --- a/deps/npm/html/doc/cli/npm-ls.html +++ b/deps/npm/html/doc/cli/npm-ls.html @@ -21,7 +21,7 @@

SYNOPSIS

limit the results to only the paths to the packages named. Note that nested packages will also show the paths to the specified packages. For example, running npm ls promzard in npm's source tree will show:

-
npm@3.10.9 /path/to/npm
+
npm@3.10.10 /path/to/npm
 └─┬ init-package-json@0.0.4
   └── promzard@0.1.5
 

It will print out extraneous, missing, and invalid packages.

@@ -104,5 +104,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-outdated.html b/deps/npm/html/doc/cli/npm-outdated.html index d2813ade8806b7..5c06e18fb3225e 100644 --- a/deps/npm/html/doc/cli/npm-outdated.html +++ b/deps/npm/html/doc/cli/npm-outdated.html @@ -116,5 +116,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-owner.html b/deps/npm/html/doc/cli/npm-owner.html index 2b0cefc3342ea0..9ec584f4ecd660 100644 --- a/deps/npm/html/doc/cli/npm-owner.html +++ b/deps/npm/html/doc/cli/npm-owner.html @@ -51,5 +51,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-pack.html b/deps/npm/html/doc/cli/npm-pack.html index 29a87a8ac8aa2f..74682f52819902 100644 --- a/deps/npm/html/doc/cli/npm-pack.html +++ b/deps/npm/html/doc/cli/npm-pack.html @@ -41,5 +41,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-ping.html b/deps/npm/html/doc/cli/npm-ping.html index 67897216a0f3ca..b48db8ab63a1e6 100644 --- a/deps/npm/html/doc/cli/npm-ping.html +++ b/deps/npm/html/doc/cli/npm-ping.html @@ -32,5 +32,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-prefix.html b/deps/npm/html/doc/cli/npm-prefix.html index 06782f3fb1ca72..171c7ca26307e9 100644 --- a/deps/npm/html/doc/cli/npm-prefix.html +++ b/deps/npm/html/doc/cli/npm-prefix.html @@ -38,5 +38,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-prune.html b/deps/npm/html/doc/cli/npm-prune.html index d16f7cdb28bffd..5000f2c75cff71 100644 --- a/deps/npm/html/doc/cli/npm-prune.html +++ b/deps/npm/html/doc/cli/npm-prune.html @@ -40,5 +40,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-publish.html b/deps/npm/html/doc/cli/npm-publish.html index f015d4fada80b9..c3272d3cdb4a08 100644 --- a/deps/npm/html/doc/cli/npm-publish.html +++ b/deps/npm/html/doc/cli/npm-publish.html @@ -76,5 +76,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-rebuild.html b/deps/npm/html/doc/cli/npm-rebuild.html index 9ca7c3e9fb85ed..c975efca6bb24a 100644 --- a/deps/npm/html/doc/cli/npm-rebuild.html +++ b/deps/npm/html/doc/cli/npm-rebuild.html @@ -35,5 +35,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-repo.html b/deps/npm/html/doc/cli/npm-repo.html index bcdc9a591fad55..30b18957ca29a4 100644 --- a/deps/npm/html/doc/cli/npm-repo.html +++ b/deps/npm/html/doc/cli/npm-repo.html @@ -41,5 +41,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-restart.html b/deps/npm/html/doc/cli/npm-restart.html index b40dd99239f8f4..ceb270c6d8669e 100644 --- a/deps/npm/html/doc/cli/npm-restart.html +++ b/deps/npm/html/doc/cli/npm-restart.html @@ -53,5 +53,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-root.html b/deps/npm/html/doc/cli/npm-root.html index c4825f48c25cea..44c63f0c18fe71 100644 --- a/deps/npm/html/doc/cli/npm-root.html +++ b/deps/npm/html/doc/cli/npm-root.html @@ -35,5 +35,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-run-script.html b/deps/npm/html/doc/cli/npm-run-script.html index b90969278284da..27fcfc9345b19b 100644 --- a/deps/npm/html/doc/cli/npm-run-script.html +++ b/deps/npm/html/doc/cli/npm-run-script.html @@ -63,5 +63,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-search.html b/deps/npm/html/doc/cli/npm-search.html index b9885bd5200dce..ed10e4c42209f1 100644 --- a/deps/npm/html/doc/cli/npm-search.html +++ b/deps/npm/html/doc/cli/npm-search.html @@ -57,5 +57,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-shrinkwrap.html b/deps/npm/html/doc/cli/npm-shrinkwrap.html index 8ea1c123bbd242..bfe3410125a3e5 100644 --- a/deps/npm/html/doc/cli/npm-shrinkwrap.html +++ b/deps/npm/html/doc/cli/npm-shrinkwrap.html @@ -176,5 +176,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-star.html b/deps/npm/html/doc/cli/npm-star.html index edc9ddd1dba562..01c593c4610078 100644 --- a/deps/npm/html/doc/cli/npm-star.html +++ b/deps/npm/html/doc/cli/npm-star.html @@ -36,5 +36,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-stars.html b/deps/npm/html/doc/cli/npm-stars.html index 24ce2e083109af..4d470fd4ba3ebe 100644 --- a/deps/npm/html/doc/cli/npm-stars.html +++ b/deps/npm/html/doc/cli/npm-stars.html @@ -36,5 +36,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-start.html b/deps/npm/html/doc/cli/npm-start.html index 93215640708daf..f1936080146de8 100644 --- a/deps/npm/html/doc/cli/npm-start.html +++ b/deps/npm/html/doc/cli/npm-start.html @@ -39,5 +39,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-stop.html b/deps/npm/html/doc/cli/npm-stop.html index 45e47b5e9ec8eb..082b2560c7556b 100644 --- a/deps/npm/html/doc/cli/npm-stop.html +++ b/deps/npm/html/doc/cli/npm-stop.html @@ -34,5 +34,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-tag.html b/deps/npm/html/doc/cli/npm-tag.html index 08e8fee98ff929..2270e1e3f168c6 100644 --- a/deps/npm/html/doc/cli/npm-tag.html +++ b/deps/npm/html/doc/cli/npm-tag.html @@ -63,5 +63,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-team.html b/deps/npm/html/doc/cli/npm-team.html index 7bcfe6756173cc..02dffaae031aec 100644 --- a/deps/npm/html/doc/cli/npm-team.html +++ b/deps/npm/html/doc/cli/npm-team.html @@ -67,5 +67,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-test.html b/deps/npm/html/doc/cli/npm-test.html index e1311164bb25f7..c15a2fe2331acd 100644 --- a/deps/npm/html/doc/cli/npm-test.html +++ b/deps/npm/html/doc/cli/npm-test.html @@ -38,5 +38,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-uninstall.html b/deps/npm/html/doc/cli/npm-uninstall.html index 640a3a9936fc04..1ed389ac2632d3 100644 --- a/deps/npm/html/doc/cli/npm-uninstall.html +++ b/deps/npm/html/doc/cli/npm-uninstall.html @@ -60,5 +60,5 @@

SYNOPSIS

       - + diff --git a/deps/npm/html/doc/cli/npm-unpublish.html b/deps/npm/html/doc/cli/npm-unpublish.html index a092e3984dccc3..4e085352ade1fc 100644 --- a/deps/npm/html/doc/cli/npm-unpublish.html +++ b/deps/npm/html/doc/cli/npm-unpublish.html @@ -47,5 +47,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-update.html b/deps/npm/html/doc/cli/npm-update.html index 24eb0d3e943456..809475745e2273 100644 --- a/deps/npm/html/doc/cli/npm-update.html +++ b/deps/npm/html/doc/cli/npm-update.html @@ -118,5 +118,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-version.html b/deps/npm/html/doc/cli/npm-version.html index 882b60f0c5a489..bc58045dc7a1f9 100644 --- a/deps/npm/html/doc/cli/npm-version.html +++ b/deps/npm/html/doc/cli/npm-version.html @@ -100,5 +100,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-view.html b/deps/npm/html/doc/cli/npm-view.html index 3b9154160687bb..9b7651fcce7a8b 100644 --- a/deps/npm/html/doc/cli/npm-view.html +++ b/deps/npm/html/doc/cli/npm-view.html @@ -86,5 +86,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm-whoami.html b/deps/npm/html/doc/cli/npm-whoami.html index 781ae548c8dc75..cc30465997c073 100644 --- a/deps/npm/html/doc/cli/npm-whoami.html +++ b/deps/npm/html/doc/cli/npm-whoami.html @@ -33,5 +33,5 @@

SEE ALSO

       - + diff --git a/deps/npm/html/doc/cli/npm.html b/deps/npm/html/doc/cli/npm.html index b32be9f21d10ce..08b24220f3b8fc 100644 --- a/deps/npm/html/doc/cli/npm.html +++ b/deps/npm/html/doc/cli/npm.html @@ -13,7 +13,7 @@

npm

javascript package manager

SYNOPSIS

npm <command> [args]
 

VERSION

-

3.10.9

+

3.10.10

DESCRIPTION

npm is the package manager for the Node JavaScript platform. It puts modules in place so that node can find them, and manages dependency @@ -126,7 +126,7 @@

AUTHOR

Isaac Z. Schlueter :: isaacs :: @izs :: -i@izs.me

+i@izs.me

SEE ALSO

  • npm-help(1)
  • @@ -150,5 +150,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/files/npm-folders.html b/deps/npm/html/doc/files/npm-folders.html index a2845d57bc0c6c..0937d2a1318562 100644 --- a/deps/npm/html/doc/files/npm-folders.html +++ b/deps/npm/html/doc/files/npm-folders.html @@ -182,5 +182,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/files/npm-global.html b/deps/npm/html/doc/files/npm-global.html index a2845d57bc0c6c..0937d2a1318562 100644 --- a/deps/npm/html/doc/files/npm-global.html +++ b/deps/npm/html/doc/files/npm-global.html @@ -182,5 +182,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/files/npm-json.html b/deps/npm/html/doc/files/npm-json.html index 8ef63d23d99860..3894c9ead6aa19 100644 --- a/deps/npm/html/doc/files/npm-json.html +++ b/deps/npm/html/doc/files/npm-json.html @@ -586,5 +586,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/files/npmrc.html b/deps/npm/html/doc/files/npmrc.html index 22c43e98d6e5cd..151b0c00790305 100644 --- a/deps/npm/html/doc/files/npmrc.html +++ b/deps/npm/html/doc/files/npmrc.html @@ -89,5 +89,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/files/package.json.html b/deps/npm/html/doc/files/package.json.html index 8ef63d23d99860..3894c9ead6aa19 100644 --- a/deps/npm/html/doc/files/package.json.html +++ b/deps/npm/html/doc/files/package.json.html @@ -586,5 +586,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/index.html b/deps/npm/html/doc/index.html index 54586601104d2e..394e371da4cc55 100644 --- a/deps/npm/html/doc/index.html +++ b/deps/npm/html/doc/index.html @@ -162,5 +162,5 @@

    semver(7)

           - + diff --git a/deps/npm/html/doc/misc/npm-coding-style.html b/deps/npm/html/doc/misc/npm-coding-style.html index 89b1f95f3ee454..93ab1a0e18cbad 100644 --- a/deps/npm/html/doc/misc/npm-coding-style.html +++ b/deps/npm/html/doc/misc/npm-coding-style.html @@ -153,5 +153,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/misc/npm-config.html b/deps/npm/html/doc/misc/npm-config.html index 3ba1d3ba6361ac..75720461f7ef47 100644 --- a/deps/npm/html/doc/misc/npm-config.html +++ b/deps/npm/html/doc/misc/npm-config.html @@ -864,5 +864,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/misc/npm-developers.html b/deps/npm/html/doc/misc/npm-developers.html index 19c126cba83561..2c64e124ce236e 100644 --- a/deps/npm/html/doc/misc/npm-developers.html +++ b/deps/npm/html/doc/misc/npm-developers.html @@ -194,5 +194,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/misc/npm-disputes.html b/deps/npm/html/doc/misc/npm-disputes.html index 438188021886ec..69a49b6e7442fd 100644 --- a/deps/npm/html/doc/misc/npm-disputes.html +++ b/deps/npm/html/doc/misc/npm-disputes.html @@ -13,7 +13,7 @@

    npm-disputes

    Handling Module

    SYNOPSIS

    1. Get the author email with npm owner ls <pkgname>
    2. -
    3. Email the author, CC support@npmjs.com
    4. +
    5. Email the author, CC support@npmjs.com
    6. After a few weeks, if there's no resolution, we'll sort it out.

    Don't squat on package names. Publish code or move out of the way.

    @@ -51,12 +51,12 @@

    DESCRIPTION

    owner (Bob).
  • Joe emails Bob, explaining the situation as respectfully as possible, and what he would like to do with the module name. He -adds the npm support staff support@npmjs.com to the CC list of +adds the npm support staff support@npmjs.com to the CC list of the email. Mention in the email that Bob can run npm owner add joe foo to add Joe as an owner of the foo package.
  • After a reasonable amount of time, if Bob has not responded, or if Bob and Joe can't come to any sort of resolution, email support -support@npmjs.com and we'll sort it out. ("Reasonable" is +support@npmjs.com and we'll sort it out. ("Reasonable" is usually at least 4 weeks, but extra time is allowed around common holidays.)
  • @@ -112,5 +112,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/misc/npm-index.html b/deps/npm/html/doc/misc/npm-index.html index 154c0c47657e20..702e543023a9b7 100644 --- a/deps/npm/html/doc/misc/npm-index.html +++ b/deps/npm/html/doc/misc/npm-index.html @@ -162,5 +162,5 @@

    semver(7)

           - + diff --git a/deps/npm/html/doc/misc/npm-orgs.html b/deps/npm/html/doc/misc/npm-orgs.html index b93a0c4bd18d56..7d5a7cba382043 100644 --- a/deps/npm/html/doc/misc/npm-orgs.html +++ b/deps/npm/html/doc/misc/npm-orgs.html @@ -86,5 +86,5 @@

    Team Admins create teams

           - + diff --git a/deps/npm/html/doc/misc/npm-registry.html b/deps/npm/html/doc/misc/npm-registry.html index efb9df8099fba9..b36cfa5bbe4f5d 100644 --- a/deps/npm/html/doc/misc/npm-registry.html +++ b/deps/npm/html/doc/misc/npm-registry.html @@ -70,5 +70,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/misc/npm-scope.html b/deps/npm/html/doc/misc/npm-scope.html index 6ba363aa10793e..aed4efe7d11658 100644 --- a/deps/npm/html/doc/misc/npm-scope.html +++ b/deps/npm/html/doc/misc/npm-scope.html @@ -94,5 +94,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/misc/npm-scripts.html b/deps/npm/html/doc/misc/npm-scripts.html index 0d01cc59ffc658..172a6cd7489e7b 100644 --- a/deps/npm/html/doc/misc/npm-scripts.html +++ b/deps/npm/html/doc/misc/npm-scripts.html @@ -213,5 +213,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/misc/removing-npm.html b/deps/npm/html/doc/misc/removing-npm.html index 2109aad11a97bd..6b2f30a72b9174 100644 --- a/deps/npm/html/doc/misc/removing-npm.html +++ b/deps/npm/html/doc/misc/removing-npm.html @@ -57,5 +57,5 @@

    SEE ALSO

           - + diff --git a/deps/npm/html/doc/misc/semver.html b/deps/npm/html/doc/misc/semver.html index 8e677c0f9fcaba..7e053f6228e1d4 100644 --- a/deps/npm/html/doc/misc/semver.html +++ b/deps/npm/html/doc/misc/semver.html @@ -325,5 +325,5 @@

    Ranges

           - + diff --git a/deps/npm/lib/install/deps.js b/deps/npm/lib/install/deps.js index 4d315ab1880a9f..d7081296db0d89 100644 --- a/deps/npm/lib/install/deps.js +++ b/deps/npm/lib/install/deps.js @@ -326,14 +326,16 @@ function andForEachChild (load, next) { } } -function isDepOptional (tree, name) { +function isDepOptional (tree, name, pkg) { + if (pkg.package && pkg.package._optional) return true if (!tree.package.optionalDependencies) return false if (tree.package.optionalDependencies[name] != null) return true return false } var failedDependency = exports.failedDependency = function (tree, name_pkg) { - var name, pkg + var name + var pkg = {} if (typeof name_pkg === 'string') { name = name_pkg } else { @@ -342,7 +344,7 @@ var failedDependency = exports.failedDependency = function (tree, name_pkg) { } tree.children = tree.children.filter(noModuleNameMatches(name)) - if (isDepOptional(tree, name)) { + if (isDepOptional(tree, name, pkg)) { return false } diff --git a/deps/npm/lib/install/inflate-shrinkwrap.js b/deps/npm/lib/install/inflate-shrinkwrap.js index ab1bdd1f1912f0..b70e9576bf86c6 100644 --- a/deps/npm/lib/install/inflate-shrinkwrap.js +++ b/deps/npm/lib/install/inflate-shrinkwrap.js @@ -45,14 +45,16 @@ function inflateShrinkwrap (topPath, tree, swdeps, finishInflating) { return inflateShrinkwrap(topPath, child, dependencies || {}, next) } else { var from = sw.from || requested.raw - return fetchPackageMetadata(requested, topPath, iferr(next, andAddShrinkwrap(from, dependencies, next))) + var optional = sw.optional + return fetchPackageMetadata(requested, topPath, iferr(next, andAddShrinkwrap(from, optional, dependencies, next))) } } } - function andAddShrinkwrap (from, dependencies, next) { + function andAddShrinkwrap (from, optional, dependencies, next) { return function (pkg) { pkg._from = from + pkg._optional = optional addShrinkwrap(pkg, iferr(next, andAddBundled(pkg, dependencies, next))) } } diff --git a/deps/npm/man/man1/npm-README.1 b/deps/npm/man/man1/npm-README.1 index b8c8d69deffe33..21f8a365ecb6ea 100644 --- a/deps/npm/man/man1/npm-README.1 +++ b/deps/npm/man/man1/npm-README.1 @@ -1,4 +1,4 @@ -.TH "NPM" "1" "October 2016" "" "" +.TH "NPM" "1" "November 2016" "" "" .SH "NAME" \fBnpm\fR \- a JavaScript package manager .P diff --git a/deps/npm/man/man1/npm-access.1 b/deps/npm/man/man1/npm-access.1 index 01fa5151e42b9d..30e9d72506149a 100644 --- a/deps/npm/man/man1/npm-access.1 +++ b/deps/npm/man/man1/npm-access.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ACCESS" "1" "October 2016" "" "" +.TH "NPM\-ACCESS" "1" "November 2016" "" "" .SH "NAME" \fBnpm-access\fR \- Set access level on published packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-adduser.1 b/deps/npm/man/man1/npm-adduser.1 index e6b501c0fedae3..3543fb9616a840 100644 --- a/deps/npm/man/man1/npm-adduser.1 +++ b/deps/npm/man/man1/npm-adduser.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ADDUSER" "1" "October 2016" "" "" +.TH "NPM\-ADDUSER" "1" "November 2016" "" "" .SH "NAME" \fBnpm-adduser\fR \- Add a registry user account .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-bin.1 b/deps/npm/man/man1/npm-bin.1 index a990d7181a730a..243b06163ecf8d 100644 --- a/deps/npm/man/man1/npm-bin.1 +++ b/deps/npm/man/man1/npm-bin.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BIN" "1" "October 2016" "" "" +.TH "NPM\-BIN" "1" "November 2016" "" "" .SH "NAME" \fBnpm-bin\fR \- Display npm bin folder .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-bugs.1 b/deps/npm/man/man1/npm-bugs.1 index 854432551a2550..512e2aa511036e 100644 --- a/deps/npm/man/man1/npm-bugs.1 +++ b/deps/npm/man/man1/npm-bugs.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUGS" "1" "October 2016" "" "" +.TH "NPM\-BUGS" "1" "November 2016" "" "" .SH "NAME" \fBnpm-bugs\fR \- Bugs for a package in a web browser maybe .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-build.1 b/deps/npm/man/man1/npm-build.1 index 3dae1eb602859d..98960880cb1ff6 100644 --- a/deps/npm/man/man1/npm-build.1 +++ b/deps/npm/man/man1/npm-build.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUILD" "1" "October 2016" "" "" +.TH "NPM\-BUILD" "1" "November 2016" "" "" .SH "NAME" \fBnpm-build\fR \- Build a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-bundle.1 b/deps/npm/man/man1/npm-bundle.1 index 685969cd5a018b..573507fbf00af5 100644 --- a/deps/npm/man/man1/npm-bundle.1 +++ b/deps/npm/man/man1/npm-bundle.1 @@ -1,4 +1,4 @@ -.TH "NPM\-BUNDLE" "1" "October 2016" "" "" +.TH "NPM\-BUNDLE" "1" "November 2016" "" "" .SH "NAME" \fBnpm-bundle\fR \- REMOVED .SH DESCRIPTION diff --git a/deps/npm/man/man1/npm-cache.1 b/deps/npm/man/man1/npm-cache.1 index 16a092c555d36e..7a0029dfe11749 100644 --- a/deps/npm/man/man1/npm-cache.1 +++ b/deps/npm/man/man1/npm-cache.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CACHE" "1" "October 2016" "" "" +.TH "NPM\-CACHE" "1" "November 2016" "" "" .SH "NAME" \fBnpm-cache\fR \- Manipulates packages cache .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-completion.1 b/deps/npm/man/man1/npm-completion.1 index d3170d27e8483d..9001f1f1306002 100644 --- a/deps/npm/man/man1/npm-completion.1 +++ b/deps/npm/man/man1/npm-completion.1 @@ -1,4 +1,4 @@ -.TH "NPM\-COMPLETION" "1" "October 2016" "" "" +.TH "NPM\-COMPLETION" "1" "November 2016" "" "" .SH "NAME" \fBnpm-completion\fR \- Tab Completion for npm .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-config.1 b/deps/npm/man/man1/npm-config.1 index 2466f5116267ff..e7ab261037e965 100644 --- a/deps/npm/man/man1/npm-config.1 +++ b/deps/npm/man/man1/npm-config.1 @@ -1,4 +1,4 @@ -.TH "NPM\-CONFIG" "1" "October 2016" "" "" +.TH "NPM\-CONFIG" "1" "November 2016" "" "" .SH "NAME" \fBnpm-config\fR \- Manage the npm configuration files .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-dedupe.1 b/deps/npm/man/man1/npm-dedupe.1 index fa57dfd2541411..fbe03de9d20650 100644 --- a/deps/npm/man/man1/npm-dedupe.1 +++ b/deps/npm/man/man1/npm-dedupe.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DEDUPE" "1" "October 2016" "" "" +.TH "NPM\-DEDUPE" "1" "November 2016" "" "" .SH "NAME" \fBnpm-dedupe\fR \- Reduce duplication .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-deprecate.1 b/deps/npm/man/man1/npm-deprecate.1 index 9721a75e972a6a..2bf5767c84472a 100644 --- a/deps/npm/man/man1/npm-deprecate.1 +++ b/deps/npm/man/man1/npm-deprecate.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DEPRECATE" "1" "October 2016" "" "" +.TH "NPM\-DEPRECATE" "1" "November 2016" "" "" .SH "NAME" \fBnpm-deprecate\fR \- Deprecate a version of a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-dist-tag.1 b/deps/npm/man/man1/npm-dist-tag.1 index aaa58bea8ed5f3..bb0223be0e7736 100644 --- a/deps/npm/man/man1/npm-dist-tag.1 +++ b/deps/npm/man/man1/npm-dist-tag.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DIST\-TAG" "1" "October 2016" "" "" +.TH "NPM\-DIST\-TAG" "1" "November 2016" "" "" .SH "NAME" \fBnpm-dist-tag\fR \- Modify package distribution tags .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-docs.1 b/deps/npm/man/man1/npm-docs.1 index 61ad1c464441dd..6381ca877073e4 100644 --- a/deps/npm/man/man1/npm-docs.1 +++ b/deps/npm/man/man1/npm-docs.1 @@ -1,4 +1,4 @@ -.TH "NPM\-DOCS" "1" "October 2016" "" "" +.TH "NPM\-DOCS" "1" "November 2016" "" "" .SH "NAME" \fBnpm-docs\fR \- Docs for a package in a web browser maybe .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-edit.1 b/deps/npm/man/man1/npm-edit.1 index 6d4ba2d07aee8d..5d7304cccd9e46 100644 --- a/deps/npm/man/man1/npm-edit.1 +++ b/deps/npm/man/man1/npm-edit.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EDIT" "1" "October 2016" "" "" +.TH "NPM\-EDIT" "1" "November 2016" "" "" .SH "NAME" \fBnpm-edit\fR \- Edit an installed package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-explore.1 b/deps/npm/man/man1/npm-explore.1 index 82f8e64c92b8de..ec62c4dddba067 100644 --- a/deps/npm/man/man1/npm-explore.1 +++ b/deps/npm/man/man1/npm-explore.1 @@ -1,4 +1,4 @@ -.TH "NPM\-EXPLORE" "1" "October 2016" "" "" +.TH "NPM\-EXPLORE" "1" "November 2016" "" "" .SH "NAME" \fBnpm-explore\fR \- Browse an installed package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-help-search.1 b/deps/npm/man/man1/npm-help-search.1 index 29a9eeff4a5878..5a69b934fb8c71 100644 --- a/deps/npm/man/man1/npm-help-search.1 +++ b/deps/npm/man/man1/npm-help-search.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HELP\-SEARCH" "1" "October 2016" "" "" +.TH "NPM\-HELP\-SEARCH" "1" "November 2016" "" "" .SH "NAME" \fBnpm-help-search\fR \- Search npm help documentation .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-help.1 b/deps/npm/man/man1/npm-help.1 index b4e46be9233168..89d4ce95837564 100644 --- a/deps/npm/man/man1/npm-help.1 +++ b/deps/npm/man/man1/npm-help.1 @@ -1,4 +1,4 @@ -.TH "NPM\-HELP" "1" "October 2016" "" "" +.TH "NPM\-HELP" "1" "November 2016" "" "" .SH "NAME" \fBnpm-help\fR \- Get help on npm .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-init.1 b/deps/npm/man/man1/npm-init.1 index 1f1337a0ef4a1c..231fcec120036e 100644 --- a/deps/npm/man/man1/npm-init.1 +++ b/deps/npm/man/man1/npm-init.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INIT" "1" "October 2016" "" "" +.TH "NPM\-INIT" "1" "November 2016" "" "" .SH "NAME" \fBnpm-init\fR \- Interactively create a package\.json file .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-install-test.1 b/deps/npm/man/man1/npm-install-test.1 index c633093ddc529e..6f5b110d7ab26a 100644 --- a/deps/npm/man/man1/npm-install-test.1 +++ b/deps/npm/man/man1/npm-install-test.1 @@ -1,4 +1,4 @@ -.TH "NPM" "" "October 2016" "" "" +.TH "NPM" "" "November 2016" "" "" .SH "NAME" \fBnpm\fR .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-install.1 b/deps/npm/man/man1/npm-install.1 index 8c3414b6af6d4c..3b2058025f06af 100644 --- a/deps/npm/man/man1/npm-install.1 +++ b/deps/npm/man/man1/npm-install.1 @@ -1,4 +1,4 @@ -.TH "NPM\-INSTALL" "1" "October 2016" "" "" +.TH "NPM\-INSTALL" "1" "November 2016" "" "" .SH "NAME" \fBnpm-install\fR \- Install a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-link.1 b/deps/npm/man/man1/npm-link.1 index a584daf181c366..38029dd472e30a 100644 --- a/deps/npm/man/man1/npm-link.1 +++ b/deps/npm/man/man1/npm-link.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LINK" "1" "October 2016" "" "" +.TH "NPM\-LINK" "1" "November 2016" "" "" .SH "NAME" \fBnpm-link\fR \- Symlink a package folder .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-logout.1 b/deps/npm/man/man1/npm-logout.1 index 65cf15b6352098..4a4653fb16ee0d 100644 --- a/deps/npm/man/man1/npm-logout.1 +++ b/deps/npm/man/man1/npm-logout.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LOGOUT" "1" "October 2016" "" "" +.TH "NPM\-LOGOUT" "1" "November 2016" "" "" .SH "NAME" \fBnpm-logout\fR \- Log out of the registry .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-ls.1 b/deps/npm/man/man1/npm-ls.1 index 607de78cd27b97..601a3610861e28 100644 --- a/deps/npm/man/man1/npm-ls.1 +++ b/deps/npm/man/man1/npm-ls.1 @@ -1,4 +1,4 @@ -.TH "NPM\-LS" "1" "October 2016" "" "" +.TH "NPM\-LS" "1" "November 2016" "" "" .SH "NAME" \fBnpm-ls\fR \- List installed packages .SH SYNOPSIS @@ -22,7 +22,7 @@ For example, running \fBnpm ls promzard\fP in npm's source tree will show: .P .RS 2 .nf -npm@3.10.9 /path/to/npm +npm@3.10.10 /path/to/npm └─┬ init\-package\-json@0\.0\.4 └── promzard@0\.1\.5 .fi diff --git a/deps/npm/man/man1/npm-outdated.1 b/deps/npm/man/man1/npm-outdated.1 index 63d3dd55131d7c..c12f40fdf5533e 100644 --- a/deps/npm/man/man1/npm-outdated.1 +++ b/deps/npm/man/man1/npm-outdated.1 @@ -1,4 +1,4 @@ -.TH "NPM\-OUTDATED" "1" "October 2016" "" "" +.TH "NPM\-OUTDATED" "1" "November 2016" "" "" .SH "NAME" \fBnpm-outdated\fR \- Check for outdated packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-owner.1 b/deps/npm/man/man1/npm-owner.1 index 7cc1ddf09f2bcf..71834133fb568c 100644 --- a/deps/npm/man/man1/npm-owner.1 +++ b/deps/npm/man/man1/npm-owner.1 @@ -1,4 +1,4 @@ -.TH "NPM\-OWNER" "1" "October 2016" "" "" +.TH "NPM\-OWNER" "1" "November 2016" "" "" .SH "NAME" \fBnpm-owner\fR \- Manage package owners .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-pack.1 b/deps/npm/man/man1/npm-pack.1 index 97f2cf669bff7f..44a791ef4991b9 100644 --- a/deps/npm/man/man1/npm-pack.1 +++ b/deps/npm/man/man1/npm-pack.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PACK" "1" "October 2016" "" "" +.TH "NPM\-PACK" "1" "November 2016" "" "" .SH "NAME" \fBnpm-pack\fR \- Create a tarball from a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-ping.1 b/deps/npm/man/man1/npm-ping.1 index 3a19287917d8e0..98d2c548b962cd 100644 --- a/deps/npm/man/man1/npm-ping.1 +++ b/deps/npm/man/man1/npm-ping.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PING" "1" "October 2016" "" "" +.TH "NPM\-PING" "1" "November 2016" "" "" .SH "NAME" \fBnpm-ping\fR \- Ping npm registry .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-prefix.1 b/deps/npm/man/man1/npm-prefix.1 index c8c4fda0aaeb66..65ec8f2d9d6f53 100644 --- a/deps/npm/man/man1/npm-prefix.1 +++ b/deps/npm/man/man1/npm-prefix.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PREFIX" "1" "October 2016" "" "" +.TH "NPM\-PREFIX" "1" "November 2016" "" "" .SH "NAME" \fBnpm-prefix\fR \- Display prefix .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-prune.1 b/deps/npm/man/man1/npm-prune.1 index 38207324c0fe02..44baa657ecece9 100644 --- a/deps/npm/man/man1/npm-prune.1 +++ b/deps/npm/man/man1/npm-prune.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PRUNE" "1" "October 2016" "" "" +.TH "NPM\-PRUNE" "1" "November 2016" "" "" .SH "NAME" \fBnpm-prune\fR \- Remove extraneous packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-publish.1 b/deps/npm/man/man1/npm-publish.1 index b26aa7541f6ff9..435dddf4be28da 100644 --- a/deps/npm/man/man1/npm-publish.1 +++ b/deps/npm/man/man1/npm-publish.1 @@ -1,4 +1,4 @@ -.TH "NPM\-PUBLISH" "1" "October 2016" "" "" +.TH "NPM\-PUBLISH" "1" "November 2016" "" "" .SH "NAME" \fBnpm-publish\fR \- Publish a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-rebuild.1 b/deps/npm/man/man1/npm-rebuild.1 index 0249a584068c12..5b5ead00acbfa9 100644 --- a/deps/npm/man/man1/npm-rebuild.1 +++ b/deps/npm/man/man1/npm-rebuild.1 @@ -1,4 +1,4 @@ -.TH "NPM\-REBUILD" "1" "October 2016" "" "" +.TH "NPM\-REBUILD" "1" "November 2016" "" "" .SH "NAME" \fBnpm-rebuild\fR \- Rebuild a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-repo.1 b/deps/npm/man/man1/npm-repo.1 index 4b8f808f05a236..3fe2f722c76154 100644 --- a/deps/npm/man/man1/npm-repo.1 +++ b/deps/npm/man/man1/npm-repo.1 @@ -1,4 +1,4 @@ -.TH "NPM\-REPO" "1" "October 2016" "" "" +.TH "NPM\-REPO" "1" "November 2016" "" "" .SH "NAME" \fBnpm-repo\fR \- Open package repository page in the browser .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-restart.1 b/deps/npm/man/man1/npm-restart.1 index 88ec6716e26861..bab238cb16b2c2 100644 --- a/deps/npm/man/man1/npm-restart.1 +++ b/deps/npm/man/man1/npm-restart.1 @@ -1,4 +1,4 @@ -.TH "NPM\-RESTART" "1" "October 2016" "" "" +.TH "NPM\-RESTART" "1" "November 2016" "" "" .SH "NAME" \fBnpm-restart\fR \- Restart a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-root.1 b/deps/npm/man/man1/npm-root.1 index 342541a0aa01d1..b22c6e950df214 100644 --- a/deps/npm/man/man1/npm-root.1 +++ b/deps/npm/man/man1/npm-root.1 @@ -1,4 +1,4 @@ -.TH "NPM\-ROOT" "1" "October 2016" "" "" +.TH "NPM\-ROOT" "1" "November 2016" "" "" .SH "NAME" \fBnpm-root\fR \- Display npm root .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-run-script.1 b/deps/npm/man/man1/npm-run-script.1 index 1adb93cfb5cf54..ddc7bc0fef90b7 100644 --- a/deps/npm/man/man1/npm-run-script.1 +++ b/deps/npm/man/man1/npm-run-script.1 @@ -1,4 +1,4 @@ -.TH "NPM\-RUN\-SCRIPT" "1" "October 2016" "" "" +.TH "NPM\-RUN\-SCRIPT" "1" "November 2016" "" "" .SH "NAME" \fBnpm-run-script\fR \- Run arbitrary package scripts .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-search.1 b/deps/npm/man/man1/npm-search.1 index a604aed22442ef..e412bbd62c09d8 100644 --- a/deps/npm/man/man1/npm-search.1 +++ b/deps/npm/man/man1/npm-search.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SEARCH" "1" "October 2016" "" "" +.TH "NPM\-SEARCH" "1" "November 2016" "" "" .SH "NAME" \fBnpm-search\fR \- Search for packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-shrinkwrap.1 b/deps/npm/man/man1/npm-shrinkwrap.1 index 8b722d69e9bccb..824d67a3e80c44 100644 --- a/deps/npm/man/man1/npm-shrinkwrap.1 +++ b/deps/npm/man/man1/npm-shrinkwrap.1 @@ -1,4 +1,4 @@ -.TH "NPM\-SHRINKWRAP" "1" "October 2016" "" "" +.TH "NPM\-SHRINKWRAP" "1" "November 2016" "" "" .SH "NAME" \fBnpm-shrinkwrap\fR \- Lock down dependency versions .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-star.1 b/deps/npm/man/man1/npm-star.1 index 5d452759fcf7d2..427f16a7cd6fae 100644 --- a/deps/npm/man/man1/npm-star.1 +++ b/deps/npm/man/man1/npm-star.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STAR" "1" "October 2016" "" "" +.TH "NPM\-STAR" "1" "November 2016" "" "" .SH "NAME" \fBnpm-star\fR \- Mark your favorite packages .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-stars.1 b/deps/npm/man/man1/npm-stars.1 index a49f53f43312b6..33a7e30254d365 100644 --- a/deps/npm/man/man1/npm-stars.1 +++ b/deps/npm/man/man1/npm-stars.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STARS" "1" "October 2016" "" "" +.TH "NPM\-STARS" "1" "November 2016" "" "" .SH "NAME" \fBnpm-stars\fR \- View packages marked as favorites .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-start.1 b/deps/npm/man/man1/npm-start.1 index fbfc1f30c62987..eec34f4ab3908f 100644 --- a/deps/npm/man/man1/npm-start.1 +++ b/deps/npm/man/man1/npm-start.1 @@ -1,4 +1,4 @@ -.TH "NPM\-START" "1" "October 2016" "" "" +.TH "NPM\-START" "1" "November 2016" "" "" .SH "NAME" \fBnpm-start\fR \- Start a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-stop.1 b/deps/npm/man/man1/npm-stop.1 index 671d037a1a44db..62ed5caa5fa4a8 100644 --- a/deps/npm/man/man1/npm-stop.1 +++ b/deps/npm/man/man1/npm-stop.1 @@ -1,4 +1,4 @@ -.TH "NPM\-STOP" "1" "October 2016" "" "" +.TH "NPM\-STOP" "1" "November 2016" "" "" .SH "NAME" \fBnpm-stop\fR \- Stop a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-tag.1 b/deps/npm/man/man1/npm-tag.1 index d2a99b48bc0753..ac9450d1b7c727 100644 --- a/deps/npm/man/man1/npm-tag.1 +++ b/deps/npm/man/man1/npm-tag.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TAG" "1" "October 2016" "" "" +.TH "NPM\-TAG" "1" "November 2016" "" "" .SH "NAME" \fBnpm-tag\fR \- Tag a published version .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-team.1 b/deps/npm/man/man1/npm-team.1 index 95f21cc1277966..32461b610f7c88 100644 --- a/deps/npm/man/man1/npm-team.1 +++ b/deps/npm/man/man1/npm-team.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TEAM" "1" "October 2016" "" "" +.TH "NPM\-TEAM" "1" "November 2016" "" "" .SH "NAME" \fBnpm-team\fR \- Manage organization teams and team memberships .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-test.1 b/deps/npm/man/man1/npm-test.1 index 277107521c231b..bb7dcdd7d8ebb8 100644 --- a/deps/npm/man/man1/npm-test.1 +++ b/deps/npm/man/man1/npm-test.1 @@ -1,4 +1,4 @@ -.TH "NPM\-TEST" "1" "October 2016" "" "" +.TH "NPM\-TEST" "1" "November 2016" "" "" .SH "NAME" \fBnpm-test\fR \- Test a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-uninstall.1 b/deps/npm/man/man1/npm-uninstall.1 index 2bf88c5e8bc373..794344eb01a04a 100644 --- a/deps/npm/man/man1/npm-uninstall.1 +++ b/deps/npm/man/man1/npm-uninstall.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UNINSTALL" "1" "October 2016" "" "" +.TH "NPM\-UNINSTALL" "1" "November 2016" "" "" .SH "NAME" \fBnpm-uninstall\fR \- Remove a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-unpublish.1 b/deps/npm/man/man1/npm-unpublish.1 index 447fb1d80af48a..f901b037d6179a 100644 --- a/deps/npm/man/man1/npm-unpublish.1 +++ b/deps/npm/man/man1/npm-unpublish.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UNPUBLISH" "1" "October 2016" "" "" +.TH "NPM\-UNPUBLISH" "1" "November 2016" "" "" .SH "NAME" \fBnpm-unpublish\fR \- Remove a package from the registry .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-update.1 b/deps/npm/man/man1/npm-update.1 index 3e0bad8dd59dbe..0326821b034bb3 100644 --- a/deps/npm/man/man1/npm-update.1 +++ b/deps/npm/man/man1/npm-update.1 @@ -1,4 +1,4 @@ -.TH "NPM\-UPDATE" "1" "October 2016" "" "" +.TH "NPM\-UPDATE" "1" "November 2016" "" "" .SH "NAME" \fBnpm-update\fR \- Update a package .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-version.1 b/deps/npm/man/man1/npm-version.1 index 5a2e09353e12f5..a8fdc4dd8ecd58 100644 --- a/deps/npm/man/man1/npm-version.1 +++ b/deps/npm/man/man1/npm-version.1 @@ -1,4 +1,4 @@ -.TH "NPM\-VERSION" "1" "October 2016" "" "" +.TH "NPM\-VERSION" "1" "November 2016" "" "" .SH "NAME" \fBnpm-version\fR \- Bump a package version .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-view.1 b/deps/npm/man/man1/npm-view.1 index 41a8f0061308d1..31b408ea2cb5eb 100644 --- a/deps/npm/man/man1/npm-view.1 +++ b/deps/npm/man/man1/npm-view.1 @@ -1,4 +1,4 @@ -.TH "NPM\-VIEW" "1" "October 2016" "" "" +.TH "NPM\-VIEW" "1" "November 2016" "" "" .SH "NAME" \fBnpm-view\fR \- View registry info .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm-whoami.1 b/deps/npm/man/man1/npm-whoami.1 index 6dbfb2754890df..1267864269f8f4 100644 --- a/deps/npm/man/man1/npm-whoami.1 +++ b/deps/npm/man/man1/npm-whoami.1 @@ -1,4 +1,4 @@ -.TH "NPM\-WHOAMI" "1" "October 2016" "" "" +.TH "NPM\-WHOAMI" "1" "November 2016" "" "" .SH "NAME" \fBnpm-whoami\fR \- Display npm username .SH SYNOPSIS diff --git a/deps/npm/man/man1/npm.1 b/deps/npm/man/man1/npm.1 index ee25dc257d77be..1515a7af956ffb 100644 --- a/deps/npm/man/man1/npm.1 +++ b/deps/npm/man/man1/npm.1 @@ -1,4 +1,4 @@ -.TH "NPM" "1" "October 2016" "" "" +.TH "NPM" "1" "November 2016" "" "" .SH "NAME" \fBnpm\fR \- javascript package manager .SH SYNOPSIS @@ -10,7 +10,7 @@ npm [args] .RE .SH VERSION .P -3.10.9 +3.10.10 .SH DESCRIPTION .P npm is the package manager for the Node JavaScript platform\. It puts diff --git a/deps/npm/man/man5/npm-folders.5 b/deps/npm/man/man5/npm-folders.5 index 28ce304c0e50ba..e30e11c5a668b7 100644 --- a/deps/npm/man/man5/npm-folders.5 +++ b/deps/npm/man/man5/npm-folders.5 @@ -1,4 +1,4 @@ -.TH "NPM\-FOLDERS" "5" "October 2016" "" "" +.TH "NPM\-FOLDERS" "5" "November 2016" "" "" .SH "NAME" \fBnpm-folders\fR \- Folder Structures Used by npm .SH DESCRIPTION diff --git a/deps/npm/man/man5/npm-global.5 b/deps/npm/man/man5/npm-global.5 index 28ce304c0e50ba..e30e11c5a668b7 100644 --- a/deps/npm/man/man5/npm-global.5 +++ b/deps/npm/man/man5/npm-global.5 @@ -1,4 +1,4 @@ -.TH "NPM\-FOLDERS" "5" "October 2016" "" "" +.TH "NPM\-FOLDERS" "5" "November 2016" "" "" .SH "NAME" \fBnpm-folders\fR \- Folder Structures Used by npm .SH DESCRIPTION diff --git a/deps/npm/man/man5/npm-json.5 b/deps/npm/man/man5/npm-json.5 index 2f552b73ccdb72..fafa100f77f6b1 100644 --- a/deps/npm/man/man5/npm-json.5 +++ b/deps/npm/man/man5/npm-json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\.JSON" "5" "October 2016" "" "" +.TH "PACKAGE\.JSON" "5" "November 2016" "" "" .SH "NAME" \fBpackage.json\fR \- Specifics of npm's package\.json handling .SH DESCRIPTION diff --git a/deps/npm/man/man5/npmrc.5 b/deps/npm/man/man5/npmrc.5 index 8d745e32a8dcd7..b40918d84f961f 100644 --- a/deps/npm/man/man5/npmrc.5 +++ b/deps/npm/man/man5/npmrc.5 @@ -1,4 +1,4 @@ -.TH "NPMRC" "5" "October 2016" "" "" +.TH "NPMRC" "5" "November 2016" "" "" .SH "NAME" \fBnpmrc\fR \- The npm config files .SH DESCRIPTION diff --git a/deps/npm/man/man5/package.json.5 b/deps/npm/man/man5/package.json.5 index 2f552b73ccdb72..fafa100f77f6b1 100644 --- a/deps/npm/man/man5/package.json.5 +++ b/deps/npm/man/man5/package.json.5 @@ -1,4 +1,4 @@ -.TH "PACKAGE\.JSON" "5" "October 2016" "" "" +.TH "PACKAGE\.JSON" "5" "November 2016" "" "" .SH "NAME" \fBpackage.json\fR \- Specifics of npm's package\.json handling .SH DESCRIPTION diff --git a/deps/npm/man/man7/npm-coding-style.7 b/deps/npm/man/man7/npm-coding-style.7 index 7ecbdcc568c34a..e5d71c1ac6c6ba 100644 --- a/deps/npm/man/man7/npm-coding-style.7 +++ b/deps/npm/man/man7/npm-coding-style.7 @@ -1,4 +1,4 @@ -.TH "NPM\-CODING\-STYLE" "7" "October 2016" "" "" +.TH "NPM\-CODING\-STYLE" "7" "November 2016" "" "" .SH "NAME" \fBnpm-coding-style\fR \- npm's "funny" coding style .SH DESCRIPTION diff --git a/deps/npm/man/man7/npm-config.7 b/deps/npm/man/man7/npm-config.7 index a6ad79af3dee4b..b35e9d1ce0a7c6 100644 --- a/deps/npm/man/man7/npm-config.7 +++ b/deps/npm/man/man7/npm-config.7 @@ -1,4 +1,4 @@ -.TH "NPM\-CONFIG" "7" "October 2016" "" "" +.TH "NPM\-CONFIG" "7" "November 2016" "" "" .SH "NAME" \fBnpm-config\fR \- More than you probably want to know about npm configuration .SH DESCRIPTION diff --git a/deps/npm/man/man7/npm-developers.7 b/deps/npm/man/man7/npm-developers.7 index 6c23dd383f8b9d..fa849ecfdac3cc 100644 --- a/deps/npm/man/man7/npm-developers.7 +++ b/deps/npm/man/man7/npm-developers.7 @@ -1,4 +1,4 @@ -.TH "NPM\-DEVELOPERS" "7" "October 2016" "" "" +.TH "NPM\-DEVELOPERS" "7" "November 2016" "" "" .SH "NAME" \fBnpm-developers\fR \- Developer Guide .SH DESCRIPTION diff --git a/deps/npm/man/man7/npm-disputes.7 b/deps/npm/man/man7/npm-disputes.7 index 2a091216c22609..04ce52b2d934e8 100644 --- a/deps/npm/man/man7/npm-disputes.7 +++ b/deps/npm/man/man7/npm-disputes.7 @@ -1,4 +1,4 @@ -.TH "NPM\-DISPUTES" "7" "October 2016" "" "" +.TH "NPM\-DISPUTES" "7" "November 2016" "" "" .SH "NAME" \fBnpm-disputes\fR \- Handling Module Name Disputes .SH SYNOPSIS diff --git a/deps/npm/man/man7/npm-index.7 b/deps/npm/man/man7/npm-index.7 index 0de2ed24939881..f2857df9e562a7 100644 --- a/deps/npm/man/man7/npm-index.7 +++ b/deps/npm/man/man7/npm-index.7 @@ -1,4 +1,4 @@ -.TH "NPM\-INDEX" "7" "October 2016" "" "" +.TH "NPM\-INDEX" "7" "November 2016" "" "" .SH "NAME" \fBnpm-index\fR \- Index of all npm documentation .SS npm help README diff --git a/deps/npm/man/man7/npm-orgs.7 b/deps/npm/man/man7/npm-orgs.7 index 6dffbfc5f23bad..95f966e0c1d6f0 100644 --- a/deps/npm/man/man7/npm-orgs.7 +++ b/deps/npm/man/man7/npm-orgs.7 @@ -1,4 +1,4 @@ -.TH "NPM\-ORGS" "7" "October 2016" "" "" +.TH "NPM\-ORGS" "7" "November 2016" "" "" .SH "NAME" \fBnpm-orgs\fR \- Working with Teams & Orgs .SH DESCRIPTION diff --git a/deps/npm/man/man7/npm-registry.7 b/deps/npm/man/man7/npm-registry.7 index ac367e4b846721..2710b1d8352972 100644 --- a/deps/npm/man/man7/npm-registry.7 +++ b/deps/npm/man/man7/npm-registry.7 @@ -1,4 +1,4 @@ -.TH "NPM\-REGISTRY" "7" "October 2016" "" "" +.TH "NPM\-REGISTRY" "7" "November 2016" "" "" .SH "NAME" \fBnpm-registry\fR \- The JavaScript Package Registry .SH DESCRIPTION diff --git a/deps/npm/man/man7/npm-scope.7 b/deps/npm/man/man7/npm-scope.7 index a066ab9a96fc64..af4ffc675a4d91 100644 --- a/deps/npm/man/man7/npm-scope.7 +++ b/deps/npm/man/man7/npm-scope.7 @@ -1,4 +1,4 @@ -.TH "NPM\-SCOPE" "7" "October 2016" "" "" +.TH "NPM\-SCOPE" "7" "November 2016" "" "" .SH "NAME" \fBnpm-scope\fR \- Scoped packages .SH DESCRIPTION diff --git a/deps/npm/man/man7/npm-scripts.7 b/deps/npm/man/man7/npm-scripts.7 index 1b98cb34cb21c7..60acb3195eec9c 100644 --- a/deps/npm/man/man7/npm-scripts.7 +++ b/deps/npm/man/man7/npm-scripts.7 @@ -1,4 +1,4 @@ -.TH "NPM\-SCRIPTS" "7" "October 2016" "" "" +.TH "NPM\-SCRIPTS" "7" "November 2016" "" "" .SH "NAME" \fBnpm-scripts\fR \- How npm handles the "scripts" field .SH DESCRIPTION diff --git a/deps/npm/man/man7/removing-npm.7 b/deps/npm/man/man7/removing-npm.7 index 2565ce29e09d75..b16fcf7d2e006e 100644 --- a/deps/npm/man/man7/removing-npm.7 +++ b/deps/npm/man/man7/removing-npm.7 @@ -1,4 +1,4 @@ -.TH "NPM\-REMOVAL" "1" "October 2016" "" "" +.TH "NPM\-REMOVAL" "1" "November 2016" "" "" .SH "NAME" \fBnpm-removal\fR \- Cleaning the Slate .SH SYNOPSIS diff --git a/deps/npm/man/man7/semver.7 b/deps/npm/man/man7/semver.7 index b9336120367b73..bff76838f53ff9 100644 --- a/deps/npm/man/man7/semver.7 +++ b/deps/npm/man/man7/semver.7 @@ -1,4 +1,4 @@ -.TH "SEMVER" "7" "October 2016" "" "" +.TH "SEMVER" "7" "November 2016" "" "" .SH "NAME" \fBsemver\fR \- The semantic versioner for npm .SH Usage diff --git a/deps/npm/package.json b/deps/npm/package.json index c1df08e43d4d8b..8716d59c3ad746 100644 --- a/deps/npm/package.json +++ b/deps/npm/package.json @@ -1,5 +1,5 @@ { - "version": "3.10.9", + "version": "3.10.10", "name": "npm", "description": "a package manager for JavaScript", "keywords": [ @@ -202,12 +202,12 @@ "dumpconf": "env | grep npm | sort | uniq", "prepublish": "node bin/npm-cli.js prune --prefix=. --no-global && rimraf test/*/*/node_modules && make doc-clean && make -j4 doc", "preversion": "bash scripts/update-authors.sh && git add AUTHORS && git commit -m \"update AUTHORS\" || true", - "tap": "tap --reporter=classic --timeout 300", - "tap-cover": "tap --coverage --reporter=classic --timeout 600", + "tap": "tap --timeout 300", + "tap-cover": "tap --coverage --timeout 600", "test": "standard && npm run test-tap", - "test-coverage": "npm run tap-cover -- \"test/tap/*.js\" \"test/network/*.js\"", - "test-tap": "npm run tap -- \"test/tap/*.js\"", - "test-node": "\"$NODE\" \"node_modules/.bin/tap\" --timeout 240 \"test/tap/*.js\" \"test/network/*.js\"" + "test-coverage": "npm run tap-cover -- \"test/tap/*.js\" \"test/network/*.js\" \"test/slow/*.js\" \"test/broken-under-*/*.js\"", + "test-tap": "npm run tap -- \"test/tap/*.js\" \"test/network/*.js\" \"test/slow/*.js\" \"test/broken-under-*/*.js\"", + "test-node": "\"$NODE\" \"node_modules/.bin/tap\" --timeout 240 \"test/tap/*.js\" \"test/network/*.js\" \"test/slow/*.js\" \"test/broken-under-nyc*/*.js\"" }, "license": "Artistic-2.0" } diff --git a/deps/npm/scripts/changelog.js b/deps/npm/scripts/changelog.js index abbec4b4e9e17d..158a79cc463fba 100644 --- a/deps/npm/scripts/changelog.js +++ b/deps/npm/scripts/changelog.js @@ -5,14 +5,14 @@ Usage: node scripts/changelog.js [comittish] Generates changelog entries in our format as best as its able based on -commits starting at comittish, or if that's not passed, master. +commits starting at comittish, or if that's not passed, latest. Ordinarily this is run via the gen-changelog shell script, which appends the result to the changelog. */ const execSync = require('child_process').execSync -const branch = process.argv[2] || 'master' +const branch = process.argv[2] || 'origin/latest' const log = execSync(`git log --reverse --pretty='format:%h %H%d %s (%aN)%n%b%n---%n' ${branch}...`).toString().split(/\n/) main() diff --git a/deps/npm/scripts/maketest b/deps/npm/scripts/maketest index b4f674393baac5..a71cadbc8c33db 100755 --- a/deps/npm/scripts/maketest +++ b/deps/npm/scripts/maketest @@ -40,13 +40,13 @@ var tmpdir = path.join(basedir, 'tmp') var conf = { cwd: testdir, - env: extend({ + env: extend(extend({}, process.env), { npm_config_cache: cachedir, npm_config_tmp: tmpdir, npm_config_prefix: globaldir, npm_config_registry: common.registry, npm_config_loglevel: 'warn' - }, process.env) + }) } var server diff --git a/deps/npm/test/tap/lifecycle-path.js b/deps/npm/test/broken-under-nyc-and-travis/lifecycle-path.js similarity index 93% rename from deps/npm/test/tap/lifecycle-path.js rename to deps/npm/test/broken-under-nyc-and-travis/lifecycle-path.js index 684fd4d3b589b8..a9d32d15b05e42 100644 --- a/deps/npm/test/tap/lifecycle-path.js +++ b/deps/npm/test/broken-under-nyc-and-travis/lifecycle-path.js @@ -83,9 +83,9 @@ function checkPath (withDirOfCurrentNode, t) { // get the ones we tacked on, then the system-specific requirements var expectedPaths = ['{{ROOT}}/bin/node-gyp-bin', - '{{ROOT}}/test/tap/lifecycle-path/node_modules/.bin'] + '{{ROOT}}/test/broken-under-nyc-and-travis/lifecycle-path/node_modules/.bin'] if (withDirOfCurrentNode) { - expectedPaths.push('{{ROOT}}/test/tap/lifecycle-path/node-bin') + expectedPaths.push('{{ROOT}}/test/broken-under-nyc-and-travis/lifecycle-path/node-bin') } var expect = expectedPaths.concat(newPATH.split(pathSplit)).map(function (p) { return p.replace(/\\/g, '/') diff --git a/deps/npm/test/tap/whoami.js b/deps/npm/test/broken-under-nyc-and-travis/whoami.js similarity index 100% rename from deps/npm/test/tap/whoami.js rename to deps/npm/test/broken-under-nyc-and-travis/whoami.js diff --git a/deps/npm/test/tap/legacy-npm-self-install.js b/deps/npm/test/slow/legacy-npm-self-install.js similarity index 100% rename from deps/npm/test/tap/legacy-npm-self-install.js rename to deps/npm/test/slow/legacy-npm-self-install.js diff --git a/deps/npm/test/tap/invalid-cmd-exit-code.js b/deps/npm/test/tap/invalid-cmd-exit-code.js index f4bb444a179690..b9a42f1be427b8 100644 --- a/deps/npm/test/tap/invalid-cmd-exit-code.js +++ b/deps/npm/test/tap/invalid-cmd-exit-code.js @@ -4,25 +4,31 @@ var common = require('../common-tap.js') var opts = { cwd: process.cwd() } test('npm asdf should return exit code 1', function (t) { - common.npm(['asdf'], opts, function (er, c) { - if (er) throw er - t.ok(c, 'exit code should not be zero') + common.npm(['asdf'], opts, function (err, code, stdout, stderr) { + if (err) throw err + t.ok(code, 'exit code should not be zero') + if (stdout.trim()) t.comment(stdout.trim()) + if (stderr.trim()) t.comment(stderr.trim()) t.end() }) }) test('npm help should return exit code 0', function (t) { - common.npm(['help'], opts, function (er, c) { - if (er) throw er - t.equal(c, 0, 'exit code should be 0') + common.npm(['help'], opts, function (err, code, stdout, stderr) { + if (err) throw err + t.equal(code, 0, 'exit code should be 0') + if (stdout.trim()) t.comment(stdout.trim()) + if (stderr.trim()) t.comment(stderr.trim()) t.end() }) }) test('npm help fadf should return exit code 0', function (t) { - common.npm(['help', 'fadf'], opts, function (er, c) { - if (er) throw er - t.equal(c, 0, 'exit code should be 0') + common.npm(['help', 'fadf'], opts, function (err, code, stdout, stderr) { + if (err) throw err + t.equal(code, 0, 'exit code should be 0') + if (stdout.trim()) t.comment(stdout.trim()) + if (stderr.trim()) t.comment(stderr.trim()) t.end() }) }) diff --git a/deps/npm/test/tap/shrinkwrap-optional-platform.js b/deps/npm/test/tap/shrinkwrap-optional-platform.js index 09d26f778be303..4dced0253fcbc5 100644 --- a/deps/npm/test/tap/shrinkwrap-optional-platform.js +++ b/deps/npm/test/tap/shrinkwrap-optional-platform.js @@ -33,12 +33,21 @@ var fixture = new Tacks(Dir({ 'package.json': File({ name: 'mod1', version: '1.0.0', - scripts: { - + scripts: {}, + 'optionalDependencies': { + 'mod2': 'file:../mod2' }, os: ['nosuchos'] }) }), + mod2: Dir({ + 'package.json': File({ + name: 'mod2', + version: '1.0.0', + scripts: {}, + os: ['nosuchos'] + }) + }), 'npm-shrinkwrap.json': File({ name: 'shrinkwrap-optional-platform', version: '1.0.0', @@ -48,6 +57,12 @@ var fixture = new Tacks(Dir({ from: 'mod1', resolved: 'file:mod1', optional: true + }, + mod2: { + version: '1.0.0', + from: 'mod2', + resolved: 'file:mod2', + optional: true } } }), @@ -93,4 +108,3 @@ test('cleanup', function (t) { cleanup() t.done() }) - From 50947b7b0fcc4e77af39b9ca357e3eecdd0f279c Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Wed, 30 Nov 2016 17:18:48 -0600 Subject: [PATCH 208/313] doc: remove Sam Roberts from release team MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also, remove my key, since I never did a release. PR-URL: https://github.com/nodejs/node/pull/9862 Reviewed-By: Colin Ihrig Reviewed-By: Сковорода Никита Андреевич Reviewed-By: Evan Lucas Reviewed-By: Anna Henningsen Reviewed-By: Myles Borins Reviewed-By: Jeremiah Senkpiel Reviewed-By: Johan Bergström --- README.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/README.md b/README.md index f8cc58c8310136..61aaa710835fee 100644 --- a/README.md +++ b/README.md @@ -362,15 +362,12 @@ Releases of Node.js and io.js will be signed with one of the following GPG keys: `C4F0DFFF4E8C1A8236409D08E73BC641CC11F4C8` * **Rod Vagg** <rod@vagg.org> `DD8F2338BAE7501E3DD5AC78C273792F7D83545D` -* **Sam Roberts** <octetcloud@keybase.io> -`0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93` The full set of trusted release keys can be imported by running: ```shell gpg --keyserver pool.sks-keyservers.net --recv-keys 9554F04D7259F04124DE6B476D5A82AC7E37093B gpg --keyserver pool.sks-keyservers.net --recv-keys 94AE36675C464D64BAFA68DD7434390BDBE9B9C5 -gpg --keyserver pool.sks-keyservers.net --recv-keys 0034A06D9D9B0064CE8ADF6BF1747F4AD2306D93 gpg --keyserver pool.sks-keyservers.net --recv-keys FD3A5288F042B6850C66B31F09FE44734EB7990E gpg --keyserver pool.sks-keyservers.net --recv-keys 71DCFD284A79C3B38668286BC97EC7A07EDE3FC1 gpg --keyserver pool.sks-keyservers.net --recv-keys DD8F2338BAE7501E3DD5AC78C273792F7D83545D From ff7d85647b84f83916f2b7c67d952bbb0b9c66a0 Mon Sep 17 00:00:00 2001 From: JungMinu Date: Tue, 15 Nov 2016 11:29:15 +0900 Subject: [PATCH 209/313] doc: remove invalid padding from privateEncrypt PR-URL: https://github.com/nodejs/node/pull/9611 Fixes: https://github.com/nodejs/node/issues/9609 Reviewed-By: Claudio Rodriguez Reviewed-By: Sam Roberts Reviewed-By: James M Snell Reviewed-By: Roman Reiss --- doc/api/crypto.md | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 51e0a7b0115cf0..290d0429d35315 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -1451,7 +1451,6 @@ keys: * `padding` : An optional padding value, one of the following: * `crypto.constants.RSA_NO_PADDING` * `crypto.constants.RSA_PKCS1_PADDING` - * `crypto.constants.RSA_PKCS1_OAEP_PADDING` All paddings are defined in `crypto.constants`. From cd3b91bc4e10602d9a17f898e586dd6b8e81a10d Mon Sep 17 00:00:00 2001 From: Rahat Ahmed Date: Tue, 15 Nov 2016 13:56:03 -0600 Subject: [PATCH 210/313] doc: improve description of urlObject.query MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The description of urlObject.query is ambiguous about when it's an object vs when it's a string. Added a sentence pointing to the option that determines this in url.parse(). Also fixed the missing parentheses in the first sentence by rewording it to avoid nested parentheses. PR-URL: https://github.com/nodejs/node/pull/9625 Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Michaël Zasso --- doc/api/url.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/api/url.md b/doc/api/url.md index 522c5396d900dc..6d573b4b910f27 100644 --- a/doc/api/url.md +++ b/doc/api/url.md @@ -114,9 +114,10 @@ No decoding of the `path` is performed. ### urlObject.query -The `query` property is either the "params" portion of the query string ( -everything *except* the leading ASCII question mark (`?`), or an object -returned by the [`querystring`][] module's `parse()` method: +The `query` property is either the query string without the leading ASCII +question mark (`?`), or an object returned by the [`querystring`][] module's +`parse()` method. Whether the `query` property is a string or object is +determined by the `parseQueryString` argument passed to `url.parse()`. For example: `'query=string'` or `{'query': 'string'}` From 0256b7b057ed8fd4b07f64e73f8c86863ebe0be7 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 16 Nov 2016 02:58:40 +0100 Subject: [PATCH 211/313] tools: use better regexp for manpage references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In practice, manpage names may contain dots (e.g. `resolv.conf(5)`). PR-URL: https://github.com/nodejs/node/pull/9632 Reviewed-By: Ben Noordhuis Reviewed-By: Jeremiah Senkpiel Reviewed-By: James M Snell Reviewed-By: Michaël Zasso Reviewed-By: Luigi Pinca --- tools/doc/html.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/doc/html.js b/tools/doc/html.js index 3b60116b1ba422..daa230cb926e4a 100644 --- a/tools/doc/html.js +++ b/tools/doc/html.js @@ -263,7 +263,7 @@ var BSD_ONLY_SYSCALLS = new Set(['lchmod']); // Returns modified text, with such refs replace with HTML links, for example // 'open(2)' function linkManPages(text) { - return text.replace(/ ([a-z]+)\((\d)\)/gm, function(match, name, number) { + return text.replace(/ ([a-z.]+)\((\d)\)/gm, function(match, name, number) { // name consists of lowercase letters, number is a single digit var displayAs = name + '(' + number + ')'; if (BSD_ONLY_SYSCALLS.has(name)) { From 7a02eb2b03e2e3cdf957a65d8c597b559a05261a Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Wed, 16 Nov 2016 03:00:30 +0100 Subject: [PATCH 212/313] doc: remove backtick escaping for manpage refs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing backticks will make the doctool emit links to the man pages. PR-URL: https://github.com/nodejs/node/pull/9632 Reviewed-By: Ben Noordhuis Reviewed-By: Jeremiah Senkpiel Reviewed-By: James M Snell Reviewed-By: Michaël Zasso Reviewed-By: Luigi Pinca --- doc/api/child_process.md | 2 +- doc/api/console.md | 4 ++-- doc/api/dns.md | 8 ++++---- doc/api/fs.md | 12 ++++++------ doc/api/readline.md | 4 ++-- doc/api/repl.md | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 1cf30f440e5d71..858e87f9805bac 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -814,7 +814,7 @@ added: v0.1.90 * `signal` {String} The `child.kill()` methods sends a signal to the child process. If no argument -is given, the process will be sent the `'SIGTERM'` signal. See `signal(7)` for +is given, the process will be sent the `'SIGTERM'` signal. See signal(7) for a list of available signals. ```js diff --git a/doc/api/console.md b/doc/api/console.md index 054eacc2bc7f82..e5d3957e5087dd 100644 --- a/doc/api/console.md +++ b/doc/api/console.md @@ -184,7 +184,7 @@ added: v0.1.100 Prints to `stderr` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution -values similar to `printf(3)` (the arguments are all passed to +values similar to printf(3) (the arguments are all passed to [`util.format()`][]). ```js @@ -213,7 +213,7 @@ added: v0.1.100 Prints to `stdout` with newline. Multiple arguments can be passed, with the first used as the primary message and all additional used as substitution -values similar to `printf(3)` (the arguments are all passed to +values similar to printf(3) (the arguments are all passed to [`util.format()`][]). ```js diff --git a/doc/api/dns.md b/doc/api/dns.md index e930892cedc927..cd66548daf811a 100644 --- a/doc/api/dns.md +++ b/doc/api/dns.md @@ -407,14 +407,14 @@ Under the hood, [`dns.lookup()`][] uses the same operating system facilities as most other programs. For instance, [`dns.lookup()`][] will almost always resolve a given name the same way as the `ping` command. On most POSIX-like operating systems, the behavior of the [`dns.lookup()`][] function can be -modified by changing settings in `nsswitch.conf(5)` and/or `resolv.conf(5)`, +modified by changing settings in nsswitch.conf(5) and/or resolv.conf(5), but note that changing these files will change the behavior of _all other programs running on the same operating system_. Though the call to `dns.lookup()` will be asynchronous from JavaScript's -perspective, it is implemented as a synchronous call to `getaddrinfo(3)` that +perspective, it is implemented as a synchronous call to getaddrinfo(3) that runs on libuv's threadpool. Because libuv's threadpool has a fixed size, it -means that if for whatever reason the call to `getaddrinfo(3)` takes a long +means that if for whatever reason the call to getaddrinfo(3) takes a long time, other operations that could run on libuv's threadpool (such as filesystem operations) will experience degraded performance. In order to mitigate this issue, one potential solution is to increase the size of libuv's threadpool by @@ -425,7 +425,7 @@ setting the `'UV_THREADPOOL_SIZE'` environment variable to a value greater than ### `dns.resolve()`, `dns.resolve*()` and `dns.reverse()` These functions are implemented quite differently than [`dns.lookup()`][]. They -do not use `getaddrinfo(3)` and they _always_ perform a DNS query on the +do not use getaddrinfo(3) and they _always_ perform a DNS query on the network. This network communication is always done asynchronously, and does not use libuv's threadpool. diff --git a/doc/api/fs.md b/doc/api/fs.md index a9c0c63a771fb5..20bc2d9c8df612 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -251,13 +251,13 @@ page. The times in the stat object have the following semantics: * `atime` "Access Time" - Time when file data last accessed. Changed - by the `mknod(2)`, `utimes(2)`, and `read(2)` system calls. + by the mknod(2), utimes(2), and read(2) system calls. * `mtime` "Modified Time" - Time when file data last modified. - Changed by the `mknod(2)`, `utimes(2)`, and `write(2)` system calls. + Changed by the mknod(2), utimes(2), and write(2) system calls. * `ctime` "Change Time" - Time when file status was last changed - (inode data modification). Changed by the `chmod(2)`, `chown(2)`, - `link(2)`, `mknod(2)`, `rename(2)`, `unlink(2)`, `utimes(2)`, - `read(2)`, and `write(2)` system calls. + (inode data modification). Changed by the chmod(2), chown(2), + link(2), mknod(2), rename(2), unlink(2), utimes(2), + read(2), and write(2) system calls. * `birthtime` "Birth Time" - Time of file creation. Set once when the file is created. On filesystems where birthtime is not available, this field may instead hold either the `ctime` or @@ -265,7 +265,7 @@ The times in the stat object have the following semantics: value may be greater than `atime` or `mtime` in this case. On Darwin and other FreeBSD variants, also set if the `atime` is explicitly set to an earlier value than the current `birthtime` using the - `utimes(2)` system call. + utimes(2) system call. Prior to Node v0.12, the `ctime` held the `birthtime` on Windows systems. Note that as of v0.12, `ctime` is not "creation time", and diff --git a/doc/api/readline.md b/doc/api/readline.md index 36c7e4502274bd..c5da92213064ec 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -124,7 +124,7 @@ added: v0.7.5 The `'SIGCONT'` event is emitted when a Node.js process previously moved into the background using `-Z` (i.e. `SIGTSTP`) is then brought back to the -foreground using `fg(1)`. +foreground using fg(1). If the `input` stream was paused *before* the `SIGTSTP` request, this event will not be emitted. @@ -174,7 +174,7 @@ input, typically known as `SIGTSTP`. If there are no `SIGTSTP` event listeners registered when the `input` stream receives a `SIGTSTP`, the Node.js process will be sent to the background. -When the program is resumed using `fg(1)`, the `'pause'` and `SIGCONT` events +When the program is resumed using fg(1), the `'pause'` and `SIGCONT` events will be emitted. These can be used to resume the `input` stream. The `'pause'` and `'SIGCONT'` events will not be emitted if the `input` was diff --git a/doc/api/repl.md b/doc/api/repl.md index 67eae5d1cca6e8..b78a13544add4a 100644 --- a/doc/api/repl.md +++ b/doc/api/repl.md @@ -535,7 +535,7 @@ possible to connect to a long-running Node.js process without restarting it. For an example of running a "full-featured" (`terminal`) REPL over a `net.Server` and `net.Socket` instance, see: https://gist.github.com/2209310 -For an example of running a REPL instance over `curl(1)`, +For an example of running a REPL instance over curl(1), see: https://gist.github.com/2053342 [stream]: stream.html From cbea672214ee7153558bb6764ba987659af0fc00 Mon Sep 17 00:00:00 2001 From: monkick Date: Sat, 12 Nov 2016 16:30:28 +0900 Subject: [PATCH 213/313] doc: fix typo in BUILDING.md e.g., to e.g. at BUILDING.md line 116 PR-URL: https://github.com/nodejs/node/pull/9569 Reviewed-By: Roman Reiss Reviewed-By: Anna Henningsen Reviewed-By: Luigi Pinca Reviewed-By: Shigeki Ohtsu Reviewed-By: Michael Dawson Reviewed-By: James M Snell --- BUILDING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BUILDING.md b/BUILDING.md index 2fe919328edd62..d0c0def6f16905 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -113,7 +113,7 @@ To test if Node.js was built correctly: > Release\node -e "console.log('Hello from Node.js', process.version)" ``` -### Android / Android-based devices (e.g., Firefox OS) +### Android / Android-based devices (e.g. Firefox OS) Although these instructions for building on Android are provided, please note that Android is not an officially supported platform at this time. Patches to From f9fd53d82ddecef556916fafe3dc7bf0a64baef4 Mon Sep 17 00:00:00 2001 From: Josh Gavant Date: Mon, 14 Nov 2016 15:22:48 -0800 Subject: [PATCH 214/313] src: fix method name, output format MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add additional newline to HTTP GET JSON responses * SendTargentsListResponse -> SendListResponse PR-URL: https://github.com/nodejs/node/pull/9627 Reviewed-By: James M Snell Reviewed-By: Michaël Zasso Reviewed-By: Anna Henningsen --- src/inspector_agent.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index 11ee568b5e2dd2..21fa2cf7c1bc20 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -66,7 +66,7 @@ std::string MapToString(const std::map object) { json << name_value.second << "\""; first = false; } - json << "\n} ]"; + json << "\n} ]\n\n"; return json.str(); } @@ -219,7 +219,7 @@ class AgentImpl { void WaitForFrontendMessage(); void NotifyMessageReceived(); State ToState(State state); - void SendTargentsListResponse(InspectorSocket* socket); + void SendListResponse(InspectorSocket* socket); bool RespondToGet(InspectorSocket* socket, const std::string& path); uv_sem_t start_sem_; @@ -639,7 +639,7 @@ void AgentImpl::OnRemoteDataIO(InspectorSocket* socket, } } -void AgentImpl::SendTargentsListResponse(InspectorSocket* socket) { +void AgentImpl::SendListResponse(InspectorSocket* socket) { std::map response; response["description"] = "node.js instance"; response["faviconUrl"] = "https://nodejs.org/static/favicon.ico"; @@ -673,7 +673,7 @@ bool AgentImpl::RespondToGet(InspectorSocket* socket, const std::string& path) { return false; if (match_path_segment(command, "list") || command[0] == '\0') { - SendTargentsListResponse(socket); + SendListResponse(socket); return true; } else if (match_path_segment(command, "protocol")) { SendProtocolJson(socket); From 12993b298a67c17f85492d0945f928c9b93cf853 Mon Sep 17 00:00:00 2001 From: Gibson Fahnestock Date: Wed, 16 Nov 2016 16:02:57 +0000 Subject: [PATCH 215/313] build: default to ppc64 on AIX The ./configure python script searches `gcc -dM -E -` for the ARCH flags. On AIX, gcc builds in 32 bit mode by default prior to gcc v6, so you don't get the __PPC64__ flag unless you run `gcc -maix64 -dM -E -`. We don't support ppc 32 bit for any OS, so always use ppc64 as the host_arch. PR-URL: https://github.com/nodejs/node/pull/9645 Reviewed-By: Michael Dawson Reviewed-By: James M Snell --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/configure b/configure index 377e82d095d642..6f799869e7b15b 100755 --- a/configure +++ b/configure @@ -677,7 +677,7 @@ def host_arch_cc(): '__MIPSEL__' : 'mipsel', '__mips__' : 'mips', '__PPC64__' : 'ppc64', - '__PPC__' : 'ppc', + '__PPC__' : 'ppc64', '__x86_64__' : 'x64', '__s390__' : 's390', '__s390x__' : 's390x', From f05f0fe74e2623e376d43a54ea186758519b62e6 Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Fri, 18 Nov 2016 09:40:45 -0800 Subject: [PATCH 216/313] tools: disallow trailing whitespace for markdown MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit markdown had a dispensation because 2 or more trailing spaces triggers a new paragraph. There are no examples of that usage in Node, all trailing whitespace found were mistakes, and the dispensation is now removed. See: https://github.com/nodejs/node/pull/9620 PR-URL: https://github.com/nodejs/node/pull/9676 Reviewed-By: Luigi Pinca Reviewed-By: Roman Reiss Reviewed-By: Michaël Zasso Reviewed-By: Gibson Fahnestock --- .editorconfig | 3 --- BUILDING.md | 2 +- doc/changelogs/CHANGELOG_V010.md | 6 +++--- doc/changelogs/CHANGELOG_V012.md | 2 +- test/README.md | 4 ++-- 5 files changed, 7 insertions(+), 10 deletions(-) diff --git a/.editorconfig b/.editorconfig index ca97ab47dfea49..a1df58daf869c8 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,9 +8,6 @@ trim_trailing_whitespace = true [vcbuild.bat] end_of_line = crlf -[*.{md,markdown}] -trim_trailing_whitespace = false - [{lib,src,test}/**.js] indent_style = space indent_size = 2 diff --git a/BUILDING.md b/BUILDING.md index d0c0def6f16905..5051da343353b3 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -20,7 +20,7 @@ Prerequisites: On OS X, you will also need: * [Xcode](https://developer.apple.com/xcode/download/) - * You also need to install the `Command Line Tools` via Xcode. You can find + * You also need to install the `Command Line Tools` via Xcode. You can find this under the menu `Xcode -> Preferences -> Downloads` * This step will install `gcc` and the related toolchain containing `make` diff --git a/doc/changelogs/CHANGELOG_V010.md b/doc/changelogs/CHANGELOG_V010.md index a81d589d7c55ac..5d608325523316 100644 --- a/doc/changelogs/CHANGELOG_V010.md +++ b/doc/changelogs/CHANGELOG_V010.md @@ -66,7 +66,7 @@ * [io.js](CHANGELOG_IOJS.md) * [Archive](CHANGELOG_ARCHIVE.md) -**Note:** Node.js v0.10 is covered by the +**Note:** Node.js v0.10 is covered by the [Node.js Long Term Support Plan](https://github.com/nodejs/LTS) and will be maintained until October 2016. @@ -294,11 +294,11 @@ https://github.com/nodejs/node/commit/8d045a30e95602b443eb259a5021d33feb4df079 * child_process: properly support optional args (cjihrig) * crypto: Disable autonegotiation for SSLv2/3 by default (Fedor Indutny, Timothy J Fontaine, Alexis Campailla) - + This is a behavior change, by default we will not allow the negotiation to SSLv2 or SSLv3. If you want this behavior, run Node.js with either `--enable-ssl2` or `--enable-ssl3` respectively. - + This does not change the behavior for users specifically requesting `SSLv2_method` or `SSLv3_method`. While this behavior is not advised, it is assumed you know what you're doing since you're specifically asking to use diff --git a/doc/changelogs/CHANGELOG_V012.md b/doc/changelogs/CHANGELOG_V012.md index 42aff48f95feb4..db7eece83b86ba 100644 --- a/doc/changelogs/CHANGELOG_V012.md +++ b/doc/changelogs/CHANGELOG_V012.md @@ -33,7 +33,7 @@ * [io.js](CHANGELOG_IOJS.md) * [Archive](CHANGELOG_ARCHIVE.md) -**Note:** Node.js v0.12 is covered by the +**Note:** Node.js v0.12 is covered by the [Node.js Long Term Support Plan](https://github.com/nodejs/LTS) and will be maintained until December 31st, 2016. diff --git a/test/README.md b/test/README.md index 736de97b71a848..1c3303435db517 100644 --- a/test/README.md +++ b/test/README.md @@ -146,7 +146,7 @@ and `setInterval`). ## Common module API The common.js module is used by tests for consistency across repeated -tasks. It has a number of helpful functions and properties to help with +tasks. It has a number of helpful functions and properties to help with writing tests. ### allowGlobals(...whitelist) @@ -177,7 +177,7 @@ Check if there is more than 1gb of total memory. * `name` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) * `expected` [<String>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | [<Array>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array) -Tests whether `name` and `expected` are part of a raised warning. +Tests whether `name` and `expected` are part of a raised warning. ### hasCrypto * return [<Boolean>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) From 4334d6a85a18f69db4cb9cd0c8d85ef8baea8081 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Sun, 20 Nov 2016 04:20:35 +0200 Subject: [PATCH 217/313] doc: fix typo in assert code example PR-URL: https://github.com/nodejs/node/pull/9704 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Luigi Pinca --- doc/api/assert.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/assert.md b/doc/api/assert.md index 066a72215c658f..3db5f676886ca8 100644 --- a/doc/api/assert.md +++ b/doc/api/assert.md @@ -345,7 +345,7 @@ assert.notStrictEqual(1, 2); // OK assert.notStrictEqual(1, 1); -// AssertionError: 1 != 1 +// AssertionError: 1 !== 1 assert.notStrictEqual(1, '1'); // OK From 1c9817cbeb45be74cbf2f9d4f9fe7298b4312b60 Mon Sep 17 00:00:00 2001 From: Adam Brunner Date: Tue, 22 Nov 2016 10:03:04 +0100 Subject: [PATCH 218/313] doc: "util" is not needed to extend ES6 classes PR-URL: https://github.com/nodejs/node/pull/9737 Reviewed-By: Colin Ihrig Reviewed-By: Italo A. Casas Reviewed-By: Roman Reiss Reviewed-By: Luigi Pinca --- doc/api/util.md | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/api/util.md b/doc/api/util.md index 3e4a4b1d39fd82..a8fded6b2db042 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -180,7 +180,6 @@ stream.write('It works!'); // Received data: "It works!" ES6 example using `class` and `extends` ```js -const util = require('util'); const EventEmitter = require('events'); class MyStream extends EventEmitter { From 4b7200ef7b9244755d112d0b8fdcd05275a882da Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Mon, 21 Nov 2016 20:46:49 -0800 Subject: [PATCH 219/313] doc: clarify slashes-appending in url module PR-URL: https://github.com/nodejs/node/pull/9731 Ref: https://github.com/nodejs/node/issues/9521 Reviewed-By: Luigi Pinca --- doc/api/url.md | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/doc/api/url.md b/doc/api/url.md index 6d573b4b910f27..40a3440195e69a 100644 --- a/doc/api/url.md +++ b/doc/api/url.md @@ -154,10 +154,11 @@ The formatting process operates as follows: [`Error`][] is thrown. * For all string values of `urlObject.protocol` that *do not end* with an ASCII colon (`:`) character, the literal string `:` will be appended to `result`. -* If either the `urlObject.slashes` property is true, `urlObject.protocol` - begins with one of `http`, `https`, `ftp`, `gopher`, or `file`, or - `urlObject.protocol` is `undefined`, the literal string `//` will be appended - to `result`. +* If either of the following conditions is true, then the literal string `//` + will be appended to `result`: + * `urlObject.slashes` property is true; + * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or + `file`; * If the value of the `urlObject.auth` property is truthy, and either `urlObject.host` or `urlObject.hostname` are not `undefined`, the value of `urlObject.auth` will be coerced into a string and appended to `result` From 7051ea8606bdd9eb1466f7710154abb05bc5111c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E4=B8=B6=E8=A8=80?= Date: Thu, 24 Nov 2016 16:28:02 +0800 Subject: [PATCH 220/313] doc: fix crypto "decipher.setAAD()" typo PR-URL: https://github.com/nodejs/node/pull/9782 Reviewed-By: Brian White Reviewed-By: Italo A. Casas Reviewed-By: Sam Roberts --- doc/api/crypto.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 290d0429d35315..2eda378520f3b1 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -326,7 +326,7 @@ added: v1.0.0 --> When using an authenticated encryption mode (only `GCM` is currently -supported), the `cipher.setAAD()` method sets the value used for the +supported), the `decipher.setAAD()` method sets the value used for the _additional authenticated data_ (AAD) input parameter. ### decipher.setAuthTag(buffer) From 87f008393e3d2ceecf0ecd614a0153faeed63c9b Mon Sep 17 00:00:00 2001 From: atrioom Date: Tue, 15 Nov 2016 12:47:30 +0100 Subject: [PATCH 221/313] doc: changed order of invocations in https.request() example. When you call req.end() before you add .on listeners you get an Error that you can't call .on on undefined. PR-URL: https://github.com/nodejs/node/pull/9614 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- doc/api/https.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/https.md b/doc/api/https.md index c2231dca1830e5..355fd7b133a76d 100644 --- a/doc/api/https.md +++ b/doc/api/https.md @@ -158,11 +158,11 @@ var req = https.request(options, (res) => { process.stdout.write(d); }); }); -req.end(); req.on('error', (e) => { console.error(e); }); +req.end(); ``` The options argument has the following options From 9c3f4d63cc7b2a5398460dd892716b269a7d8aec Mon Sep 17 00:00:00 2001 From: Dan Koster Date: Sun, 16 Oct 2016 22:07:49 -0700 Subject: [PATCH 222/313] doc: minor fixes event-loop-timers-and-nexttick.md Minor fixes and enhancements to event-loop-timers-and-nexttick.md Added missing "be" Added a link to REPL docs Added definition of libuv and a link PR-URL: https://github.com/nodejs/node/pull/9126 Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- doc/topics/event-loop-timers-and-nexttick.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/topics/event-loop-timers-and-nexttick.md b/doc/topics/event-loop-timers-and-nexttick.md index ca2e1b555981c7..d7d0ee96e9c438 100644 --- a/doc/topics/event-loop-timers-and-nexttick.md +++ b/doc/topics/event-loop-timers-and-nexttick.md @@ -9,13 +9,13 @@ offloading operations to the system kernel whenever possible. Since most modern kernels are multi-threaded, they can handle multiple operations executing in the background. When one of these operations completes, the kernel tells Node.js so that the appropriate callback -may added to the **poll** queue to eventually be executed. We'll explain +may be added to the **poll** queue to eventually be executed. We'll explain this in further detail later in this topic. ## Event Loop Explained When Node.js starts, it initializes the event loop, processes the -provided input script (or drops into the REPL, which is not covered in +provided input script (or drops into the [REPL][], which is not covered in this document) which may make async API calls, schedule timers, or call `process.nextTick()`, then begins processing the event loop. @@ -144,7 +144,9 @@ the timer's callback. In this example, you will see that the total delay between the timer being scheduled and its callback being executed will be 105ms. -Note: To prevent the **poll** phase from starving the event loop, libuv +Note: To prevent the **poll** phase from starving the event loop, [libuv] +(http://libuv.org/) (the C library that implements the Node.js +event loop and all of the asynchronous behaviors of the platform) also has a hard maximum (system dependent) before it stops polling for more events. @@ -480,3 +482,5 @@ myEmitter.on('event', function() { console.log('an event occurred!'); }); ``` + +[REPL]: https://nodejs.org/api/repl.html#repl_repl From a3ba4ff49f84aca3e27dad960e34bba52b9db8f9 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Wed, 23 Nov 2016 14:14:20 +0100 Subject: [PATCH 223/313] inspector: /json/version returns object, not array Make /json/version return an object instead of an object wrapped in an array. Fixes: https://github.com/nodejs/node/issues/9760 PR-URL: https://github.com/nodejs/node/pull/9762 Reviewed-By: Colin Ihrig Reviewed-By: Eugene Ostroukhov Reviewed-By: Santiago Gimeno --- src/inspector_agent.cc | 21 ++++++++++++++------- test/inspector/test-inspector.js | 6 ++++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/inspector_agent.cc b/src/inspector_agent.cc index 21fa2cf7c1bc20..79bd71e24d0db2 100644 --- a/src/inspector_agent.cc +++ b/src/inspector_agent.cc @@ -91,23 +91,30 @@ void OnBufferAlloc(uv_handle_t* handle, size_t len, uv_buf_t* buf) { buf->len = len; } -void SendHttpResponse(InspectorSocket* socket, const std::string& response) { +void SendHttpResponse(InspectorSocket* socket, const char* response, + size_t size) { const char HEADERS[] = "HTTP/1.0 200 OK\r\n" "Content-Type: application/json; charset=UTF-8\r\n" "Cache-Control: no-cache\r\n" "Content-Length: %zu\r\n" "\r\n"; char header[sizeof(HEADERS) + 20]; - int header_len = snprintf(header, sizeof(header), HEADERS, response.size()); + int header_len = snprintf(header, sizeof(header), HEADERS, size); inspector_write(socket, header, header_len); - inspector_write(socket, response.data(), response.size()); + inspector_write(socket, response, size); +} + +void SendHttpResponse(InspectorSocket* socket, const std::string& response) { + SendHttpResponse(socket, response.data(), response.size()); } void SendVersionResponse(InspectorSocket* socket) { - std::map response; - response["Browser"] = "node.js/" NODE_VERSION; - response["Protocol-Version"] = "1.1"; - SendHttpResponse(socket, MapToString(response)); + static const char response[] = + "{\n" + " \"Browser\": \"node.js/" NODE_VERSION "\",\n" + " \"Protocol-Version\": \"1.1\"\n" + "}\n"; + SendHttpResponse(socket, response, sizeof(response) - 1); } std::string GetProcessTitle() { diff --git a/test/inspector/test-inspector.js b/test/inspector/test-inspector.js index ccc8b1a05853fa..46b3323b0784ba 100644 --- a/test/inspector/test-inspector.js +++ b/test/inspector/test-inspector.js @@ -17,6 +17,12 @@ function checkListResponse(err, response) { function checkVersion(err, response) { assert.ifError(err); assert.ok(response); + const expected = { + 'Browser': 'node.js/' + process.version, + 'Protocol-Version': '1.1', + }; + assert.strictEqual(JSON.stringify(response), + JSON.stringify(expected)); } function checkBadPath(err, response) { From 53964086904f2ae8c532d36b00d38ff411d1cad3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=90=E4=B8=B6=E8=A8=80?= Date: Fri, 25 Nov 2016 15:07:24 +0800 Subject: [PATCH 224/313] doc: fix crypto Verify cut-n-paste from Sign Verify documentation had cut-n-pasted documentation from Sign. PR-URL: https://github.com/nodejs/node/pull/9796 Reviewed-By: Anna Henningsen Reviewed-By: Evan Lucas Reviewed-By: Colin Ihrig Reviewed-By: Sam Roberts Reviewed-By: Michael Dawson Reviewed-By: Luigi Pinca Reviewed-By: Prince John Wesley --- doc/api/crypto.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 2eda378520f3b1..9d0164ff7b3604 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -925,8 +925,8 @@ of two ways: - Using the [`verify.update()`][] and [`verify.verify()`][] methods to verify the signature. - The [`crypto.createSign()`][] method is used to create `Sign` instances. - `Sign` objects are not to be created directly using the `new` keyword. +The [`crypto.createVerify()`][] method is used to create `Verify` instances. +`Verify` objects are not to be created directly using the `new` keyword. Example: Using `Verify` objects as streams: From e94b72e41e846206e6ff8a062eb9e967539f4c04 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Wed, 23 Nov 2016 22:25:57 -0800 Subject: [PATCH 225/313] tools: remove unneeded escaping in generate.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `-` does not need to be escaped in a regular expression outside of character classes. PR-URL: https://github.com/nodejs/node/pull/9781 Reviewed-By: Jeremiah Senkpiel Reviewed-By: Prince John Wesley Reviewed-By: Michaël Zasso --- tools/doc/generate.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/tools/doc/generate.js b/tools/doc/generate.js index 077e740432c837..31b23c52a08ba7 100644 --- a/tools/doc/generate.js +++ b/tools/doc/generate.js @@ -13,14 +13,14 @@ let inputFile = null; let nodeVersion = null; args.forEach(function(arg) { - if (!arg.match(/^\-\-/)) { + if (!arg.match(/^--/)) { inputFile = arg; - } else if (arg.match(/^\-\-format=/)) { - format = arg.replace(/^\-\-format=/, ''); - } else if (arg.match(/^\-\-template=/)) { - template = arg.replace(/^\-\-template=/, ''); - } else if (arg.match(/^\-\-node\-version=/)) { - nodeVersion = arg.replace(/^\-\-node\-version=/, ''); + } else if (arg.match(/^--format=/)) { + format = arg.replace(/^--format=/, ''); + } else if (arg.match(/^--template=/)) { + template = arg.replace(/^--template=/, ''); + } else if (arg.match(/^--node-version=/)) { + nodeVersion = arg.replace(/^--node-version=/, ''); } }); From c32c86b3c3d42bb07ae4613e6a1f0a5d6d96d05a Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 24 Nov 2016 11:43:35 -0800 Subject: [PATCH 226/313] benchmark: reformat code for clarity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some of the benchmark code can be a little dense. Not *very* hard to read but perhaps harder than it needs to be. These changes (many of them whitespace-only) hopefully improve readability. There are also a few cases of `assert.equal()` that are changed to `assert.strictEqual()`. PR-URL: https://github.com/nodejs/node/pull/9790 Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig --- benchmark/arrays/var-int.js | 18 ++++++++++--- benchmark/arrays/zero-float.js | 18 ++++++++++--- benchmark/arrays/zero-int.js | 18 ++++++++++--- benchmark/buffers/buffer-base64-decode.js | 2 +- benchmark/buffers/buffer-indexof.js | 24 ++++++++++++++---- benchmark/buffers/buffer-read.js | 24 +++++++++++++----- benchmark/buffers/buffer-write.js | 25 ++++++++++++++----- benchmark/buffers/dataview-set.js | 25 ++++++++++++++----- benchmark/es/map-bench.js | 8 +++--- .../http/http_server_for_chunky_client.js | 7 ++++-- benchmark/http_simple.js | 22 ++++++++++------ benchmark/misc/console.js | 12 ++++++--- benchmark/querystring/querystring-parse.js | 18 +++++++------ benchmark/tls/throughput.js | 10 +++++--- benchmark/tls/tls-connect.js | 19 ++++++++------ benchmark/util/format.js | 13 ++++++---- 16 files changed, 190 insertions(+), 73 deletions(-) diff --git a/benchmark/arrays/var-int.js b/benchmark/arrays/var-int.js index 74a73c9515fffa..36b0a908a59a4f 100644 --- a/benchmark/arrays/var-int.js +++ b/benchmark/arrays/var-int.js @@ -1,9 +1,21 @@ 'use strict'; var common = require('../common.js'); + +var types = [ + 'Array', + 'Buffer', + 'Int8Array', + 'Uint8Array', + 'Int16Array', + 'Uint16Array', + 'Int32Array', + 'Uint32Array', + 'Float32Array', + 'Float64Array' +]; + var bench = common.createBenchmark(main, { - type: ['Array', 'Buffer', 'Int8Array', 'Uint8Array', 'Int16Array', - 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', - 'Float64Array'], + type: types, n: [25] }); diff --git a/benchmark/arrays/zero-float.js b/benchmark/arrays/zero-float.js index e2569eed5c4e75..047e179234f33a 100644 --- a/benchmark/arrays/zero-float.js +++ b/benchmark/arrays/zero-float.js @@ -1,9 +1,21 @@ 'use strict'; var common = require('../common.js'); + +var types = [ + 'Array', + 'Buffer', + 'Int8Array', + 'Uint8Array', + 'Int16Array', + 'Uint16Array', + 'Int32Array', + 'Uint32Array', + 'Float32Array', + 'Float64Array' +]; + var bench = common.createBenchmark(main, { - type: ['Array', 'Buffer', 'Int8Array', 'Uint8Array', 'Int16Array', - 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', - 'Float64Array'], + type: types, n: [25] }); diff --git a/benchmark/arrays/zero-int.js b/benchmark/arrays/zero-int.js index 8be70c1e87113a..4e5c97e8af0b9c 100644 --- a/benchmark/arrays/zero-int.js +++ b/benchmark/arrays/zero-int.js @@ -1,9 +1,21 @@ 'use strict'; var common = require('../common.js'); + +var types = [ + 'Array', + 'Buffer', + 'Int8Array', + 'Uint8Array', + 'Int16Array', + 'Uint16Array', + 'Int32Array', + 'Uint32Array', + 'Float32Array', + 'Float64Array' +]; + var bench = common.createBenchmark(main, { - type: ['Array', 'Buffer', 'Int8Array', 'Uint8Array', 'Int16Array', - 'Uint16Array', 'Int32Array', 'Uint32Array', 'Float32Array', - 'Float64Array'], + type: types, n: [25] }); diff --git a/benchmark/buffers/buffer-base64-decode.js b/benchmark/buffers/buffer-base64-decode.js index 3497bfd05fd2a2..01f7f1bc91bc4a 100644 --- a/benchmark/buffers/buffer-base64-decode.js +++ b/benchmark/buffers/buffer-base64-decode.js @@ -7,7 +7,7 @@ const bench = common.createBenchmark(main, {}); function main(conf) { const s = 'abcd'.repeat(8 << 20); s.match(/./); // Flatten string. - assert.equal(s.length % 4, 0); + assert.strictEqual(s.length % 4, 0); const b = Buffer.allocUnsafe(s.length / 4 * 3); b.write(s, 0, s.length, 'base64'); bench.start(); diff --git a/benchmark/buffers/buffer-indexof.js b/benchmark/buffers/buffer-indexof.js index 380f40b23d8ab6..cae8b964aebbcf 100644 --- a/benchmark/buffers/buffer-indexof.js +++ b/benchmark/buffers/buffer-indexof.js @@ -3,12 +3,26 @@ var common = require('../common.js'); var fs = require('fs'); const path = require('path'); +const searchStrings = [ + '@', + 'SQ', + '10x', + '--l', + 'Alice', + 'Gryphon', + 'Panther', + 'Ou est ma chatte?', + 'found it very', + 'among mad people', + 'neighbouring pool', + 'Soo--oop', + 'aaaaaaaaaaaaaaaaa', + 'venture to go near the house till she had brought herself down to', + ' to the Caterpillar' +]; + var bench = common.createBenchmark(main, { - search: ['@', 'SQ', '10x', '--l', 'Alice', 'Gryphon', 'Panther', - 'Ou est ma chatte?', 'found it very', 'among mad people', - 'neighbouring pool', 'Soo--oop', 'aaaaaaaaaaaaaaaaa', - 'venture to go near the house till she had brought herself down to', - ' to the Caterpillar'], + search: searchStrings, encoding: ['undefined', 'utf8', 'ucs2', 'binary'], type: ['buffer', 'string'], iter: [1] diff --git a/benchmark/buffers/buffer-read.js b/benchmark/buffers/buffer-read.js index 1cdc4bc4697067..d23bd029f8bd44 100644 --- a/benchmark/buffers/buffer-read.js +++ b/benchmark/buffers/buffer-read.js @@ -1,15 +1,27 @@ 'use strict'; var common = require('../common.js'); +var types = [ + 'UInt8', + 'UInt16LE', + 'UInt16BE', + 'UInt32LE', + 'UInt32BE', + 'Int8', + 'Int16LE', + 'Int16BE', + 'Int32LE', + 'Int32BE', + 'FloatLE', + 'FloatBE', + 'DoubleLE', + 'DoubleBE' +]; + var bench = common.createBenchmark(main, { noAssert: ['false', 'true'], buffer: ['fast', 'slow'], - type: ['UInt8', 'UInt16LE', 'UInt16BE', - 'UInt32LE', 'UInt32BE', - 'Int8', 'Int16LE', 'Int16BE', - 'Int32LE', 'Int32BE', - 'FloatLE', 'FloatBE', - 'DoubleLE', 'DoubleBE'], + type: types, millions: [1] }); diff --git a/benchmark/buffers/buffer-write.js b/benchmark/buffers/buffer-write.js index ae78eaf91d0147..32c733045335cd 100644 --- a/benchmark/buffers/buffer-write.js +++ b/benchmark/buffers/buffer-write.js @@ -1,14 +1,27 @@ 'use strict'; var common = require('../common.js'); + +var types = [ + 'UInt8', + 'UInt16LE', + 'UInt16BE', + 'UInt32LE', + 'UInt32BE', + 'Int8', + 'Int16LE', + 'Int16BE', + 'Int32LE', + 'Int32BE', + 'FloatLE', + 'FloatBE', + 'DoubleLE', + 'DoubleBE' +]; + var bench = common.createBenchmark(main, { noAssert: ['false', 'true'], buffer: ['fast', 'slow'], - type: ['UInt8', 'UInt16LE', 'UInt16BE', - 'UInt32LE', 'UInt32BE', - 'Int8', 'Int16LE', 'Int16BE', - 'Int32LE', 'Int32BE', - 'FloatLE', 'FloatBE', - 'DoubleLE', 'DoubleBE'], + type: types, millions: [1] }); diff --git a/benchmark/buffers/dataview-set.js b/benchmark/buffers/dataview-set.js index a208effd82bf19..717a77de71d641 100644 --- a/benchmark/buffers/dataview-set.js +++ b/benchmark/buffers/dataview-set.js @@ -1,12 +1,25 @@ 'use strict'; var common = require('../common.js'); + +var types = [ + 'Uint8', + 'Uint16LE', + 'Uint16BE', + 'Uint32LE', + 'Uint32BE', + 'Int8', + 'Int16LE', + 'Int16BE', + 'Int32LE', + 'Int32BE', + 'Float32LE', + 'Float32BE', + 'Float64LE', + 'Float64BE' +]; + var bench = common.createBenchmark(main, { - type: ['Uint8', 'Uint16LE', 'Uint16BE', - 'Uint32LE', 'Uint32BE', - 'Int8', 'Int16LE', 'Int16BE', - 'Int32LE', 'Int32BE', - 'Float32LE', 'Float32BE', - 'Float64LE', 'Float64BE'], + type: types, millions: [1] }); diff --git a/benchmark/es/map-bench.js b/benchmark/es/map-bench.js index 574da25d53f2f2..047fc05abdc92f 100644 --- a/benchmark/es/map-bench.js +++ b/benchmark/es/map-bench.js @@ -15,7 +15,7 @@ function runObject(n) { for (; i < n; i++) { m['i' + i] = i; m['s' + i] = String(i); - assert.equal(m['i' + i], m['s' + i]); + assert.strictEqual(String(m['i' + i]), m['s' + i]); m['i' + i] = undefined; m['s' + i] = undefined; } @@ -29,7 +29,7 @@ function runNullProtoObject(n) { for (; i < n; i++) { m['i' + i] = i; m['s' + i] = String(i); - assert.equal(m['i' + i], m['s' + i]); + assert.strictEqual(String(m['i' + i]), m['s' + i]); m['i' + i] = undefined; m['s' + i] = undefined; } @@ -53,7 +53,7 @@ function runFakeMap(n) { for (; i < n; i++) { m.set('i' + i, i); m.set('s' + i, String(i)); - assert.equal(m.get('i' + i), m.get('s' + i)); + assert.strictEqual(String(m.get('i' + i)), m.get('s' + i)); m.set('i' + i, undefined); m.set('s' + i, undefined); } @@ -67,7 +67,7 @@ function runMap(n) { for (; i < n; i++) { m.set('i' + i, i); m.set('s' + i, String(i)); - assert.equal(m.get('i' + i), m.get('s' + i)); + assert.strictEqual(String(m.get('i' + i)), m.get('s' + i)); m.set('i' + i, undefined); m.set('s' + i, undefined); } diff --git a/benchmark/http/http_server_for_chunky_client.js b/benchmark/http/http_server_for_chunky_client.js index a0911b84ab811d..10a5b014f4211f 100644 --- a/benchmark/http/http_server_for_chunky_client.js +++ b/benchmark/http/http_server_for_chunky_client.js @@ -21,8 +21,11 @@ try { } catch (e) { /* ignore */ } server = http.createServer(function(req, res) { - res.writeHead(200, { 'content-type': 'text/plain', - 'content-length': '2' }); + var headers = { + 'content-type': 'text/plain', + 'content-length': '2' + }; + res.writeHead(200, headers); res.end('ok'); }); diff --git a/benchmark/http_simple.js b/benchmark/http_simple.js index 1c965b21c15ca0..644601864dd857 100644 --- a/benchmark/http_simple.js +++ b/benchmark/http_simple.js @@ -75,8 +75,11 @@ var server = module.exports = http.createServer(function(req, res) { body = fixed; } else if (command === 'echo') { - res.writeHead(200, { 'Content-Type': 'text/plain', - 'Transfer-Encoding': 'chunked' }); + const headers = { + 'Content-Type': 'text/plain', + 'Transfer-Encoding': 'chunked' + }; + res.writeHead(200, headers); req.pipe(res); return; @@ -88,8 +91,11 @@ var server = module.exports = http.createServer(function(req, res) { // example: http://localhost:port/bytes/512/4 // sends a 512 byte body in 4 chunks of 128 bytes if (n_chunks > 0) { - res.writeHead(status, { 'Content-Type': 'text/plain', - 'Transfer-Encoding': 'chunked' }); + const headers = { + 'Content-Type': 'text/plain', + 'Transfer-Encoding': 'chunked' + }; + res.writeHead(status, headers); // send body in chunks var len = body.length; var step = Math.floor(len / n_chunks) || 1; @@ -99,10 +105,12 @@ var server = module.exports = http.createServer(function(req, res) { } res.end(body.slice((n_chunks - 1) * step)); } else { - var content_length = body.length.toString(); + const headers = { + 'Content-Type': 'text/plain', + 'Content-Length': body.length.toString() + }; - res.writeHead(status, { 'Content-Type': 'text/plain', - 'Content-Length': content_length }); + res.writeHead(status, headers); res.end(body); } }); diff --git a/benchmark/misc/console.js b/benchmark/misc/console.js index 17f7ed0f4d96b0..9a08a411c51f82 100644 --- a/benchmark/misc/console.js +++ b/benchmark/misc/console.js @@ -8,11 +8,15 @@ const v8 = require('v8'); v8.setFlagsFromString('--allow_natives_syntax'); +const methods = [ + 'restAndSpread', + 'argumentsAndApply', + 'restAndApply', + 'restAndConcat' +]; + var bench = common.createBenchmark(main, { - method: ['restAndSpread', - 'argumentsAndApply', - 'restAndApply', - 'restAndConcat'], + method: methods, concat: [1, 0], n: [1000000] }); diff --git a/benchmark/querystring/querystring-parse.js b/benchmark/querystring/querystring-parse.js index 590b89f307c697..d78ef99f84f3d4 100644 --- a/benchmark/querystring/querystring-parse.js +++ b/benchmark/querystring/querystring-parse.js @@ -3,14 +3,18 @@ var common = require('../common.js'); var querystring = require('querystring'); var v8 = require('v8'); +var types = [ + 'noencode', + 'multicharsep', + 'encodemany', + 'encodelast', + 'multivalue', + 'multivaluemany', + 'manypairs' +]; + var bench = common.createBenchmark(main, { - type: ['noencode', - 'multicharsep', - 'encodemany', - 'encodelast', - 'multivalue', - 'multivaluemany', - 'manypairs'], + type: types, n: [1e6], }); diff --git a/benchmark/tls/throughput.js b/benchmark/tls/throughput.js index d0de99e7b54b85..d3b7d0c02237a2 100644 --- a/benchmark/tls/throughput.js +++ b/benchmark/tls/throughput.js @@ -37,10 +37,12 @@ function main(conf) { throw new Error('invalid type'); } - options = { key: fs.readFileSync(cert_dir + '/test_key.pem'), - cert: fs.readFileSync(cert_dir + '/test_cert.pem'), - ca: [ fs.readFileSync(cert_dir + '/test_ca.pem') ], - ciphers: 'AES256-GCM-SHA384' }; + options = { + key: fs.readFileSync(cert_dir + '/test_key.pem'), + cert: fs.readFileSync(cert_dir + '/test_cert.pem'), + ca: [ fs.readFileSync(cert_dir + '/test_ca.pem') ], + ciphers: 'AES256-GCM-SHA384' + }; server = tls.createServer(options, onConnection); setTimeout(done, dur * 1000); diff --git a/benchmark/tls/tls-connect.js b/benchmark/tls/tls-connect.js index a265989e04db24..a271c724f56ed2 100644 --- a/benchmark/tls/tls-connect.js +++ b/benchmark/tls/tls-connect.js @@ -20,11 +20,13 @@ function main(conf) { dur = +conf.dur; concurrency = +conf.concurrency; - var cert_dir = path.resolve(__dirname, '../../test/fixtures'), - options = { key: fs.readFileSync(cert_dir + '/test_key.pem'), - cert: fs.readFileSync(cert_dir + '/test_cert.pem'), - ca: [ fs.readFileSync(cert_dir + '/test_ca.pem') ], - ciphers: 'AES256-GCM-SHA384' }; + var cert_dir = path.resolve(__dirname, '../../test/fixtures'); + var options = { + key: fs.readFileSync(cert_dir + '/test_key.pem'), + cert: fs.readFileSync(cert_dir + '/test_cert.pem'), + ca: [ fs.readFileSync(cert_dir + '/test_ca.pem') ], + ciphers: 'AES256-GCM-SHA384' + }; server = tls.createServer(options, onConnection); server.listen(common.PORT, onListening); @@ -42,8 +44,11 @@ function onConnection(conn) { } function makeConnection() { - var conn = tls.connect({ port: common.PORT, - rejectUnauthorized: false }, function() { + var options = { + port: common.PORT, + rejectUnauthorized: false + }; + var conn = tls.connect(options, function() { clientConn++; conn.on('error', function(er) { console.error('client error', er); diff --git a/benchmark/util/format.js b/benchmark/util/format.js index 05176aa24fb01f..8040554ba0861a 100644 --- a/benchmark/util/format.js +++ b/benchmark/util/format.js @@ -3,13 +3,16 @@ const util = require('util'); const common = require('../common'); const v8 = require('v8'); +const types = [ + 'string', + 'number', + 'object', + 'unknown', + 'no-replace' +]; const bench = common.createBenchmark(main, { n: [1e6], - type: ['string', - 'number', - 'object', - 'unknown', - 'no-replace'] + type: types }); const inputs = { From 166eea75340d78d2eda18a45747c51be97ddf14a Mon Sep 17 00:00:00 2001 From: Bryan English Date: Fri, 28 Oct 2016 16:42:38 -0700 Subject: [PATCH 227/313] constants: errors -> errno lib/constants.js was incorrectly copying the constants from the binding, by copying from `contants.os.errors` instead of `constants.os.errno`. PR-URL: https://github.com/nodejs/node/pull/9349 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Prince John Wesley Reviewed-By: Ron Korving Reviewed-By: Luigi Pinca --- lib/constants.js | 2 +- test/parallel/test-constants.js | 28 +++++++++++++++++++++------- 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/lib/constants.js b/lib/constants.js index deebf90513da46..fec7e13d94145a 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -5,7 +5,7 @@ // are most relevant. const constants = process.binding('constants'); Object.assign(exports, - constants.os.errors, + constants.os.errno, constants.os.signals, constants.fs, constants.crypto); diff --git a/test/parallel/test-constants.js b/test/parallel/test-constants.js index ea0b93ba7fab6a..c11935783f861d 100644 --- a/test/parallel/test-constants.js +++ b/test/parallel/test-constants.js @@ -1,12 +1,26 @@ 'use strict'; require('../common'); -const constants = process.binding('constants'); +const binding = process.binding('constants'); +const constants = require('constants'); const assert = require('assert'); -assert.ok(constants); -assert.ok(constants.os); -assert.ok(constants.os.signals); -assert.ok(constants.os.errno); -assert.ok(constants.fs); -assert.ok(constants.crypto); +assert.ok(binding); +assert.ok(binding.os); +assert.ok(binding.os.signals); +assert.ok(binding.os.errno); +assert.ok(binding.fs); +assert.ok(binding.crypto); + +['os', 'fs', 'crypto'].forEach((l) => { + Object.keys(binding[l]).forEach((k) => { + if (typeof binding[l][k] === 'object') { // errno and signals + Object.keys(binding[l][k]).forEach((j) => { + assert.strictEqual(binding[l][k][j], constants[j]); + }); + } + if (l !== 'os') { // top level os constant isn't currently copied + assert.strictEqual(binding[l][k], constants[k]); + } + }); +}); From ba077a424bf6ea443f5608d7165dc84cce90c98c Mon Sep 17 00:00:00 2001 From: Sam Roberts Date: Tue, 15 Nov 2016 10:31:27 -0800 Subject: [PATCH 228/313] doc: improve description of module `exports` - Do not use word alias, it isn't well defined - Fix return value of require() example, which confusingly was not the exported API as it should have been. - Fix the require() example, which claimed that the module exported `0`, when it exports `some_func`. - Describe best practice in keeping exports and module.exports bound together. - Describe why exports exists - Remove reference to magic, which is also not well defined PR-URL: https://github.com/nodejs/node/pull/9622 Reviewed-By: Luigi Pinca Reviewed-By: Stephen Belanger Reviewed-By: James M Snell --- doc/api/modules.md | 45 +++++++++++++++++++++++++++++++-------------- 1 file changed, 31 insertions(+), 14 deletions(-) diff --git a/doc/api/modules.md b/doc/api/modules.md index e496dbe1ac52e2..cca84e0078c4fd 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -529,34 +529,51 @@ const x = require('./x'); console.log(x.a); ``` -#### exports alias +#### exports shortcut -The `exports` variable that is available within a module starts as a reference -to `module.exports`. As with any variable, if you assign a new value to it, it -is no longer bound to the previous value. +The `exports` variable is available within a module's file-level scope, and is +assigned the value of `module.exports` before the module is evaluated. + +It allows a shortcut, so that `module.exports.f = ...` can be written more +succinctly as `exports.f = ...`. However, be aware that like any variable, if a +new value is assigned to `exports`, it is no longer bound to `module.exports`: + +```js +module.exports.hello = true; // Exported from require of module +exports = { hello: false }; // Not exported, only available in the module +``` + +When the `module.exports` property is being completely replaced by a new +object, it is common to also reassign `exports`, for example: + +```js +module.exports = exports = function Constructor() { + // ... etc. +``` To illustrate the behavior, imagine this hypothetical implementation of -`require()`: +`require()`, which is quite similar to what is actually done by `require()`: ```js function require(...) { - // ... + var module = { exports: {} }; ((module, exports) => { - // Your module code here - exports = some_func; // re-assigns exports, exports is no longer - // a shortcut, and nothing is exported. - module.exports = some_func; // makes your module export 0 + // Your module code here. In this example, define a function. + function some_func() {}; + exports = some_func; + // At this point, exports is no longer a shortcut to module.exports, and + // this module will still export an empty default object. + module.exports = some_func; + // At this point, the module will now export some_func, instead of the + // default object. })(module, module.exports); - return module; + return module.exports; } ``` -As a guideline, if the relationship between `exports` and `module.exports` -seems like magic to you, ignore `exports` and only use `module.exports`. - ### module.filename -Node.js includes a full-featured out-of-process debugging utility accessible -via a simple [TCP-based protocol][] and built-in debugging client. To use it, -start Node.js with the `debug` argument followed by the path to the script to -debug; a prompt will be displayed indicating successful launch of the debugger: +Node.js includes an out-of-process debugging utility accessible via a +[TCP-based protocol][] and built-in debugging client. To use it, start Node.js +with the `debug` argument followed by the path to the script to debug; a prompt +will be displayed indicating successful launch of the debugger: ```txt $ node debug myscript.js From d068fe5ab6a99cb80f6e03ddfe57301a9a2e9f3b Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Tue, 29 Nov 2016 14:04:20 -0600 Subject: [PATCH 234/313] doc: update Collaborators list in README The Collaborators list in the README has a couple entries of people that have left the Collaborators team in GitHub. This updates the list in the README accordingly. PR-URL: https://github.com/nodejs/node/pull/9846 Reviewed-By: Gibson Fahnestock Reviewed-By: Roman Reiss Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 61aaa710835fee..68ffbb90598d0f 100644 --- a/README.md +++ b/README.md @@ -217,8 +217,6 @@ more information about the governance of the Node.js project, see **Claudio Rodriguez** <cjrodr@yahoo.com> * [danbev](https://github.com/danbev) - **Daniel Bevenius** <daniel.bevenius@gmail.com> -* [domenic](https://github.com/domenic) - -**Domenic Denicola** <d@domenic.me> * [eljefedelrodeodeljefe](https://github.com/eljefedelrodeodeljefe) - **Robert Jefe Lindstaedt** <robert.lindstaedt@gmail.com> * [estliberitas](https://github.com/estliberitas) - @@ -337,8 +335,6 @@ more information about the governance of the Node.js project, see **Yorkie Liu** <yorkiefixer@gmail.com> * [yosuke-furukawa](https://github.com/yosuke-furukawa) - **Yosuke Furukawa** <yosuke.furukawa@gmail.com> -* [zkat](https://github.com/zkat) - -**Kat Marchán** <kzm@sykosomatic.org> Collaborators (which includes CTC members) follow the [COLLABORATOR_GUIDE.md](./COLLABORATOR_GUIDE.md) in maintaining the Node.js From 99ed5ed5f4e9b10a55831fa26c707d321615b9db Mon Sep 17 00:00:00 2001 From: Devon Rifkin Date: Fri, 2 Dec 2016 11:03:43 -0600 Subject: [PATCH 235/313] =?UTF-8?q?doc:=20it=E2=80=99s=20->=20its=20in=20a?= =?UTF-8?q?pi/child=5Fprocess.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/10090 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen --- doc/api/child_process.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 858e87f9805bac..7885677effa6b1 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -278,7 +278,7 @@ allows messages to be passed back and forth between the parent and child. See It is important to keep in mind that spawned Node.js child processes are independent of the parent with exception of the IPC communication channel -that is established between the two. Each process has it's own memory, with +that is established between the two. Each process has its own memory, with their own V8 instances. Because of the additional resource allocations required, spawning a large number of child Node.js processes is not recommended. From 6632b3d1abf43d0824b20d3ff53cd7b13a87ea9d Mon Sep 17 00:00:00 2001 From: Walter Beller-Morales Date: Tue, 29 Nov 2016 17:58:05 -0600 Subject: [PATCH 236/313] lib: use === in _http_server and _tls_wrap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Minor fix to favor strict equality in http_server.js and tls_wrap.js to ensure accurate comparisons without type coercion. PR-URL: https://github.com/nodejs/node/pull/9849 Reviewed-By: Rich Trott Reviewed-By: Michael Dawson Reviewed-By: Colin Ihrig Reviewed-By: Michaël Zasso Reviewed-By: Luigi Pinca --- lib/_http_server.js | 2 +- lib/_tls_wrap.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/_http_server.js b/lib/_http_server.js index 731c95bb44a5fd..fc88e8938c7f40 100644 --- a/lib/_http_server.js +++ b/lib/_http_server.js @@ -524,7 +524,7 @@ function connectionListener(socket) { } if (req.headers.expect !== undefined && - (req.httpVersionMajor == 1 && req.httpVersionMinor == 1)) { + (req.httpVersionMajor === 1 && req.httpVersionMinor === 1)) { if (continueExpression.test(req.headers.expect)) { res._expect_continue = true; diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index a1e00fd3e0fe52..e01c143ae16bc0 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -545,7 +545,7 @@ TLSSocket.prototype.renegotiate = function(options, callback) { }; TLSSocket.prototype.setMaxSendFragment = function setMaxSendFragment(size) { - return this._handle.setMaxSendFragment(size) == 1; + return this._handle.setMaxSendFragment(size) === 1; }; TLSSocket.prototype.getTLSTicket = function getTLSTicket() { From afbd8df7fd6b7dcac2d051ffdbdc97bf2e76bebb Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Wed, 30 Nov 2016 22:04:28 -0600 Subject: [PATCH 237/313] test: increase coverage for lib/events.js Adds tests for the case in which listeners() is invoked on a EventEmitter with no events. Adds a new test case for the situation in which a class inherits from the EventEmitter but overrides the constructor in the EventEmitter so that the _events is never set. PR-URL: https://github.com/nodejs/node/pull/9865 Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen Reviewed-By: Myles Borins --- test/parallel/test-event-emitter-listeners.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/parallel/test-event-emitter-listeners.js b/test/parallel/test-event-emitter-listeners.js index dfd66287b194a7..11c1ed49824cd2 100644 --- a/test/parallel/test-event-emitter-listeners.js +++ b/test/parallel/test-event-emitter-listeners.js @@ -3,9 +3,12 @@ require('../common'); const assert = require('assert'); const events = require('events'); +const util = require('util'); function listener() {} function listener2() {} +class TestStream { constructor() { } } +util.inherits(TestStream, events.EventEmitter); { const ee = new events.EventEmitter(); @@ -36,3 +39,14 @@ function listener2() {} assert.deepStrictEqual(ee.listeners('foo'), [listener, listener2]); assert.deepStrictEqual(eeListenersCopy, [listener]); } + +{ + const ee = new events.EventEmitter(); + ee._events = undefined; + assert.deepStrictEqual(ee.listeners('foo'), []); +} + +{ + const s = new TestStream(); + assert.deepStrictEqual(s.listeners('foo'), []); +} From 0e46f7e7451f0114ce0c55e958bb2deddf6936ef Mon Sep 17 00:00:00 2001 From: Safia Abdalla Date: Wed, 30 Nov 2016 22:54:38 -0600 Subject: [PATCH 238/313] doc: rename writing_tests.md to writing-tests.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The writing_tests.md file did not utilize kebab-case as the other files in the directory did. PR-URL: https://github.com/nodejs/node/pull/9867 Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: Jeremiah Senkpiel Reviewed-By: Michaël Zasso --- CONTRIBUTING.md | 2 +- doc/guides/{writing_tests.md => writing-tests.md} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename doc/guides/{writing_tests.md => writing-tests.md} (100%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 17aa305f8c7fe4..6f44949a31e0ca 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -150,7 +150,7 @@ $ git rebase upstream/master Bug fixes and features **should come with tests**. Add your tests in the `test/parallel/` directory. For guidance on how to write a test for the Node.js -project, see this [guide](./doc/guides/writing_tests.md). Looking at other tests +project, see this [guide](./doc/guides/writing-tests.md). Looking at other tests to see how they should be structured can also help. To run the tests on Unix / OS X: diff --git a/doc/guides/writing_tests.md b/doc/guides/writing-tests.md similarity index 100% rename from doc/guides/writing_tests.md rename to doc/guides/writing-tests.md From fc6c666d4999bc9900354f3a3e626f6dd41b0f8a Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Fri, 2 Dec 2016 20:03:12 +0200 Subject: [PATCH 239/313] doc: var => const in js code examples of addons.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/10092 Reviewed-By: Gibson Fahnestock Reviewed-By: Roman Reiss Reviewed-By: Michaël Zasso --- doc/api/addons.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/doc/api/addons.md b/doc/api/addons.md index d91f60ae7bf6ef..44dc69915c428f 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -423,8 +423,8 @@ To test it in JavaScript: // test.js const addon = require('./build/Release/addon'); -var obj1 = addon('hello'); -var obj2 = addon('world'); +const obj1 = addon('hello'); +const obj2 = addon('world'); console.log(obj1.msg, obj2.msg); // Prints: 'hello world' ``` @@ -482,7 +482,7 @@ To test: // test.js const addon = require('./build/Release/addon'); -var fn = addon(); +const fn = addon(); console.log(fn()); // Prints: 'hello world' ``` @@ -645,7 +645,7 @@ Test it with: // test.js const addon = require('./build/Release/addon'); -var obj = new addon.MyObject(10); +const obj = new addon.MyObject(10); console.log(obj.plusOne()); // Prints: 11 console.log(obj.plusOne()); @@ -660,9 +660,9 @@ Alternatively, it is possible to use a factory pattern to avoid explicitly creating object instances using the JavaScript `new` operator: ```js -var obj = addon.createObject(); +const obj = addon.createObject(); // instead of: -// var obj = new addon.Object(); +// const obj = new addon.Object(); ``` First, the `createObject()` method is implemented in `addon.cc`: @@ -840,7 +840,7 @@ Test it with: // test.js const createObject = require('./build/Release/addon'); -var obj = createObject(10); +const obj = createObject(10); console.log(obj.plusOne()); // Prints: 11 console.log(obj.plusOne()); @@ -848,7 +848,7 @@ console.log(obj.plusOne()); console.log(obj.plusOne()); // Prints: 13 -var obj2 = createObject(20); +const obj2 = createObject(20); console.log(obj2.plusOne()); // Prints: 21 console.log(obj2.plusOne()); @@ -1022,9 +1022,9 @@ Test it with: // test.js const addon = require('./build/Release/addon'); -var obj1 = addon.createObject(10); -var obj2 = addon.createObject(20); -var result = addon.add(obj1, obj2); +const obj1 = addon.createObject(10); +const obj2 = addon.createObject(20); +const result = addon.add(obj1, obj2); console.log(result); // Prints: 30 From 36b45c11128b40c76fedb2b18c0ae1a4591dfbbb Mon Sep 17 00:00:00 2001 From: Wes Tyler Date: Thu, 1 Dec 2016 15:03:55 -0600 Subject: [PATCH 240/313] doc: clarify fs.createReadStream options * start/end start *counting* at 0 * If fd is specified and start is omitted or undefined, fs.createReadStream() reads sequentially from the current file position. Fixes: https://github.com/nodejs/node/issues/7099 PR-URL: https://github.com/nodejs/node/pull/10078 Reviewed-By: Ben Noordhuis Reviewed-By: Gibson Fahnestock Reviewed-By: Anna Henningsen Reviewed-By: Roman Reiss --- doc/api/fs.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 20bc2d9c8df612..af7428b34293d0 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -602,7 +602,9 @@ default value of 64 kb for the same parameter. `options` can include `start` and `end` values to read a range of bytes from the file instead of the entire file. Both `start` and `end` are inclusive and -start at 0. The `encoding` can be any one of those accepted by [`Buffer`][]. +start counting at 0. If `fd` is specified and `start` is omitted or `undefined`, +`fs.createReadStream()` reads sequentially from the current file position. +The `encoding` can be any one of those accepted by [`Buffer`][]. If `fd` is specified, `ReadStream` will ignore the `path` argument and will use the specified file descriptor. This means that no `'open'` event will be From adb30676b23be5c6f51c3694a443fd74cc9acf7d Mon Sep 17 00:00:00 2001 From: Teddy Katz Date: Thu, 1 Dec 2016 12:21:19 -0500 Subject: [PATCH 241/313] doc: suggest Buffer.alloc instead of Buffer#fill MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now that `Buffer.alloc` exists, there is no reason to recommend using `new Buffer(size).fill(0)` or `Buffer.allocUnsafe(size).fill(0)`. PR-URL: https://github.com/nodejs/node/pull/10000 Reviewed-By: Rich Trott Reviewed-By: James M Snell Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig --- doc/api/buffer.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index b2d9d4b2e4f733..9bc6cfdc8a2b4d 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -398,8 +398,8 @@ A zero-length `Buffer` will be created if `size <= 0`. Unlike [`ArrayBuffers`][`ArrayBuffer`], the underlying memory for `Buffer` instances created in this way is *not initialized*. The contents of a newly created `Buffer` -are unknown and *could contain sensitive data*. Use [`buf.fill(0)`][`buf.fill()`] -to initialize a `Buffer` to zeroes. +are unknown and *could contain sensitive data*. Use +[`Buffer.alloc(size)`][`Buffer.alloc()`] instead to initialize a `Buffer` to zeroes. Example: @@ -517,7 +517,7 @@ be less than or equal to the value of [`buffer.kMaxLength`]. Otherwise, a The underlying memory for `Buffer` instances created in this way is *not initialized*. The contents of the newly created `Buffer` are unknown and -*may contain sensitive data*. Use [`buf.fill(0)`][`buf.fill()`] to initialize such +*may contain sensitive data*. Use [`Buffer.alloc()`] instead to initialize `Buffer` instances to zeroes. Example: From b167727dccbd33144883c34df88c877252659278 Mon Sep 17 00:00:00 2001 From: iamchenxin Date: Fri, 2 Dec 2016 00:14:26 -0700 Subject: [PATCH 242/313] doc: fix typo for `decipher.final`. The `output_encoding` parameter should be as the same as `decipher.update`. PR-URL: https://github.com/nodejs/node/pull/10086 Reviewed-By: Anna Henningsen --- doc/api/crypto.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/crypto.md b/doc/api/crypto.md index 9d0164ff7b3604..4471a1e46bc38a 100644 --- a/doc/api/crypto.md +++ b/doc/api/crypto.md @@ -313,7 +313,7 @@ added: v0.1.94 --> Returns any remaining deciphered contents. If `output_encoding` -parameter is one of `'latin1'`, `'base64'` or `'hex'`, a string is returned. +parameter is one of `'latin1'`, `'ascii'` or `'utf8'`, a string is returned. If an `output_encoding` is not provided, a [`Buffer`][] is returned. Once the `decipher.final()` method has been called, the `Decipher` object can From 13b16881ef55b1c9feb92331d3f8e9f2d04da217 Mon Sep 17 00:00:00 2001 From: joyeecheung Date: Thu, 1 Dec 2016 19:11:43 -0600 Subject: [PATCH 243/313] test,url: improve escaping in url.parse - rename variables in autoEscapeStr so they are easier to understand - comment the escaping algorithm - increase coverage for autoEscapeStr PR-URL: https://github.com/nodejs/node/pull/10083 Reviewed-By: Anna Henningsen --- lib/url.js | 136 ++++++++++++++++++++------------------ test/parallel/test-url.js | 14 ++++ 2 files changed, 85 insertions(+), 65 deletions(-) diff --git a/lib/url.js b/lib/url.js index d620b9bc71b655..106fb47f88a3dd 100644 --- a/lib/url.js +++ b/lib/url.js @@ -433,105 +433,111 @@ function validateHostname(self, rest, hostname) { } } +// Automatically escape all delimiters and unwise characters from RFC 2396. +// Also escape single quotes in case of an XSS attack. +// Return undefined if the string doesn't need escaping, +// otherwise return the escaped string. function autoEscapeStr(rest) { - var newRest = ''; - var lastPos = 0; + var escaped = ''; + var lastEscapedPos = 0; for (var i = 0; i < rest.length; ++i) { - // Automatically escape all delimiters and unwise characters from RFC 2396 - // Also escape single quotes in case of an XSS attack + // Manual switching is faster than using a Map/Object. + // `escaped` contains substring up to the last escaped cahracter. switch (rest.charCodeAt(i)) { case 9: // '\t' - if (i - lastPos > 0) - newRest += rest.slice(lastPos, i); - newRest += '%09'; - lastPos = i + 1; + // Concat if there are ordinary characters in the middle. + if (i > lastEscapedPos) + escaped += rest.slice(lastEscapedPos, i); + escaped += '%09'; + lastEscapedPos = i + 1; break; case 10: // '\n' - if (i - lastPos > 0) - newRest += rest.slice(lastPos, i); - newRest += '%0A'; - lastPos = i + 1; + if (i > lastEscapedPos) + escaped += rest.slice(lastEscapedPos, i); + escaped += '%0A'; + lastEscapedPos = i + 1; break; case 13: // '\r' - if (i - lastPos > 0) - newRest += rest.slice(lastPos, i); - newRest += '%0D'; - lastPos = i + 1; + if (i > lastEscapedPos) + escaped += rest.slice(lastEscapedPos, i); + escaped += '%0D'; + lastEscapedPos = i + 1; break; case 32: // ' ' - if (i - lastPos > 0) - newRest += rest.slice(lastPos, i); - newRest += '%20'; - lastPos = i + 1; + if (i > lastEscapedPos) + escaped += rest.slice(lastEscapedPos, i); + escaped += '%20'; + lastEscapedPos = i + 1; break; case 34: // '"' - if (i - lastPos > 0) - newRest += rest.slice(lastPos, i); - newRest += '%22'; - lastPos = i + 1; + if (i > lastEscapedPos) + escaped += rest.slice(lastEscapedPos, i); + escaped += '%22'; + lastEscapedPos = i + 1; break; case 39: // '\'' - if (i - lastPos > 0) - newRest += rest.slice(lastPos, i); - newRest += '%27'; - lastPos = i + 1; + if (i > lastEscapedPos) + escaped += rest.slice(lastEscapedPos, i); + escaped += '%27'; + lastEscapedPos = i + 1; break; case 60: // '<' - if (i - lastPos > 0) - newRest += rest.slice(lastPos, i); - newRest += '%3C'; - lastPos = i + 1; + if (i > lastEscapedPos) + escaped += rest.slice(lastEscapedPos, i); + escaped += '%3C'; + lastEscapedPos = i + 1; break; case 62: // '>' - if (i - lastPos > 0) - newRest += rest.slice(lastPos, i); - newRest += '%3E'; - lastPos = i + 1; + if (i > lastEscapedPos) + escaped += rest.slice(lastEscapedPos, i); + escaped += '%3E'; + lastEscapedPos = i + 1; break; case 92: // '\\' - if (i - lastPos > 0) - newRest += rest.slice(lastPos, i); - newRest += '%5C'; - lastPos = i + 1; + if (i > lastEscapedPos) + escaped += rest.slice(lastEscapedPos, i); + escaped += '%5C'; + lastEscapedPos = i + 1; break; case 94: // '^' - if (i - lastPos > 0) - newRest += rest.slice(lastPos, i); - newRest += '%5E'; - lastPos = i + 1; + if (i > lastEscapedPos) + escaped += rest.slice(lastEscapedPos, i); + escaped += '%5E'; + lastEscapedPos = i + 1; break; case 96: // '`' - if (i - lastPos > 0) - newRest += rest.slice(lastPos, i); - newRest += '%60'; - lastPos = i + 1; + if (i > lastEscapedPos) + escaped += rest.slice(lastEscapedPos, i); + escaped += '%60'; + lastEscapedPos = i + 1; break; case 123: // '{' - if (i - lastPos > 0) - newRest += rest.slice(lastPos, i); - newRest += '%7B'; - lastPos = i + 1; + if (i > lastEscapedPos) + escaped += rest.slice(lastEscapedPos, i); + escaped += '%7B'; + lastEscapedPos = i + 1; break; case 124: // '|' - if (i - lastPos > 0) - newRest += rest.slice(lastPos, i); - newRest += '%7C'; - lastPos = i + 1; + if (i > lastEscapedPos) + escaped += rest.slice(lastEscapedPos, i); + escaped += '%7C'; + lastEscapedPos = i + 1; break; case 125: // '}' - if (i - lastPos > 0) - newRest += rest.slice(lastPos, i); - newRest += '%7D'; - lastPos = i + 1; + if (i > lastEscapedPos) + escaped += rest.slice(lastEscapedPos, i); + escaped += '%7D'; + lastEscapedPos = i + 1; break; } } - if (lastPos === 0) + if (lastEscapedPos === 0) // Nothing has been escaped. return; - if (lastPos < rest.length) - return newRest + rest.slice(lastPos); - else - return newRest; + // There are ordinary characters at the end. + if (lastEscapedPos < rest.length) + return escaped + rest.slice(lastEscapedPos); + else // The last character is escaped. + return escaped; } // format a parsed object into a url string diff --git a/test/parallel/test-url.js b/test/parallel/test-url.js index bf5bd25e27a03f..fec2233dc0fac9 100644 --- a/test/parallel/test-url.js +++ b/test/parallel/test-url.js @@ -833,6 +833,20 @@ var parseTests = { query: '@c' }, + 'http://a.b/\tbc\ndr\ref g"hq\'j?mn\\op^q=r`99{st|uv}wz': { + protocol: 'http:', + slashes: true, + host: 'a.b', + port: null, + hostname: 'a.b', + hash: null, + pathname: '/%09bc%0Adr%0Def%20g%22hq%27j%3Ckl%3E', + path: '/%09bc%0Adr%0Def%20g%22hq%27j%3Ckl%3E?mn%5Cop%5Eq=r%6099%7Bst%7Cuv%7Dwz', + search: '?mn%5Cop%5Eq=r%6099%7Bst%7Cuv%7Dwz', + query: 'mn%5Cop%5Eq=r%6099%7Bst%7Cuv%7Dwz', + href: 'http://a.b/%09bc%0Adr%0Def%20g%22hq%27j%3Ckl%3E?mn%5Cop%5Eq=r%6099%7Bst%7Cuv%7Dwz' + }, + 'http://a\r" \t\n<\'b:b@c\r\nd/e?f': { protocol: 'http:', slashes: true, From 0be56cd1e9f8383f165036f0caac1363350ad522 Mon Sep 17 00:00:00 2001 From: Claudio Rodriguez Date: Mon, 8 Aug 2016 17:55:16 +0100 Subject: [PATCH 244/313] meta: whitelist dotfiles in .gitignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead of excluding IDE-specific dotfiles, exclude all and then whitelist those the project needs to track. Refs: https://github.com/nodejs/node/pull/8010 Refs: https://github.com/nodejs/node/pull/9111 Refs: https://github.com/nodejs/node/pull/10052 Fixes: https://github.com/nodejs/node/issues/8012 PR-URL: https://github.com/nodejs/node/pull/8016 Reviewed-By: James M Snell Reviewed-By: Franziska Hinkelmann Reviewed-By: Jeremiah Senkpiel Reviewed-By: Michaël Zasso Reviewed-By: Roman Reiss Reviewed-By: Josh Gavant --- .gitignore | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index b6790e116cd6b5..4f129c4581ba8f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,19 @@ +# Whitelist dotfiles +.* +!deps/**/.* +!test/fixtures/**/.* +!tools/eslint/**/.* +!tools/doc/node_modules/**/.* +!.editorconfig +!.eslintignore +!.eslintrc +!.gitattributes +!.github +!.gitignore +!.gitkeep +!.mailmap +!.remarkrc + core vgcore.* v8*.log @@ -16,8 +32,6 @@ node node_g *.swp .benchmark_reports -/.project -/.cproject icu_config.gypi .eslintcache From b77d3d86f7186c7ab282edabd2b4a83e2556fbf0 Mon Sep 17 00:00:00 2001 From: Devon Rifkin Date: Sat, 3 Dec 2016 22:43:44 -0800 Subject: [PATCH 245/313] doc: add link to `net.Server` in tls.md PR-URL: https://github.com/nodejs/node/pull/10109 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Roman Reiss --- doc/api/tls.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/tls.md b/doc/api/tls.md index 9ef2c90ad40939..488337a0764e4c 100644 --- a/doc/api/tls.md +++ b/doc/api/tls.md @@ -402,7 +402,7 @@ connections on the specified `port` and `hostname`. This function operates asynchronously. If the `callback` is given, it will be called when the server has started listening. -See `net.Server` for more information. +See [`net.Server`][] for more information. ### server.setTicketKeys(keys) Updates the cipher with `data`. If the `input_encoding` argument is given, -it's value must be one of `'utf8'`, `'ascii'`, or `'latin1'` and the `data` +its value must be one of `'utf8'`, `'ascii'`, or `'latin1'` and the `data` argument is a string using the specified encoding. If the `input_encoding` argument is not given, `data` must be a [`Buffer`][]. If `data` is a [`Buffer`][] then `input_encoding` is ignored. @@ -361,7 +361,7 @@ added: v0.1.94 --> Updates the decipher with `data`. If the `input_encoding` argument is given, -it's value must be one of `'latin1'`, `'base64'`, or `'hex'` and the `data` +its value must be one of `'latin1'`, `'base64'`, or `'hex'` and the `data` argument is a string using the specified encoding. If the `input_encoding` argument is not given, `data` must be a [`Buffer`][]. If `data` is a [`Buffer`][] then `input_encoding` is ignored. diff --git a/doc/api/process.md b/doc/api/process.md index 53218e89a2cafe..e47a95a2226b9f 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -878,7 +878,7 @@ pending* that have not yet completed fully, *including* I/O operations to `process.stdout` and `process.stderr`. In most situations, it is not actually necessary to call `process.exit()` -explicitly. The Node.js process will exit on it's own *if there is no additional +explicitly. The Node.js process will exit on its own *if there is no additional work pending* in the event loop. The `process.exitCode` property can be set to tell the process which exit code to use when the process exits gracefully. @@ -1119,7 +1119,7 @@ added: v0.1.17 The `process.mainModule` property provides an alternative way of retrieving [`require.main`][]. The difference is that if the main module changes at runtime, [`require.main`][] may still refer to the original main module in -modules that were required before the change occurred. Generally it's +modules that were required before the change occurred. Generally, it's safe to assume that the two refer to the same module. As with [`require.main`][], `process.mainModule` will be `undefined` if there @@ -1163,7 +1163,7 @@ The `process.nextTick()` method adds the `callback` to the "next tick queue". Once the current turn of the event loop turn runs to completion, all callbacks currently in the next tick queue will be called. -This is *not* a simple alias to [`setTimeout(fn, 0)`][], it's much more +This is *not* a simple alias to [`setTimeout(fn, 0)`][]. It is much more efficient. It runs before any additional I/O events (including timers) fire in subsequent ticks of the event loop. From a9d528be5bf6929a58b1ea3a49eaee1119002e29 Mon Sep 17 00:00:00 2001 From: Trevor Norris Date: Tue, 18 Oct 2016 16:42:17 -0600 Subject: [PATCH 251/313] buffer: fix range checks for slice() Using the black magic of Symbol.toPrimitive the numeric value of start/end can be changed when Uint32Value() is called once Buffer::Fill() is entered. Allowing the CHECK() to be bypassed. The bug report was only for "start", but the same can be done with "end". Perform checks for both in node::Buffer::Fill() to make sure the issue can't be triggered, even if process.binding is used directly. Include tests for each case. Along with a check to make sure the last time the value is accessed returns -1. This should be enough to make sure Buffer::Fill() is receiving the correct value. Along with two tests against process.binding directly. Fixes: https://github.com/nodejs/node/issues/9149 PR-URL: https://github.com/nodejs/node/pull/9174 Reviewed-By: James M Snell Reviewed-By: Franziska Hinkelmann Reviewed-By: Ben Noordhuis --- src/node_buffer.cc | 3 +- test/parallel/test-buffer-fill.js | 76 +++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) diff --git a/src/node_buffer.cc b/src/node_buffer.cc index a90e7a5ede6dfe..d2bf5ab1046f56 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -580,7 +580,8 @@ void Fill(const FunctionCallbackInfo& args) { Local str_obj; size_t str_length; enum encoding enc; - CHECK(fill_length + start <= ts_obj_length); + THROW_AND_RETURN_IF_OOB(start <= end); + THROW_AND_RETURN_IF_OOB(fill_length + start <= ts_obj_length); // First check if Buffer has been passed. if (Buffer::HasInstance(args[1])) { diff --git a/test/parallel/test-buffer-fill.js b/test/parallel/test-buffer-fill.js index e5581b2d83d041..c61ad59d7e9cfe 100644 --- a/test/parallel/test-buffer-fill.js +++ b/test/parallel/test-buffer-fill.js @@ -314,3 +314,79 @@ Buffer.alloc(8, ''); buf.fill('է'); assert.strictEqual(buf.toString(), 'էէէէէ'); } + +// Testing public API. Make sure "start" is properly checked, even if it's +// magically mangled using Symbol.toPrimitive. +{ + let elseWasLast = false; + assert.throws(() => { + var ctr = 0; + const start = { + [Symbol.toPrimitive]() { + // We use this condition to get around the check in lib/buffer.js + if (ctr <= 0) { + elseWasLast = false; + ctr = ctr + 1; + return 0; + } else { + elseWasLast = true; + // Once buffer.js calls the C++ implemenation of fill, return -1 + return -1; + } + } + }; + Buffer.alloc(1).fill(Buffer.alloc(1), start, 1); + }, /out of range index/); + // Make sure -1 is making it to Buffer::Fill(). + assert.ok(elseWasLast, + 'internal API changed, -1 no longer in correct location'); +} + +// Testing process.binding. Make sure "start" is properly checked for -1 wrap +// around. +assert.throws(() => { + process.binding('buffer').fill(Buffer.alloc(1), 1, -1, 0, 1); +}, /out of range index/); + +// Make sure "end" is properly checked, even if it's magically mangled using +// Symbol.toPrimitive. +{ + let elseWasLast = false; + assert.throws(() => { + var ctr = 0; + const end = { + [Symbol.toPrimitive]() { + // We use this condition to get around the check in lib/buffer.js + if (ctr <= 1) { + elseWasLast = false; + ctr = ctr + 1; + return 1; + } else { + elseWasLast = true; + // Once buffer.js calls the C++ implemenation of fill, return -1 + return -1; + } + } + }; + Buffer.alloc(1).fill(Buffer.alloc(1), 0, end); + }); + // Make sure -1 is making it to Buffer::Fill(). + assert.ok(elseWasLast, + 'internal API changed, -1 no longer in correct location'); +} + +// Testing process.binding. Make sure "end" is properly checked for -1 wrap +// around. +assert.throws(() => { + process.binding('buffer').fill(Buffer.alloc(1), 1, 1, -2, 1); +}, /out of range index/); + +// Test that bypassing 'length' won't cause an abort. +assert.throws(() => { + const buf = new Buffer('w00t'); + Object.defineProperty(buf, 'length', { + value: 1337, + enumerable: true + }); + buf.fill(''); +}); From bbebebe08705fdb16eab5b8d74d660a5c3d9af9c Mon Sep 17 00:00:00 2001 From: J Scott Chapman Date: Thu, 1 Dec 2016 10:17:46 -0600 Subject: [PATCH 252/313] test: strictEqual() and RegExp in test-buffer-fill.js Used assert.strictEqual() instead of assert.equal() Passed a RegExp to assert.throws() Broke lines to satisfy linting PR-URL: https://github.com/nodejs/node/pull/9895 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-buffer-fill.js | 48 ++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/test/parallel/test-buffer-fill.js b/test/parallel/test-buffer-fill.js index c61ad59d7e9cfe..4272d686940cc7 100644 --- a/test/parallel/test-buffer-fill.js +++ b/test/parallel/test-buffer-fill.js @@ -49,7 +49,7 @@ testBufs('\u0222aa', 8, 1, 'utf8'); testBufs('a\u0234b\u0235c\u0236', 4, -1, 'utf8'); testBufs('a\u0234b\u0235c\u0236', 4, 1, 'utf8'); testBufs('a\u0234b\u0235c\u0236', 12, 1, 'utf8'); -assert.equal(Buffer.allocUnsafe(1).fill(0).fill('\u0222')[0], 0xc8); +assert.strictEqual(Buffer.allocUnsafe(1).fill(0).fill('\u0222')[0], 0xc8); // BINARY @@ -112,8 +112,8 @@ testBufs('\u0222aa', 8, 1, 'ucs2'); testBufs('a\u0234b\u0235c\u0236', 4, -1, 'ucs2'); testBufs('a\u0234b\u0235c\u0236', 4, 1, 'ucs2'); testBufs('a\u0234b\u0235c\u0236', 12, 1, 'ucs2'); -assert.equal(Buffer.allocUnsafe(1).fill('\u0222', 'ucs2')[0], - os.endianness() === 'LE' ? 0x22 : 0x02); +assert.strictEqual(Buffer.allocUnsafe(1).fill('\u0222', 'ucs2')[0], + os.endianness() === 'LE' ? 0x22 : 0x02); // HEX @@ -137,7 +137,8 @@ testBufs('61c8b462c8b563c8b6', 4, 1, 'hex'); testBufs('61c8b462c8b563c8b6', 12, 1, 'hex'); // Make sure this operation doesn't go on forever buf1.fill('yKJh', 'hex'); -assert.throws(() => buf1.fill('\u0222', 'hex')); +assert.throws(() => + buf1.fill('\u0222', 'hex'), /^TypeError: Invalid hex string$/); // BASE64 @@ -183,14 +184,25 @@ deepStrictEqualValues(genBuffer(4, [hexBufFill, 1, -1]), [0, 0, 0, 0]); // Check exceptions -assert.throws(() => buf1.fill(0, -1)); -assert.throws(() => buf1.fill(0, 0, buf1.length + 1)); -assert.throws(() => buf1.fill('', -1)); -assert.throws(() => buf1.fill('', 0, buf1.length + 1)); -assert.throws(() => buf1.fill('a', 0, buf1.length, 'node rocks!')); -assert.throws(() => buf1.fill('a', 0, 0, NaN)); -assert.throws(() => buf1.fill('a', 0, 0, null)); -assert.throws(() => buf1.fill('a', 0, 0, 'foo')); +assert.throws(() => buf1.fill(0, -1), /^RangeError: Out of range index$/); +assert.throws(() => + buf1.fill(0, 0, buf1.length + 1), + /^RangeError: Out of range index$/); +assert.throws(() => buf1.fill('', -1), /^RangeError: Out of range index$/); +assert.throws(() => + buf1.fill('', 0, buf1.length + 1), + /^RangeError: Out of range index$/); +assert.throws(() => + buf1.fill('a', 0, buf1.length, 'node rocks!'), + /^TypeError: Unknown encoding: node rocks!$/); +assert.throws(() => + buf1.fill('a', 0, 0, NaN), + /^TypeError: encoding must be a string$/); +assert.throws(() => + buf1.fill('a', 0, 0, null), + /^TypeError: encoding must be a string$/); +assert.throws(() => + buf1.fill('a', 0, 0, 'foo'), /^TypeError: Unknown encoding: foo$/); function genBuffer(size, args) { @@ -269,8 +281,12 @@ function testBufs(string, offset, length, encoding) { } // Make sure these throw. -assert.throws(() => Buffer.allocUnsafe(8).fill('a', -1)); -assert.throws(() => Buffer.allocUnsafe(8).fill('a', 0, 9)); +assert.throws(() => + Buffer.allocUnsafe(8).fill('a', -1), + /^RangeError: Out of range index$/); +assert.throws(() => + Buffer.allocUnsafe(8).fill('a', 0, 9), + /^RangeError: Out of range index$/); // Make sure this doesn't hang indefinitely. Buffer.allocUnsafe(8).fill(''); @@ -369,7 +385,7 @@ assert.throws(() => { } }; Buffer.alloc(1).fill(Buffer.alloc(1), 0, end); - }); + }, /^RangeError: out of range index$/); // Make sure -1 is making it to Buffer::Fill(). assert.ok(elseWasLast, 'internal API changed, -1 no longer in correct location'); @@ -389,4 +405,4 @@ assert.throws(() => { enumerable: true }); buf.fill(''); -}); +}, /^RangeError: out of range index$/); From 6dbff7aaedf38e19d4a8f5642488f883bf002df6 Mon Sep 17 00:00:00 2001 From: Jonathan Darling Date: Thu, 1 Dec 2016 10:28:44 -0600 Subject: [PATCH 253/313] test: convert assert.equal to assert.strictEqual converts an instance of assert.equal in a file already mostly updated to use assert.strictEqual PR-URL: https://github.com/nodejs/node/pull/9925 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: James M Snell --- test/parallel/test-buffer-slow.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-buffer-slow.js b/test/parallel/test-buffer-slow.js index 24bd9e1cfd314d..d65459198a3547 100644 --- a/test/parallel/test-buffer-slow.js +++ b/test/parallel/test-buffer-slow.js @@ -35,7 +35,7 @@ try { assert.strictEqual( SlowBuffer(buffer.kMaxLength).length, buffer.kMaxLength); } catch (e) { - assert.equal(e.message, 'Array buffer allocation failed'); + assert.strictEqual(e.message, 'Array buffer allocation failed'); } // should work with number-coercible values From fac61118f9f8be3c45779c0c4713490e9fcaca6f Mon Sep 17 00:00:00 2001 From: Teddy Katz Date: Sat, 3 Dec 2016 03:03:27 -0500 Subject: [PATCH 254/313] repl: avoid parsing division operator as regex This improves the heuristic used in multiline-prompt mode to determine whether a given slash character is at the beginning of a regular expression. PR-URL: https://github.com/nodejs/node/pull/10103 Reviewed-By: Prince John Wesley Reviewed-By: James M Snell Fixes: https://github.com/nodejs/node/issues/9300 --- lib/repl.js | 9 ++++++++- test/parallel/test-repl.js | 10 ++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/lib/repl.js b/lib/repl.js index 73a57bf0b07ff1..487dd880743b3a 100644 --- a/lib/repl.js +++ b/lib/repl.js @@ -93,6 +93,7 @@ class LineParser { this.shouldFail = false; this.blockComment = false; this.regExpLiteral = false; + this.prevTokenChar = null; } parseLine(line) { @@ -132,7 +133,11 @@ class LineParser { if (previous === '/') { if (current === '*') { this.blockComment = true; - } else { + } else if ( + // Distinguish between a division operator and the start of a regex + // by examining the non-whitespace character that precedes the / + [null, '(', '[', '{', '}', ';'].includes(this.prevTokenChar) + ) { this.regExpLiteral = true; } previous = null; @@ -147,6 +152,8 @@ class LineParser { this._literal = this._literal || current; } + if (current.trim() && current !== '/') this.prevTokenChar = current; + previous = current; } diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index 4342910d5dac03..70aac915f6b594 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -352,6 +352,16 @@ function error_test() { { client: client_unix, send: 'function * foo() {}; foo().next()', expect: '{ value: undefined, done: true }' }, + + // https://github.com/nodejs/node/issues/9300 + { client: client_unix, send: 'function foo() {\nvar bar = 1 / 1; // "/"\n}', + expect: prompt_multiline + prompt_multiline + 'undefined\n' + prompt_unix }, + + { client: client_unix, send: '(function() {\nreturn /foo/ / /bar/;\n}())', + expect: prompt_multiline + prompt_multiline + 'NaN\n' + prompt_unix }, + + { client: client_unix, send: '(function() {\nif (false) {} /bar"/;\n}())', + expect: prompt_multiline + prompt_multiline + 'undefined\n' + prompt_unix } ]); } From e0dbb453e496b18bdac6593254b96dfbcad499aa Mon Sep 17 00:00:00 2001 From: BethGriggs Date: Tue, 15 Nov 2016 17:47:58 +0000 Subject: [PATCH 255/313] doc: remove repeated info onboarding.md COLLABORATOR_GUIDE.md and onboarding.md cover some of the same information. The aim of this commit is to remove duplicated information. PR-URL: https://github.com/nodejs/node/pull/9635 Reviewed-By: James M Snell Reviewed-By: Sam Roberts --- COLLABORATOR_GUIDE.md | 74 +++++++++++----- doc/onboarding.md | 192 ++++++++++++------------------------------ 2 files changed, 110 insertions(+), 156 deletions(-) diff --git a/COLLABORATOR_GUIDE.md b/COLLABORATOR_GUIDE.md index 214f262fdc61d5..702d539d460301 100644 --- a/COLLABORATOR_GUIDE.md +++ b/COLLABORATOR_GUIDE.md @@ -36,6 +36,8 @@ Collaborators or additional evidence that the issue has relevance, the issue may be closed. Remember that issues can always be re-opened if necessary. +[**See "Who to CC in issues"**](./onboarding-extras.md#who-to-cc-in-issues) + ## Accepting Modifications All modifications to the Node.js code and documentation should be @@ -60,19 +62,20 @@ and work schedules. Trivial changes (e.g. those which fix minor bugs or improve performance without affecting API or causing other wide-reaching impact) may be landed after a shorter delay. -For non-breaking changes, if there is no disagreement amongst Collaborators, a -pull request may be landed given appropriate review. Where there is discussion -amongst Collaborators, consensus should be sought if possible. The -lack of consensus may indicate the need to elevate discussion to the -CTC for resolution (see below). - -Breaking changes (that is, pull requests that require an increase in the -major version number, known as `semver-major` changes) must be elevated for -review by the CTC. This does not necessarily mean that the PR must be put onto -the CTC meeting agenda. If multiple CTC members approve (`LGTM`) the PR and no -Collaborators oppose the PR, it can be landed. Where there is disagreement among -CTC members or objections from one or more Collaborators, `semver-major` pull -requests should be put on the CTC meeting agenda. +For non-breaking changes, if there is no disagreement amongst +Collaborators, a pull request may be landed given appropriate review. +Where there is discussion amongst Collaborators, consensus should be +sought if possible. The lack of consensus may indicate the need to +elevate discussion to the CTC for resolution (see below). + +Breaking changes (that is, pull requests that require an increase in +the major version number, known as `semver-major` changes) must be +elevated for review by the CTC. This does not necessarily mean that the +PR must be put onto the CTC meeting agenda. If multiple CTC members +approve (`LGTM`) the PR and no Collaborators oppose the PR, it can be +landed. Where there is disagreement among CTC members or objections +from one or more Collaborators, `semver-major` pull requests should be +put on the CTC meeting agenda. All bugfixes require a test case which demonstrates the defect. The test should *fail* before the change, and *pass* after the change. @@ -96,13 +99,20 @@ The CTC should serve as the final arbiter where required. ## Landing Pull Requests +* Please never use GitHub's green ["Merge Pull Request"](https://help.github.com/articles/merging-a-pull-request/#merging-a-pull-request-using-the-github-web-interface) button. + * If you do, please force-push removing the merge. + * Reasons for not using the web interface button: + * The merge method will add an unnecessary merge commit. + * The rebase & merge method adds metadata to the commit title. + * The rebase method changes the author. + * The squash & merge method has been known to add metadata to the + commit title. + * If more than one author has contributed to the PR, only the + latest author will be considered during the squashing. + Always modify the original commit message to include additional meta information regarding the change process: -- A `Reviewed-By: Name ` line for yourself and any - other Collaborators who have reviewed the change. - - Useful for @mentions / contact list if something goes wrong in the PR. - - Protects against the assumption that GitHub will be around forever. - A `PR-URL:` line that references the *full* GitHub URL of the original pull request being merged so it's easy to trace a commit back to the conversation that led up to that change. @@ -110,6 +120,10 @@ information regarding the change process: for an issue, and/or the hash and commit message if the commit fixes a bug in a previous commit. Multiple `Fixes:` lines may be added if appropriate. +- A `Reviewed-By: Name ` line for yourself and any + other Collaborators who have reviewed the change. + - Useful for @mentions / contact list if something goes wrong in the PR. + - Protects against the assumption that GitHub will be around forever. Review the commit message to ensure that it adheres to the guidelines outlined in the [contributing](https://github.com/nodejs/node/blob/master/CONTRIBUTING.md#step-3-commit) guide. @@ -119,7 +133,6 @@ See the commit log for examples such as exactly how to format your commit messages. Additionally: - - Double check PRs to make sure the person's _full name_ and email address are correct before merging. - Except when updating dependencies, all commits should be self @@ -224,16 +237,36 @@ Save the file and close the editor. You'll be asked to enter a new commit message for that commit. This is a good moment to fix incorrect commit logs, ensure that they are properly formatted, and add `Reviewed-By` lines. +* The commit message text must conform to the [commit message guidelines](../CONTRIBUTING.md#step-3-commit). Time to push it: ```text $ git push origin master ``` +* Optional: Force push the amended commit to the branch you used to +open the pull request. If your branch is called `bugfix`, then the +command would be `git push --force-with-lease origin master:bugfix`. +When the pull request is closed, this will cause the pull request to +show the purple merged status rather than the red closed status that is +usually used for pull requests that weren't merged. Only do this when +landing your own contributions. + +* Close the pull request with a "Landed in ``" comment. If +your pull request shows the purple merged status then you should still +add the "Landed in .." comment if you added +multiple commits. + +* `./configure && make -j8 test` + * `-j8` builds node in parallel with 8 threads. Adjust to the number + of cores or processor-level threads your processor has (or slightly + more) for best results. ### I Just Made a Mistake -With `git`, there's a way to override remote trees by force pushing +* Ping a CTC member. +* `#node-dev` on freenode +* With `git`, there's a way to override remote trees by force pushing (`git push -f`). This should generally be seen as forbidden (since you're rewriting history on a repository other people are working against) but is allowed for simpler slip-ups such as typos in commit @@ -241,6 +274,9 @@ messages. However, you are only allowed to force push to any Node.js branch within 10 minutes from your original push. If someone else pushes to the branch or the 10 minute period passes, consider the commit final. + * Use `--force-with-lease` to minimize the chance of overwriting + someone else's change. + * Post to `#node-dev` (IRC) if you force push. ### Long Term Support diff --git a/doc/onboarding.md b/doc/onboarding.md index 5d0560e176e7ba..665890da968699 100644 --- a/doc/onboarding.md +++ b/doc/onboarding.md @@ -14,107 +14,98 @@ onboarding session. * Prior to the onboarding session, add the new Collaborators to [the Collaborators team](https://github.com/orgs/nodejs/teams/collaborators). -## **thank you** for doing this +## Onboarding session - * going to cover four things: - * local setup - * some project goals & values - * issues, labels, and reviewing code - * merging code - -## setup - - * notifications setup - * use https://github.com/notifications or set up email - * watching the main repo will flood your inbox, so be prepared +* **thank you** for doing this +* will cover: + * [local setup](#local-setup) + * [project goals & values](#project-goals--values) + * [managing the issue tracker](#managing-the-issue-tracker) + * [reviewing PRs](#reviewing-prs) + * [landing PRs](#landing-prs) +## Local setup * git: * make sure you have whitespace=fix: `git config --global --add core.whitespace fix` * usually PR from your own github fork - * [**See "Updating Node.js from Upstream"**](./onboarding-extras.md#updating-nodejs-from-upstream) + * [See "Updating Node.js from Upstream"](./onboarding-extras.md#updating-nodejs-from-upstream) * make new branches for all commits you make! + * notifications: + * use [https://github.com/notifications](https://github.com/notifications) or set up email + * watching the main repo will flood your inbox, so be prepared - * `#node-dev` on `chat.freenode.net` is the best place to interact with the CTC / other collaborators + * `#node-dev` on [webchat.freenode.net](https://webchat.freenode.net/) is the best place to interact with the CTC / other collaborators -## a little deeper about the project +## Project goals & values * collaborators are effectively part owners * the project has the goals of its contributors - * but, there are some higher-level goals and values * not everything belongs in core (if it can be done reasonably in userland, let it stay in userland) * empathy towards users matters (this is in part why we onboard people) * generally: try to be nice to people - -## managing the issue tracker +## Managing the issue tracker * you have (mostly) free rein – don't hesitate to close an issue if you are confident that it should be closed - * this will come more naturally over time - * IMPORTANT: be nice about closing issues, let people know why, and that issues and PRs can be reopened if necessary - * Still need to follow the Code of Conduct. - + * **IMPORTANT**: be nice about closing issues, let people know why, and that issues and PRs can be reopened if necessary + * Still need to follow the Code of Conduct - * Labels: + * [**See "Labels"**](./onboarding-extras.md#labels) * There is [a bot](https://github.com/nodejs-github-bot/github-bot) that applies subsystem labels (for example, `doc`, `test`, `assert`, or `buffer`) so that we know what parts of the code base the pull request modifies. It is not perfect, of course. Feel free to apply relevant labels and remove irrelevant labels from pull requests and issues. - * [**See "Labels"**](./onboarding-extras.md#labels) * Use the `ctc-review` label if a topic is controversial or isn't coming to a conclusion after an extended time. * `semver-{minor,major}`: - * If a change has the remote *chance* of breaking something, use `semver-major` + * If a change has the remote *chance* of breaking something, use the `semver-major` label * When adding a semver label, add a comment explaining why you're adding it. Do it right away so you don't forget! - * Notifying humans - * [**See "Who to CC in issues"**](./onboarding-extras.md#who-to-cc-in-issues) + * [**See "Who to CC in issues"**](./onboarding-extras.md#who-to-cc-in-issues) * will also come more naturally over time - - * Reviewing: - * The primary goal is for the codebase to improve. - * Secondary (but not far off) is for the person submitting code to succeed. +## Reviewing PRs + * The primary goal is for the codebase to improve. + * Secondary (but not far off) is for the person submitting code to succeed. A pull request from a new contributor is an opportunity to grow the community. - * Review a bit at a time. Do not overwhelm new contributors. - * It is tempting to micro-optimize and make everything about relative + * Review a bit at a time. Do not overwhelm new contributors. + * It is tempting to micro-optimize and make everything about relative performance. Don't succumb to that temptation. We change V8 often. Techniques that provide improved performance today may be unnecessary in the future. - * Be aware: Your opinion carries a lot of weight! - * Nits (requests for small changes that are not essential) are fine, but try - to avoid stalling the pull request. - * Note that they are nits when you comment: `Nit: change foo() to bar().` - * If they are stalling the pull request, fix them yourself on merge. - * Minimum wait for comments time - * There is a minimum waiting time which we try to respect for non-trivial + * Be aware: Your opinion carries a lot of weight! + * Nits (requests for small changes that are not essential) are fine, but try + to avoid stalling the pull request. + * Note that they are nits when you comment: `Nit: change foo() to bar().` + * If they are stalling the pull request, fix them yourself on merge. + * Minimum wait for comments time + * There is a minimum waiting time which we try to respect for non-trivial changes, so that people who may have important input in such a distributed project are able to respond. - * For non-trivial changes, leave the pull request open for at least 48 + * For non-trivial changes, leave the pull request open for at least 48 hours (72 hours on a weekend). - * If a pull request is abandoned, check if they'd mind if you took it over + * If a pull request is abandoned, check if they'd mind if you took it over (especially if it just has nits left). - * Approving a change - * Collaborators indicate that they have reviewed and approve of the + * Approving a change + * Collaborators indicate that they have reviewed and approve of the the changes in a pull request by commenting with `LGTM`, which stands for "looks good to me". - * You have the power to `LGTM` another collaborator's (including TSC/CTC + * You have the power to `LGTM` another collaborator's (including TSC/CTC members) work. - * You may not `LGTM` your own pull requests. - * You have the power to `LGTM` anyone else's pull requests. - + * You may not `LGTM` your own pull requests. + * You have the power to `LGTM` anyone else's pull requests. - * what belongs in node: + * What belongs in node: * opinions vary, but I find the following helpful: * if node itself needs it (due to historic reasons), then it belongs in node * that is to say, url is there because of http, freelist is there because of http, et al * also, things that cannot be done outside of core, or only with significant pain (example: async-wrap) - * Continuous Integration (CI) Testing: - * https://ci.nodejs.org/ + * [https://ci.nodejs.org/](https://ci.nodejs.org/) * It is not automatically run. You need to start it manually. * Log in on CI is integrated with GitHub. Try to log in now! * You will be using `node-test-pull-request` most of the time. Go there now! @@ -130,85 +121,13 @@ onboarding session. * Use the [Build WG repo](https://github.com/nodejs/build) to file issues for the Build WG members who maintain the CI infrastructure. -## Landing PRs: Overview - - * The [Collaborator Guide](https://github.com/nodejs/node/blob/master/COLLABORATOR_GUIDE.md#technical-howto) is a great resource. - - - * No one (including TSC or CTC members) pushes directly to master without review. - * An exception is made for release commits only. - - - * One `LGTM` is sufficient, except for semver-major changes. - * More than one is better. - * Breaking changes must be LGTM'ed by at least two CTC members. - * If one or more Collaborators object to a change, it should not land until - the objection is addressed. The options for such a situation include: - * Engaging those with objections to determine a viable path forward; - * Altering the pull request to address the objections; - * Escalating the discussion to the CTC using the `ctc-review` label. This - should only be done after the previous options have been exhausted. - - * Wait before merging non-trivial changes. - * 48 hours during the week and 72 hours on weekends. - * An example of a trivial change would be correcting the misspelling of a single word in a documentation file. This sort of change still needs to receive at least one `LGTM` but it does not need to wait 48 hours before landing. - - * **Run the PR through CI before merging!** - * An exception can be made for documentation-only PRs as long as it does not include the `addons.md` documentation file. (Example code from that document is extracted and built as part of the tests!) - - * What if something goes wrong? - * Ping a CTC member. - * `#node-dev` on freenode - * Force-pushing to fix things after is allowed for ~10 minutes. Avoid it if you can. - * Use `--force-with-lease` to minimize the chance of overwriting someone else's change. - * Post to `#node-dev` (IRC) if you force push. - - -## Landing PRs: Details - -* Please never use GitHub's green ["Merge Pull Request"](https://help.github.com/articles/merging-a-pull-request/#merging-a-pull-request-using-the-github-web-interface) button. - * If you do, please force-push removing the merge. - * Reasons for not using the web interface button: - * The merge method will add an unnecessary merge commit. - * The rebase & merge method adds metadata to the commit title. - * The rebase method changes the author. - * The squash & merge method has been known to add metadata to the commit title. - * If more than one author has contributed to the PR, only the latest author will be considered during the squashing. - - -Update your `master` branch (or whichever branch you are landing on, almost always `master`) - -* [**See "Updating Node.js from Upstream"**](./onboarding-extras.md#updating-nodejs-from-upstream) - -Landing a PR - -* If it all looks good, `curl -L 'url-of-pr.patch' | git am` - * If `git am` fails, see [the relevant section of the Onboarding Extras doc](./onboarding-extras.md#if-git-am-fails). -* `git rebase -i upstream/master` -* Squash into logical commits if necessary. -* `./configure && make -j8 test` (`-j8` builds node in parallel with 8 threads. adjust to the number of cores (or processor-level threads) your processor has (or slightly more) for best results.) -* Amend the commit description. - * The commit message text must conform to the [commit message guidelines](../CONTRIBUTING.md#step-3-commit). - * Add required metadata: - * `PR-URL: ` - * `Reviewed-By: ` - * Easiest to use `git log`, then do a search. - * In vim: `/Name` + `enter` (+ `n` as much as you need to) - * Only include collaborators who have commented `LGTM`. - * Add additional metadata as appropriate: - * `Fixes: ` - * Full URL of GitHub issue that the PR fixes. - * This will automatically close the PR when the commit lands in master. - * `Refs: ` - * Full URL of material that might provide additional useful information or context to someone trying to understand the change set or the thinking behind it. -* Optional: Force push the amended commit to the branch you used to open the pull request. If your branch is called `bugfix`, then the command would be `git push --force-with-lease origin master:bugfix`. When the pull request is closed, this will cause the pull request to show the purple merged status rather than the red closed status that is usually used for pull requests that weren't merged. Only do this when landing your own contributions. -* `git push upstream master` - * Close the pull request with a "Landed in ``" comment. +## Landing PRs + * [See the Collaborator Guide: Technical HOWTO](https://github.com/nodejs/node/blob/master/COLLABORATOR_GUIDE.md#technical-howto) ## Exercise: Make a PR adding yourself to the README - * Example: https://github.com/nodejs/node/commit/7b09aade8468e1c930f36b9c81e6ac2ed5bc8732 + * Example: [https://github.com/nodejs/node/commit/7b09aade8468e1c930f36b9c81e6ac2ed5bc8732](https://github.com/nodejs/node/commit/7b09aade8468e1c930f36b9c81e6ac2ed5bc8732) * For raw commit message: `git log 7b09aade8468e1c930f36b9c81e6ac2ed5bc8732 -1` * Collaborators are in alphabetical order by GitHub username. * Label your pull request with the `doc` subsystem label. @@ -216,18 +135,17 @@ Landing a PR * After a `LGTM` or two, land the PR. * Be sure to add the `PR-URL: ` and appropriate `Reviewed-By:` metadata! - -## final notes +## Final notes * don't worry about making mistakes: everybody makes them, there's a lot to internalize and that takes time (and we recognize that!) * very few (no?) mistakes are unrecoverable - * the existing node committers trust you and are grateful for your help! + * the existing collaborators trust you and are grateful for your help! * other repos: - * https://github.com/nodejs/dev-policy - * https://github.com/nodejs/NG - * https://github.com/nodejs/api - * https://github.com/nodejs/build - * https://github.com/nodejs/docs - * https://github.com/nodejs/nodejs.org - * https://github.com/nodejs/readable-stream - * https://github.com/nodejs/LTS + * [https://github.com/nodejs/dev-policy](https://github.com/nodejs/dev-policy) + * [https://github.com/nodejs/NG](https://github.com/nodejs/NG) + * [https://github.com/nodejs/api](https://github.com/nodejs/api) + * [https://github.com/nodejs/build](https://github.com/nodejs/build) + * [https://github.com/nodejs/docs](https://github.com/nodejs/docs) + * [https://github.com/nodejs/nodejs.org](https://github.com/nodejs/nodejs.org) + * [https://github.com/nodejs/readable-stream](https://github.com/nodejs/readable-stream) + * [https://github.com/nodejs/LTS](https://github.com/nodejs/LTS) From 7f4cef1170cdc7898db846bb061d7c298054075b Mon Sep 17 00:00:00 2001 From: "Italo A. Casas" Date: Wed, 7 Dec 2016 12:52:47 -0500 Subject: [PATCH 256/313] doc: removing extra space in README MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/10168 Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott Reviewed-By: Evan Lucas Reviewed-By: Michaël Zasso --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 68ffbb90598d0f..065daefbc22f5e 100644 --- a/README.md +++ b/README.md @@ -238,7 +238,7 @@ more information about the governance of the Node.js project, see * [isaacs](https://github.com/isaacs) - **Isaac Z. Schlueter** <i@izs.me> * [italoacasas](https://github.com/italoacasas) -**Italo A. Casas** <me@italoacasas.com> +**Italo A. Casas** <me@italoacasas.com> * [iWuzHere](https://github.com/iWuzHere) - **Imran Iqbal** <imran@imraniqbal.org> * [JacksonTian](https://github.com/JacksonTian) - From c55fb737c5ad47151aee19ef471d576081d6e774 Mon Sep 17 00:00:00 2001 From: "Italo A. Casas" Date: Wed, 7 Dec 2016 13:21:00 -0500 Subject: [PATCH 257/313] doc: adding missing - in README PR-URL: https://github.com/nodejs/node/pull/10170 Reviewed-By: Rich Trott --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 065daefbc22f5e..bdb74b5446ac40 100644 --- a/README.md +++ b/README.md @@ -237,7 +237,7 @@ more information about the governance of the Node.js project, see **Ilkka Myller** <ilkka.myller@nodefield.com> * [isaacs](https://github.com/isaacs) - **Isaac Z. Schlueter** <i@izs.me> -* [italoacasas](https://github.com/italoacasas) +* [italoacasas](https://github.com/italoacasas) - **Italo A. Casas** <me@italoacasas.com> * [iWuzHere](https://github.com/iWuzHere) - **Imran Iqbal** <imran@imraniqbal.org> From 1bbf1438989fec9a5c88b17de6ef9637e8ae46f3 Mon Sep 17 00:00:00 2001 From: Jared Young Date: Thu, 1 Dec 2016 10:15:36 -0800 Subject: [PATCH 258/313] test: renamed assert.Equal to assert.strictEqual --- test/parallel/test-crypto-authenticated.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-crypto-authenticated.js b/test/parallel/test-crypto-authenticated.js index 8eab91e549dfa7..4bed5aa665b64d 100644 --- a/test/parallel/test-crypto-authenticated.js +++ b/test/parallel/test-crypto-authenticated.js @@ -352,7 +352,7 @@ for (const i in TEST_CASES) { let msg = decrypt.update(test.ct, 'hex', outputEncoding); if (!test.tampered) { msg += decrypt.final(outputEncoding); - assert.equal(msg, test.plain); + assert.strictEqual(msg, test.plain); } else { // assert that final throws if input data could not be verified! assert.throws(function() { decrypt.final('ascii'); }, / auth/); From dc76aaef503f9a1f18ee9eafa4cae847794921dc Mon Sep 17 00:00:00 2001 From: eudaimos Date: Thu, 1 Dec 2016 10:25:58 -0600 Subject: [PATCH 259/313] test: refactor test-crypto-hmac * replace assert.equals with assert.strictEquals * use template strings where appropriate PR-URL: https://github.com/nodejs/node/pull/9958 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-crypto-hmac.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-crypto-hmac.js b/test/parallel/test-crypto-hmac.js index 7c550be4c2ebf3..5307ea4f6f9e05 100644 --- a/test/parallel/test-crypto-hmac.js +++ b/test/parallel/test-crypto-hmac.js @@ -13,7 +13,7 @@ var h1 = crypto.createHmac('sha1', 'Node') .update('some data') .update('to hmac') .digest('hex'); -assert.equal(h1, '19fd6e1ba73d9ed2224dd5094a71babe85d9a892', 'test HMAC'); +assert.strictEqual(h1, '19fd6e1ba73d9ed2224dd5094a71babe85d9a892', 'test HMAC'); // Test HMAC (Wikipedia Test Cases) var wikipedia = [ @@ -67,9 +67,9 @@ for (let i = 0, l = wikipedia.length; i < l; i++) { const result = crypto.createHmac(hash, wikipedia[i]['key']) .update(wikipedia[i]['data']) .digest('hex'); - assert.equal(wikipedia[i]['hmac'][hash], - result, - 'Test HMAC-' + hash + ': Test case ' + (i + 1) + ' wikipedia'); + assert.strictEqual(wikipedia[i]['hmac'][hash], + result, + `Test HMAC-${hash}: Test case ${i + 1} wikipedia`); } } @@ -233,10 +233,10 @@ for (let i = 0, l = rfc4231.length; i < l; i++) { result = result.substr(0, 32); // first 128 bits == 32 hex chars strRes = strRes.substr(0, 32); } - assert.equal(rfc4231[i]['hmac'][hash], - result, - 'Test HMAC-' + hash + ': Test case ' + (i + 1) + ' rfc 4231'); - assert.equal(strRes, result, 'Should get same result from stream'); + assert.strictEqual(rfc4231[i]['hmac'][hash], + result, + `Test HMAC-${hash}: Test case ${i + 1} rfc 4231`); + assert.strictEqual(strRes, result, 'Should get same result from stream'); } } @@ -356,7 +356,7 @@ if (!common.hasFipsCrypto) { crypto.createHmac('md5', rfc2202_md5[i]['key']) .update(rfc2202_md5[i]['data']) .digest('hex'), - 'Test HMAC-MD5 : Test case ' + (i + 1) + ' rfc 2202' + `Test HMAC-MD5 : Test case ${i + 1} rfc 2202` ); } } @@ -366,6 +366,6 @@ for (let i = 0, l = rfc2202_sha1.length; i < l; i++) { crypto.createHmac('sha1', rfc2202_sha1[i]['key']) .update(rfc2202_sha1[i]['data']) .digest('hex'), - 'Test HMAC-SHA1 : Test case ' + (i + 1) + ' rfc 2202' + `Test HMAC-SHA1 : Test case ${i + 1} rfc 2202` ); } From 9703bf14ef1ed234def70ffe71680cb8a4c36f2b Mon Sep 17 00:00:00 2001 From: Daniel Bevenius Date: Thu, 3 Nov 2016 20:40:34 +0100 Subject: [PATCH 260/313] build: add MAKEFLAGS="-j1" to node-gyp Currently, when building the addons the following warning is displayed: make[2]: warning: jobserver unavailable: using -j1. Add `+' to parent make rule. Adding the MAKEFLAGS="-j1" to avoid the warning. Also updated the log message to say that it is building the addon and not running the test as I think that is more accurate. PR-URL: https://github.com/nodejs/node/pull/9450 Reviewed-By: Ben Noordhuis Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Colin Ihrig --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index e244f73a344350..719b855559383a 100644 --- a/Makefile +++ b/Makefile @@ -163,9 +163,10 @@ test/addons/.buildstamp: config.gypi \ test/addons/.docbuildstamp # Cannot use $(wildcard test/addons/*/) here, it's evaluated before # embedded addons have been generated from the documentation. - for dirname in test/addons/*/; do \ - echo "\nRunning addons test $$PWD/$$dirname" ; \ - $(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp --loglevel=$(LOGLEVEL) rebuild \ + @for dirname in test/addons/*/; do \ + echo "\nBuilding addon $$PWD/$$dirname" ; \ + env MAKEFLAGS="-j1" $(NODE) deps/npm/node_modules/node-gyp/bin/node-gyp \ + --loglevel=$(LOGLEVEL) rebuild \ --python="$(PYTHON)" \ --directory="$$PWD/$$dirname" \ --nodedir="$$PWD" || exit 1 ; \ From db10e940833da4d645e22cbb94fb5b751661de1b Mon Sep 17 00:00:00 2001 From: Evan Lucas Date: Tue, 4 Oct 2016 18:28:26 -0500 Subject: [PATCH 261/313] process: improve performance of nextTick MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This replaces TickObject with an object literal. This offers performance improvements of up to ~20%. PR-URL: https://github.com/nodejs/node/pull/8932 Reviewed-By: Claudio Rodriguez Reviewed-By: Roman Reiss Reviewed-By: Ilkka Myller Reviewed-By: Luigi Pinca Reviewed-By: James M Snell Reviewed-By: Johan Bergström Reviewed-By: Trevor Norris --- lib/internal/process/next_tick.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lib/internal/process/next_tick.js b/lib/internal/process/next_tick.js index 529645aa8d65c4..f27ef622a96e6a 100644 --- a/lib/internal/process/next_tick.js +++ b/lib/internal/process/next_tick.js @@ -131,12 +131,6 @@ function setupNextTick() { } while (tickInfo[kLength] !== 0); } - function TickObject(c, args) { - this.callback = c; - this.domain = process.domain || null; - this.args = args; - } - function nextTick(callback) { if (typeof callback !== 'function') throw new TypeError('callback is not a function'); @@ -151,7 +145,11 @@ function setupNextTick() { args[i - 1] = arguments[i]; } - nextTickQueue.push(new TickObject(callback, args)); + nextTickQueue.push({ + callback, + domain: process.domain || null, + args + }); tickInfo[kLength]++; } } From 30f7802b782fcc4460f25c171111844ead110931 Mon Sep 17 00:00:00 2001 From: "Kyle E. Mitchell" Date: Mon, 17 Oct 2016 20:04:50 -0700 Subject: [PATCH 262/313] doc: clarify fs.link and fs.linkSync arguments Clarifies documentation by replacing the argument names `srcpath` and `dstpath` with more descriptive `existingPath` and `newPath`, reflecting how POSIX describes `link()`. PR-URL: https://github.com/nodejs/node/pull/9145 Reviewed-By: Sakthipriyan Vairamani Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Gibson Fahnestock --- doc/api/fs.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index af7428b34293d0..61ef6187258e50 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1036,25 +1036,25 @@ deprecated: v0.4.7 Synchronous lchown(2). Returns `undefined`. -## fs.link(srcpath, dstpath, callback) +## fs.link(existingPath, newPath, callback) -* `srcpath` {String | Buffer} -* `dstpath` {String | Buffer} +* `existingPath` {String | Buffer} +* `newPath` {String | Buffer} * `callback` {Function} Asynchronous link(2). No arguments other than a possible exception are given to the completion callback. -## fs.linkSync(srcpath, dstpath) +## fs.linkSync(existingPath, newPath) -* `srcpath` {String | Buffer} -* `dstpath` {String | Buffer} +* `existingPath` {String | Buffer} +* `newPath` {String | Buffer} Synchronous link(2). Returns `undefined`. From fe821fbefa7d4f4b9cba633824efbacaf2436f82 Mon Sep 17 00:00:00 2001 From: "Kyle E. Mitchell" Date: Wed, 19 Oct 2016 13:42:34 -0700 Subject: [PATCH 263/313] fs: clarify fs.link and fs.linkSync arguments Updates the argument names `srcpath` and `dstpath` to match the more descriptive `existingPath` and `newPath` in the documentation. PR-URL: https://github.com/nodejs/node/pull/9145 Reviewed-By: Sakthipriyan Vairamani Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Gibson Fahnestock --- lib/fs.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index a49a7d2e86ccad..e63e2c85800196 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -1056,24 +1056,24 @@ fs.symlinkSync = function(target, path, type) { type); }; -fs.link = function(srcpath, dstpath, callback) { +fs.link = function(existingPath, newPath, callback) { callback = makeCallback(callback); - if (!nullCheck(srcpath, callback)) return; - if (!nullCheck(dstpath, callback)) return; + if (!nullCheck(existingPath, callback)) return; + if (!nullCheck(newPath, callback)) return; var req = new FSReqWrap(); req.oncomplete = callback; - binding.link(pathModule._makeLong(srcpath), - pathModule._makeLong(dstpath), + binding.link(pathModule._makeLong(existingPath), + pathModule._makeLong(newPath), req); }; -fs.linkSync = function(srcpath, dstpath) { - nullCheck(srcpath); - nullCheck(dstpath); - return binding.link(pathModule._makeLong(srcpath), - pathModule._makeLong(dstpath)); +fs.linkSync = function(existingPath, newPath) { + nullCheck(existingPath); + nullCheck(newPath); + return binding.link(pathModule._makeLong(existingPath), + pathModule._makeLong(newPath)); }; fs.unlink = function(path, callback) { From 65e27176f6462d0bdd526e1131e3aebd4d8edc6c Mon Sep 17 00:00:00 2001 From: cjihrig Date: Wed, 26 Oct 2016 22:12:47 -0400 Subject: [PATCH 264/313] test: add child_process customFds test This commit adds a test for spawn()'s deprecated customFds option. PR-URL: https://github.com/nodejs/node/pull/9307 Reviewed-By: Rich Trott Reviewed-By: Santiago Gimeno Reviewed-By: James M Snell --- .../parallel/test-child-process-custom-fds.js | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 test/parallel/test-child-process-custom-fds.js diff --git a/test/parallel/test-child-process-custom-fds.js b/test/parallel/test-child-process-custom-fds.js new file mode 100644 index 00000000000000..2958a6f8070722 --- /dev/null +++ b/test/parallel/test-child-process-custom-fds.js @@ -0,0 +1,33 @@ +'use strict'; +const common = require('../common'); +const assert = require('assert'); + +// Verify that customFds is used if stdio is not provided. +{ + const msg = 'child_process: options.customFds option is deprecated. ' + + 'Use options.stdio instead.'; + common.expectWarning('DeprecationWarning', msg); + + const customFds = [-1, process.stdout.fd, process.stderr.fd]; + const child = common.spawnSyncPwd({ customFds }); + + assert.deepStrictEqual(child.options.customFds, customFds); + assert.deepStrictEqual(child.options.stdio, [ + { type: 'pipe', readable: true, writable: false }, + { type: 'fd', fd: process.stdout.fd }, + { type: 'fd', fd: process.stderr.fd } + ]); +} + +// Verify that customFds is ignored when stdio is present. +{ + const customFds = [0, 1, 2]; + const child = common.spawnSyncPwd({ customFds, stdio: 'pipe' }); + + assert.deepStrictEqual(child.options.customFds, customFds); + assert.deepStrictEqual(child.options.stdio, [ + { type: 'pipe', readable: true, writable: false }, + { type: 'pipe', readable: false, writable: true }, + { type: 'pipe', readable: false, writable: true } + ]); +} From 9a526cb8fe9d67b5548bfcfb969698f2411eae68 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Wed, 26 Oct 2016 22:41:24 -0400 Subject: [PATCH 265/313] child_process: remove unreachable code _convertCustomFds() is only called from normalizeSpawnArguments(), which always provides an options object. Therefore, there is no need to check for options in _convertCustomFds(). PR-URL: https://github.com/nodejs/node/pull/9307 Reviewed-By: Rich Trott Reviewed-By: Santiago Gimeno Reviewed-By: James M Snell --- lib/child_process.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/child_process.js b/lib/child_process.js index 69afdbe68d3c0a..ad8842e520c3be 100644 --- a/lib/child_process.js +++ b/lib/child_process.js @@ -300,7 +300,7 @@ var _deprecatedCustomFds = internalUtil.deprecate(function(options) { 'Use options.stdio instead.'); function _convertCustomFds(options) { - if (options && options.customFds && !options.stdio) { + if (options.customFds && !options.stdio) { _deprecatedCustomFds(options); } } From 912cae626bb888441661e35ab5554dfe25cdef42 Mon Sep 17 00:00:00 2001 From: Nikolai Vavilov Date: Thu, 27 Oct 2016 20:49:21 +0300 Subject: [PATCH 266/313] doc: clarify eventType in fs.watch 'rename' is confusing, and it's not clear what "they" refers to. Fixes: https://github.com/nodejs/node/issues/9082 PR-URL: https://github.com/nodejs/node/pull/9318 Reviewed-By: Rich Trott Reviewed-By: James M Snell Reviewed-By: Roman Reiss --- doc/api/fs.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/api/fs.md b/doc/api/fs.md index 61ef6187258e50..490e1269d23848 100644 --- a/doc/api/fs.md +++ b/doc/api/fs.md @@ -1703,8 +1703,12 @@ The listener callback gets two arguments `(eventType, filename)`. `eventType` i `'rename'` or `'change'`, and `filename` is the name of the file which triggered the event. -Please note the listener callback is attached to the `'change'` event -fired by [`fs.FSWatcher`][], but they are not the same thing. +Note that on most platforms, `'rename'` is emitted whenever a filename appears +or disappears in the directory. + +Also note the listener callback is attached to the `'change'` event fired by +[`fs.FSWatcher`][], but it is not the same thing as the `'change'` value of +`eventType`. ### Caveats From 2ce6916ddcc31b49560198637c59c7349d828cbf Mon Sep 17 00:00:00 2001 From: cjihrig Date: Thu, 27 Oct 2016 17:37:40 -0400 Subject: [PATCH 267/313] events: remove unnecessary checks This commit removes two truthy checks for object properties that are immediately followed by a strict equality check. The other item in the comparison is guaranteed to be a function by this point in the code, so the truthy check is redundant. PR-URL: https://github.com/nodejs/node/pull/9330 Reviewed-By: Rich Trott Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- lib/events.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/events.js b/lib/events.js index 05f8a401f67519..ac18327ef147f6 100644 --- a/lib/events.js +++ b/lib/events.js @@ -326,7 +326,7 @@ EventEmitter.prototype.removeListener = if (!list) return this; - if (list === listener || (list.listener && list.listener === listener)) { + if (list === listener || list.listener === listener) { if (--this._eventsCount === 0) this._events = new EventHandlers(); else { @@ -338,8 +338,7 @@ EventEmitter.prototype.removeListener = position = -1; for (i = list.length; i-- > 0;) { - if (list[i] === listener || - (list[i].listener && list[i].listener === listener)) { + if (list[i] === listener || list[i].listener === listener) { originalListener = list[i].listener; position = i; break; From 3c09579eeeffd580d3d90069305c435d442551ee Mon Sep 17 00:00:00 2001 From: Adam Langley Date: Fri, 28 Oct 2016 13:21:51 -0700 Subject: [PATCH 268/313] crypto: use SSL_get_servername. (Patch by David Benjamin.) Rather than reach into the SSL_SESSION, use the intended API, SSL_get_servername. This will also help the transition to OpenSSL 1.1.0. Also don't fill in the tlsTicket field here. This is never read by oncertcb and was always false anyway; that field is maintained by clients and tracks whether the server issued a ticket or a session ID. (Note this is distinct from the copy passed to onclienthello which is used and is not a no-op.) PR-URL: https://github.com/nodejs/node/pull/9347 Reviewed-By: Fedor Indutny Reviewed-By: Shigeki Ohtsu Reviewed-By: Ben Noordhuis --- src/node_crypto.cc | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 532efdd41a5579..b83794a770d672 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -2321,18 +2321,13 @@ int SSLWrap::SSLCertCallback(SSL* s, void* arg) { Local info = Object::New(env->isolate()); - SSL_SESSION* sess = SSL_get_session(s); - if (sess != nullptr) { - if (sess->tlsext_hostname == nullptr) { - info->Set(env->servername_string(), String::Empty(env->isolate())); - } else { - Local servername = OneByteString(env->isolate(), - sess->tlsext_hostname, - strlen(sess->tlsext_hostname)); - info->Set(env->servername_string(), servername); - } - info->Set(env->tls_ticket_string(), - Boolean::New(env->isolate(), sess->tlsext_ticklen != 0)); + const char* servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); + if (servername == nullptr) { + info->Set(env->servername_string(), String::Empty(env->isolate())); + } else { + Local str = OneByteString(env->isolate(), servername, + strlen(servername)); + info->Set(env->servername_string(), str); } bool ocsp = false; From 66687c09063d298ec8b0af0ff23e4a1f71f29afa Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Sun, 30 Oct 2016 23:40:54 +1100 Subject: [PATCH 269/313] build: prioritise --shared-X-Y over pkg-config PR-URL: https://github.com/nodejs/node/pull/9368 Reviewed-By: Johan Bergstrom Reviewed-By: Ben Noordhuis --- configure | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/configure b/configure index efcf89336edded..6a50e5e8e1b6e2 100755 --- a/configure +++ b/configure @@ -884,26 +884,26 @@ def configure_library(lib, output): if getattr(options, shared_lib): (pkg_libs, pkg_cflags, pkg_libpath) = pkg_config(lib) - if pkg_cflags: + if options.__dict__[shared_lib + '_includes']: + output['include_dirs'] += [options.__dict__[shared_lib + '_includes']] + elif pkg_cflags: output['include_dirs'] += ( filter(None, map(str.strip, pkg_cflags.split('-I')))) - elif options.__dict__[shared_lib + '_includes']: - output['include_dirs'] += [options.__dict__[shared_lib + '_includes']] # libpath needs to be provided ahead libraries - if pkg_libpath: - output['libraries'] += [pkg_libpath] - elif options.__dict__[shared_lib + '_libpath']: + if options.__dict__[shared_lib + '_libpath']: output['libraries'] += [ '-L%s' % options.__dict__[shared_lib + '_libpath']] + elif pkg_libpath: + output['libraries'] += [pkg_libpath] default_libs = getattr(options, shared_lib + '_libname') default_libs = map('-l{0}'.format, default_libs.split(',')) - if pkg_libs: - output['libraries'] += pkg_libs.split() - elif default_libs: + if default_libs: output['libraries'] += default_libs + elif pkg_libs: + output['libraries'] += pkg_libs.split() def configure_v8(o): From a5d27f3515753e8a9b96c8cf97154318cfd4e621 Mon Sep 17 00:00:00 2001 From: Roman Reiss Date: Tue, 1 Nov 2016 22:59:39 +0100 Subject: [PATCH 270/313] tools: enable final newline in .editorconfig PR-URL: https://github.com/nodejs/node/pull/9410 Fixes: https://github.com/nodejs/node/issues/9402 Reviewed-By: Luigi Pinca Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Gibson Fahnestock Reviewed-By: James M Snell Reviewed-By: Minwoo Jung --- .editorconfig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.editorconfig b/.editorconfig index a1df58daf869c8..1c1b4418547481 100644 --- a/.editorconfig +++ b/.editorconfig @@ -4,6 +4,7 @@ root = true end_of_line = lf charset = utf-8 trim_trailing_whitespace = true +insert_final_newline = true [vcbuild.bat] end_of_line = crlf @@ -34,3 +35,6 @@ indent_size = ignore end_of_line = ignore trim_trailing_whitespace = ignore charset = ignore + +[{test/fixtures,deps,tools/eslint,tools/gyp,tools/icu,tools/msvs}/**] +insert_final_newline = false From 98b2eae328e7593aaf6fe78b8e7e5e2bbe0ee0dd Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 6 Nov 2016 16:47:41 -0800 Subject: [PATCH 271/313] benchmark: split timers benchmark and refactor The depth benchmark for timers sets a timer that sets a timer that sets a timer that... 500K of them. Since each timer has to wait for the next tick of the event loop this benchmark takes a very long time to run compared to the breadth test that is already in the file. This may be more of an event loop benchmark than a timer benchmark. Reduce the number of iterations for the depth test as it's really just running the iterations in sequence, not in parallel. And even on an infinitely fast machine, it would take over 8 minutes to run because each tick of the event loop would have to wait 1ms before firing the timer. Split the depth and breadth benchmarks so that their `N` values can be set independently. Do some minor refactoring to the benchmarks (but no ES6 additions so that the benchmarks can still be run with old versions of Node.js). Refs: https://github.com/nodejs/node/issues/9493 PR-URL: https://github.com/nodejs/node/pull/9497 Reviewed-By: Andreas Madsen Reviewed-By: Colin Ihrig Reviewed-By: Jeremiah Senkpiel --- benchmark/timers/timers-breadth.js | 20 +++++++++++++++ benchmark/timers/timers-depth.js | 20 +++++++++++++++ benchmark/timers/timers.js | 41 ------------------------------ 3 files changed, 40 insertions(+), 41 deletions(-) create mode 100644 benchmark/timers/timers-breadth.js create mode 100644 benchmark/timers/timers-depth.js delete mode 100644 benchmark/timers/timers.js diff --git a/benchmark/timers/timers-breadth.js b/benchmark/timers/timers-breadth.js new file mode 100644 index 00000000000000..1101ee7dbf8907 --- /dev/null +++ b/benchmark/timers/timers-breadth.js @@ -0,0 +1,20 @@ +'use strict'; +var common = require('../common.js'); + +var bench = common.createBenchmark(main, { + thousands: [500], +}); + +function main(conf) { + var N = +conf.thousands * 1e3; + var n = 0; + bench.start(); + function cb() { + n++; + if (n === N) + bench.end(N / 1e3); + } + for (var i = 0; i < N; i++) { + setTimeout(cb, 1); + } +} diff --git a/benchmark/timers/timers-depth.js b/benchmark/timers/timers-depth.js new file mode 100644 index 00000000000000..d5efc5c672d502 --- /dev/null +++ b/benchmark/timers/timers-depth.js @@ -0,0 +1,20 @@ +'use strict'; +var common = require('../common.js'); + +var bench = common.createBenchmark(main, { + thousands: [1], +}); + +function main(conf) { + var N = +conf.thousands * 1e3; + var n = 0; + bench.start(); + setTimeout(cb, 1); + function cb() { + n++; + if (n === N) + bench.end(N / 1e3); + else + setTimeout(cb, 1); + } +} diff --git a/benchmark/timers/timers.js b/benchmark/timers/timers.js deleted file mode 100644 index 13b18fffc5ead7..00000000000000 --- a/benchmark/timers/timers.js +++ /dev/null @@ -1,41 +0,0 @@ -'use strict'; -var common = require('../common.js'); - -var bench = common.createBenchmark(main, { - thousands: [500], - type: ['depth', 'breadth'] -}); - -function main(conf) { - var n = +conf.thousands * 1e3; - if (conf.type === 'breadth') - breadth(n); - else - depth(n); -} - -function depth(N) { - var n = 0; - bench.start(); - setTimeout(cb); - function cb() { - n++; - if (n === N) - bench.end(N / 1e3); - else - setTimeout(cb); - } -} - -function breadth(N) { - var n = 0; - bench.start(); - function cb() { - n++; - if (n === N) - bench.end(N / 1e3); - } - for (var i = 0; i < N; i++) { - setTimeout(cb); - } -} From d2a1a670e10aa9f6f6b0c24687523123ba6c59b5 Mon Sep 17 00:00:00 2001 From: imatvieiev Date: Mon, 7 Nov 2016 23:23:41 +0200 Subject: [PATCH 272/313] doc: add process api data types to documentation PR-URL: https://github.com/nodejs/node/pull/9505 Reviewed-By: Luigi Pinca Reviewed-By: Brian White Reviewed-By: Colin Ihrig Reviewed-By: Michael Dawson Reviewed-By: Roman Reiss --- doc/api/process.md | 58 ++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 56 insertions(+), 2 deletions(-) diff --git a/doc/api/process.md b/doc/api/process.md index e47a95a2226b9f..44417e15384d5c 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -447,6 +447,8 @@ generate a core file. added: v0.5.0 --> +* {String} + The `process.arch` property returns a String identifying the processor architecture that the Node.js process is currently running on. For instance `'arm'`, `'ia32'`, or `'x64'`. @@ -460,6 +462,8 @@ console.log(`This processor architecture is ${process.arch}`); added: v0.1.27 --> +* {Array} + The `process.argv` property returns an array containing the command line arguments passed when the Node.js process was launched. The first element will be [`process.execPath`]. See `process.argv0` if access to the original value of @@ -497,6 +501,8 @@ Would generate the output: added: 6.4.0 --> +* {String} + The `process.argv0` property stores a read-only copy of the original value of `argv[0]` passed when Node.js starts. @@ -535,6 +541,8 @@ catch (err) { added: v0.7.7 --> +* {Object} + The `process.config` property returns an Object containing the JavaScript representation of the configure options used to compile the current Node.js executable. This is the same as the `config.gypi` file that was produced when @@ -578,6 +586,8 @@ replace the value of `process.config`. added: v0.7.2 --> +* {Boolean} + If the Node.js process is spawned with an IPC channel (see the [Child Process][] and [Cluster][] documentation), the `process.connected` property will return `true` so long as the IPC channel is connected and will return `false` after @@ -593,6 +603,9 @@ added: v6.1.0 * `previousValue` {Object} A previous return value from calling `process.cpuUsage()` +* Return: {Object} + * `user` {Integer} + * `system` {Integer} The `process.cpuUsage()` method returns the user and system CPU time usage of the current process, in an object with properties `user` and `system`, whose @@ -620,6 +633,8 @@ console.log(process.cpuUsage(startUsage)); added: v0.1.8 --> +* Return: {String} + The `process.cwd()` method returns the current working directory of the Node.js process. @@ -648,6 +663,8 @@ If the Node.js process was not spawned with an IPC channel, added: v0.1.27 --> +* {Object} + The `process.env` property returns an object containing the user environment. See environ(7). @@ -812,6 +829,8 @@ emitMyWarning(); added: v0.7.7 --> +* {Object} + The `process.execArgv` property returns the set of Node.js-specific command-line options passed when the Node.js process was launched. These options do not appear in the array returned by the [`process.argv`][] property, and do not @@ -842,13 +861,15 @@ And `process.argv`: added: v0.1.100 --> +* {String} + The `process.execPath` property returns the absolute pathname of the executable that started the Node.js process. For example: -```sh -/usr/local/bin/node +```js +'/usr/local/bin/node' ``` @@ -921,6 +942,8 @@ is safer than calling `process.exit()`. added: v0.11.8 --> +* {Integer} + A number which will be the process exit code, when the process either exits gracefully, or is exited via [`process.exit()`][] without specifying a code. @@ -951,6 +974,8 @@ or Android) added: v2.0.0 --> +* Return: {Object} + The `process.geteuid()` method returns the numerical effective user identity of the process. (See geteuid(2).) @@ -968,6 +993,8 @@ Android) added: v0.1.31 --> +* Return: {Object} + The `process.getgid()` method returns the numerical group identity of the process. (See getgid(2).) @@ -986,6 +1013,8 @@ Android) added: v0.9.4 --> +* Return: {Array} + The `process.getgroups()` method returns an array with the supplementary group IDs. POSIX leaves it unspecified if the effective group ID is included but Node.js ensures it always is. @@ -998,6 +1027,8 @@ Android) added: v0.1.28 --> +* Return: {Integer} + The `process.getuid()` method returns the numeric user identity of the process. (See getuid(2).) @@ -1130,6 +1161,11 @@ is no entry script. added: v0.1.16 --> +* Return: {Object} + * `rss` {Integer} + * `heapTotal` {Integer} + * `heapUsed` {Integer} + The `process.memoryUsage()` method returns an object describing the memory usage of the Node.js process measured in bytes. @@ -1247,6 +1283,8 @@ happening, just like a `while(true);` loop. added: v0.1.15 --> +* {Integer} + The `process.pid` property returns the PID of the process. ```js @@ -1258,6 +1296,8 @@ console.log(`This process is pid ${process.pid}`); added: v0.1.16 --> +* {String} + The `process.platform` property returns a string identifying the operating system platform on which the Node.js process is running. For instance `'darwin'`, `'freebsd'`, `'linux'`, `'sunos'` or `'win32'` @@ -1465,6 +1505,8 @@ Android) ## process.stderr +* {Stream} + The `process.stderr` property returns a [Writable][] stream equivalent to or associated with `stderr` (fd `2`). @@ -1485,6 +1527,8 @@ on `process.stderr`, `process.stdout`, or `process.stdin`: ## process.stdin +* {Stream} + The `process.stdin` property returns a [Readable][] stream equivalent to or associated with `stdin` (fd `0`). @@ -1515,6 +1559,8 @@ must call `process.stdin.resume()` to read from it. Note also that calling ## process.stdout +* {Stream} + The `process.stdout` property returns a [Writable][] stream equivalent to or associated with `stdout` (fd `1`). @@ -1570,6 +1616,8 @@ See the [TTY][] documentation for more information. added: v0.1.104 --> +* {String} + The `process.title` property returns the current process title (i.e. returns the current value of `ps`). Assigning a new value to `process.title` modifies the current value of `ps`. @@ -1609,6 +1657,8 @@ console.log( added: v0.5.0 --> +* Return: {Number} + The `process.uptime()` method returns the number of seconds the current Node.js process has been running. @@ -1617,6 +1667,8 @@ process has been running. added: v0.1.3 --> +* {String} + The `process.version` property returns the Node.js version string. ```js @@ -1628,6 +1680,8 @@ console.log(`Version: ${process.version}`); added: v0.2.0 --> +* {Object} + The `process.versions` property returns an object listing the version strings of Node.js and its dependencies. From c87ccfa3c3a23c1f8c958e6313f380d3d2e553d1 Mon Sep 17 00:00:00 2001 From: imatvieiev Date: Tue, 8 Nov 2016 20:00:30 +0200 Subject: [PATCH 273/313] doc: added types to path docs PR-URL: https://github.com/nodejs/node/pull/9514 Reviewed-By: Roman Reiss --- doc/api/path.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/doc/api/path.md b/doc/api/path.md index 452e3d66c5b854..68356fac22f5ff 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -61,6 +61,7 @@ added: v0.1.25 * `path` {String} * `ext` {String} An optional file extension +* Return: {String} The `path.basename()` methods returns the last portion of a `path`, similar to the Unix `basename` command. @@ -83,6 +84,8 @@ and is not a string. added: v0.9.3 --> +* {String} + Provides the platform-specific path delimiter: * `;` for Windows @@ -114,6 +117,7 @@ added: v0.1.16 --> * `path` {String} +* Return: {String} The `path.dirname()` method returns the directory name of a `path`, similar to the Unix `dirname` command. @@ -133,6 +137,7 @@ added: v0.1.25 --> * `path` {String} +* Return: {String} The `path.extname()` method returns the extension of the `path`, from the last occurrence of the `.` (period) character to end of string in the last portion of @@ -168,10 +173,11 @@ added: v0.11.15 * `pathObject` {Object} * `dir` {String} - * `root` {String} + * `root` {String} * `base` {String} * `name` {String} * `ext` {String} +* Return: {String} The `path.format()` method returns a path string from an object. This is the opposite of [`path.parse()`][]. @@ -244,6 +250,7 @@ added: v0.11.2 --> * `path` {String} +* Return: {Boolean} The `path.isAbsolute()` method determines if `path` is an absolute path. @@ -278,6 +285,7 @@ added: v0.1.16 --> * `...paths` {String} A sequence of path segments +* Return: {String} The `path.join()` method joins all given `path` segments together using the platform specific separator as a delimiter, then normalizes the resulting path. @@ -304,6 +312,7 @@ added: v0.1.23 --> * `path` {String} +* Return: {String} The `path.normalize()` method normalizes the given `path`, resolving `'..'` and `'.'` segments. @@ -337,6 +346,7 @@ added: v0.11.15 --> * `path` {String} +* Return: {Object} The `path.parse()` method returns an object whose properties represent significant elements of the `path`. @@ -404,6 +414,8 @@ A [`TypeError`][] is thrown if `path` is not a string. added: v0.11.15 --> +* {Object} + The `path.posix` property provides access to POSIX specific implementations of the `path` methods. @@ -414,6 +426,7 @@ added: v0.5.0 * `from` {String} * `to` {String} +* Return: {String} The `path.relative()` method returns the relative path from `from` to `to`. If `from` and `to` each resolve to the same path (after calling `path.resolve()` @@ -444,6 +457,7 @@ added: v0.3.4 --> * `...paths` {String} A sequence of paths or path segments +* Return: {String} The `path.resolve()` method resolves a sequence of paths or path segments into an absolute path. @@ -485,6 +499,8 @@ A [`TypeError`][] is thrown if any of the arguments is not a string. added: v0.7.9 --> +* {String} + Provides the platform-specific path segment separator: * `\` on Windows @@ -509,6 +525,8 @@ On Windows: added: v0.11.15 --> +* {Object} + The `path.win32` property provides access to Windows-specific implementations of the `path` methods. From d33520cdd2694485216c0feb0ec7f6c6f508dca6 Mon Sep 17 00:00:00 2001 From: Roman Reiss Date: Fri, 11 Nov 2016 21:29:01 +0100 Subject: [PATCH 274/313] doc: consistent 'Returns:' For consistency, changed all `Return:` to `Returns:` in the API docs. PR-URL: https://github.com/nodejs/node/pull/9554 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Jeremiah Senkpiel --- doc/api/buffer.md | 84 ++++++++++++++++++++-------------------- doc/api/child_process.md | 8 ++-- doc/api/cluster.md | 2 +- doc/api/modules.md | 2 +- doc/api/path.md | 20 +++++----- doc/api/process.md | 18 ++++----- doc/api/stream.md | 10 ++--- 7 files changed, 72 insertions(+), 72 deletions(-) diff --git a/doc/api/buffer.md b/doc/api/buffer.md index 9bc6cfdc8a2b4d..566d4484c7125c 100644 --- a/doc/api/buffer.md +++ b/doc/api/buffer.md @@ -612,7 +612,7 @@ added: v0.1.90 calculate the length of * `encoding` {String} If `string` is a string, this is its encoding. **Default:** `'utf8'` -* Return: {Integer} The number of bytes contained within `string` +* Returns: {Integer} The number of bytes contained within `string` Returns the actual byte length of a string. This is not the same as [`String.prototype.length`] since that returns the number of *characters* in @@ -640,7 +640,7 @@ added: v0.11.13 * `buf1` {Buffer} * `buf2` {Buffer} -* Return: {Integer} +* Returns: {Integer} Compares `buf1` to `buf2` typically for the purpose of sorting arrays of `Buffer` instances. This is equivalent to calling @@ -666,7 +666,7 @@ added: v0.7.11 * `list` {Array} List of `Buffer` instances to concat * `totalLength` {Integer} Total length of the `Buffer` instances in `list` when concatenated -* Return: {Buffer} +* Returns: {Buffer} Returns a new `Buffer` which is the result of concatenating all the `Buffer` instances in the `list` together. @@ -831,7 +831,7 @@ added: v0.1.101 --> * `obj` {Object} -* Return: {Boolean} +* Returns: {Boolean} Returns `true` if `obj` is a `Buffer`, `false` otherwise. @@ -841,7 +841,7 @@ added: v0.9.1 --> * `encoding` {String} A character encoding name to check -* Return: {Boolean} +* Returns: {Boolean} Returns `true` if `encoding` contains a supported character encoding, or `false` otherwise. @@ -896,7 +896,7 @@ added: v0.11.13 * `sourceEnd` {Integer} The offset within `buf` at which to end comparison (not inclusive). Ignored when `targetStart` is `undefined`. **Default:** [`buf.length`] -* Return: {Integer} +* Returns: {Integer} Compares `buf` with `target` and returns a number indicating whether `buf` comes before, after, or is the same as `target` in sort order. @@ -968,7 +968,7 @@ added: v0.1.90 Ignored when `targetStart` is `undefined`. **Default:** `0` * `sourceEnd` {Integer} The offset within `buf` at which to stop copying (not inclusive). Ignored when `sourceStart` is `undefined`. **Default:** [`buf.length`] -* Return: {Integer} The number of bytes copied. +* Returns: {Integer} The number of bytes copied. Copies data from a region of `buf` to a region in `target` even if the `target` memory region overlaps with `buf`. @@ -1013,7 +1013,7 @@ console.log(buf.toString()); added: v1.1.0 --> -* Return: {Iterator} +* Returns: {Iterator} Creates and returns an [iterator] of `[index, byte]` pairs from the contents of `buf`. @@ -1041,7 +1041,7 @@ added: v0.11.13 --> * `otherBuffer` {Buffer} A `Buffer` to compare to -* Return: {Boolean} +* Returns: {Boolean} Returns `true` if both `buf` and `otherBuffer` have exactly the same bytes, `false` otherwise. @@ -1070,7 +1070,7 @@ added: v0.5.0 * `end` {Integer} Where to stop filling `buf` (not inclusive). **Default:** [`buf.length`] * `encoding` {String} If `value` is a string, this is its encoding. **Default:** `'utf8'` -* Return: {Buffer} A reference to `buf` +* Returns: {Buffer} A reference to `buf` Fills `buf` with the specified `value`. If the `offset` and `end` are not given, the entire `buf` will be filled. This is meant to be a small simplification to @@ -1106,7 +1106,7 @@ added: v1.5.0 * `byteOffset` {Integer} Where to begin searching in `buf`. **Default:** `0` * `encoding` {String} If `value` is a string, this is its encoding. **Default:** `'utf8'` -* Return: {Integer} The index of the first occurrence of `value` in `buf` or `-1` +* Returns: {Integer} The index of the first occurrence of `value` in `buf` or `-1` if `buf` does not contain `value` If `value` is: @@ -1161,7 +1161,7 @@ added: v5.3.0 * `byteOffset` {Integer} Where to begin searching in `buf`. **Default:** `0` * `encoding` {String} If `value` is a string, this is its encoding. **Default:** `'utf8'` -* Return: {Boolean} `true` if `value` was found in `buf`, `false` otherwise +* Returns: {Boolean} `true` if `value` was found in `buf`, `false` otherwise Equivalent to [`buf.indexOf() !== -1`][`buf.indexOf()`]. @@ -1198,7 +1198,7 @@ console.log(buf.includes('this', 4)); added: v1.1.0 --> -* Return: {Iterator} +* Returns: {Iterator} Creates and returns an [iterator] of `buf` keys (indices). @@ -1229,7 +1229,7 @@ added: v6.0.0 **Default:** [`buf.length`] * `encoding` {String} If `value` is a string, this is its encoding. **Default:** `'utf8'` -* Return: {Integer} The index of the last occurrence of `value` in `buf` or `-1` +* Returns: {Integer} The index of the last occurrence of `value` in `buf` or `-1` if `buf` does not contain `value` Identical to [`buf.indexOf()`], except `buf` is searched from back to front @@ -1325,7 +1325,7 @@ added: v0.11.15 * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 8` * `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` -* Return: {Number} +* Returns: {Number} Reads a 64-bit double from `buf` at the specified `offset` with specified endian format (`readDoubleBE()` returns big endian, `readDoubleLE()` returns @@ -1361,7 +1361,7 @@ added: v0.11.15 * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4` * `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` -* Return: {Number} +* Returns: {Number} Reads a 32-bit float from `buf` at the specified `offset` with specified endian format (`readFloatBE()` returns big endian, `readFloatLE()` returns @@ -1396,7 +1396,7 @@ added: v0.5.0 * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1` * `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` -* Return: {Integer} +* Returns: {Integer} Reads a signed 8-bit integer from `buf` at the specified `offset`. @@ -1428,7 +1428,7 @@ added: v0.5.5 * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2` * `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` -* Return: {Integer} +* Returns: {Integer} Reads a signed 16-bit integer from `buf` at the specified `offset` with the specified endian format (`readInt16BE()` returns big endian, @@ -1462,7 +1462,7 @@ added: v0.5.5 * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4` * `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` -* Return: {Integer} +* Returns: {Integer} Reads a signed 32-bit integer from `buf` at the specified `offset` with the specified endian format (`readInt32BE()` returns big endian, @@ -1497,7 +1497,7 @@ added: v0.11.15 * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength` * `byteLength` {Integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6` * `noAssert` {Boolean} Skip `offset` and `byteLength` validation? **Default:** `false` -* Return: {Integer} +* Returns: {Integer} Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as a two's complement signed value. Supports up to 48 @@ -1528,7 +1528,7 @@ added: v0.5.0 * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 1` * `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` -* Return: {Integer} +* Returns: {Integer} Reads an unsigned 8-bit integer from `buf` at the specified `offset`. @@ -1558,7 +1558,7 @@ added: v0.5.5 * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 2` * `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` -* Return: {Integer} +* Returns: {Integer} Reads an unsigned 16-bit integer from `buf` at the specified `offset` with specified endian format (`readUInt16BE()` returns big endian, `readUInt16LE()` @@ -1596,7 +1596,7 @@ added: v0.5.5 * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - 4` * `noAssert` {Boolean} Skip `offset` validation? **Default:** `false` -* Return: {Integer} +* Returns: {Integer} Reads an unsigned 32-bit integer from `buf` at the specified `offset` with specified endian format (`readUInt32BE()` returns big endian, @@ -1629,7 +1629,7 @@ added: v0.11.15 * `offset` {Integer} Where to start reading. Must satisfy: `0 <= offset <= buf.length - byteLength` * `byteLength` {Integer} How many bytes to read. Must satisfy: `0 < byteLength <= 6` * `noAssert` {Boolean} Skip `offset` and `byteLength` validation? **Default:** `false` -* Return: {Integer} +* Returns: {Integer} Reads `byteLength` number of bytes from `buf` at the specified `offset` and interprets the result as an unsigned integer. Supports up to 48 @@ -1661,7 +1661,7 @@ added: v0.3.0 * `start` {Integer} Where the new `Buffer` will start. **Default:** `0` * `end` {Integer} Where the new `Buffer` will end (not inclusive). **Default:** [`buf.length`] -* Return: {Buffer} +* Returns: {Buffer} Returns a new `Buffer` that references the same memory as the original, but offset and cropped by the `start` and `end` indices. @@ -1717,7 +1717,7 @@ console.log(buf.slice(-5, -2).toString()); added: v5.10.0 --> -* Return: {Buffer} A reference to `buf` +* Returns: {Buffer} A reference to `buf` Interprets `buf` as an array of unsigned 16-bit integers and swaps the byte-order *in-place*. Throws a `RangeError` if [`buf.length`] is not a multiple of 2. @@ -1747,7 +1747,7 @@ buf2.swap32(); added: v5.10.0 --> -* Return: {Buffer} A reference to `buf` +* Returns: {Buffer} A reference to `buf` Interprets `buf` as an array of unsigned 32-bit integers and swaps the byte-order *in-place*. Throws a `RangeError` if [`buf.length`] is not a multiple of 4. @@ -1777,7 +1777,7 @@ buf2.swap32(); added: v6.3.0 --> -* Return: {Buffer} A reference to `buf` +* Returns: {Buffer} A reference to `buf` Interprets `buf` as an array of 64-bit numbers and swaps the byte-order *in-place*. Throws a `RangeError` if [`buf.length`] is not a multiple of 8. @@ -1814,7 +1814,7 @@ added: v0.1.90 * `start` {Integer} The byte offset to start decoding at. **Default:** `0` * `end` {Integer} The byte offset to stop decoding at (not inclusive). **Default:** [`buf.length`] -* Return: {String} +* Returns: {String} Decodes `buf` to a string according to the specified character encoding in `encoding`. `start` and `end` may be passed to decode only a subset of `buf`. @@ -1853,7 +1853,7 @@ console.log(buf2.toString(undefined, 0, 3)); added: v0.9.2 --> -* Return: {Object} +* Returns: {Object} Returns a JSON representation of `buf`. [`JSON.stringify()`] implicitly calls this function when stringifying a `Buffer` instance. @@ -1882,7 +1882,7 @@ console.log(copy); added: v1.1.0 --> -* Return: {Iterator} +* Returns: {Iterator} Creates and returns an [iterator] for `buf` values (bytes). This function is called automatically when a `Buffer` is used in a `for..of` statement. @@ -1924,7 +1924,7 @@ added: v0.1.90 * `offset` {Integer} Where to start writing `string`. **Default:** `0` * `length` {Integer} How many bytes to write. **Default:** `buf.length - offset` * `encoding` {String} The character encoding of `string`. **Default:** `'utf8'` -* Return: {Integer} Number of bytes written +* Returns: {Integer} Number of bytes written Writes `string` to `buf` at `offset` according to the character encoding in `encoding`. The `length` parameter is the number of bytes to write. If `buf` did not contain @@ -1951,7 +1951,7 @@ added: v0.11.15 * `value` {Number} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 8` * `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` -* Return: {Integer} `offset` plus the number of bytes written +* Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian format (`writeDoubleBE()` writes big endian, `writeDoubleLE()` writes little @@ -1986,7 +1986,7 @@ added: v0.11.15 * `value` {Number} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4` * `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` -* Return: {Integer} `offset` plus the number of bytes written +* Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian format (`writeFloatBE()` writes big endian, `writeFloatLE()` writes little @@ -2020,7 +2020,7 @@ added: v0.5.0 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1` * `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` -* Return: {Integer} `offset` plus the number of bytes written +* Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset`. `value` *should* be a valid signed 8-bit integer. Behavior is undefined when `value` is anything other than @@ -2052,7 +2052,7 @@ added: v0.5.5 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2` * `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` -* Return: {Integer} `offset` plus the number of bytes written +* Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian format (`writeInt16BE()` writes big endian, `writeInt16LE()` writes little @@ -2085,7 +2085,7 @@ added: v0.5.5 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4` * `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` -* Return: {Integer} `offset` plus the number of bytes written +* Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian format (`writeInt32BE()` writes big endian, `writeInt32LE()` writes little @@ -2120,7 +2120,7 @@ added: v0.11.15 * `byteLength` {Integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6` * `noAssert` {Boolean} Skip `value`, `offset`, and `byteLength` validation? **Default:** `false` -* Return: {Integer} `offset` plus the number of bytes written +* Returns: {Integer} `offset` plus the number of bytes written Writes `byteLength` bytes of `value` to `buf` at the specified `offset`. Supports up to 48 bits of accuracy. Behavior is undefined when `value` is @@ -2153,7 +2153,7 @@ added: v0.5.0 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 1` * `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` -* Return: {Integer} `offset` plus the number of bytes written +* Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset`. `value` *should* be a valid unsigned 8-bit integer. Behavior is undefined when `value` is anything @@ -2185,7 +2185,7 @@ added: v0.5.5 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 2` * `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` -* Return: {Integer} `offset` plus the number of bytes written +* Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian format (`writeUInt16BE()` writes big endian, `writeUInt16LE()` writes little @@ -2222,7 +2222,7 @@ added: v0.5.5 * `value` {Integer} Number to be written to `buf` * `offset` {Integer} Where to start writing. Must satisfy: `0 <= offset <= buf.length - 4` * `noAssert` {Boolean} Skip `value` and `offset` validation? **Default:** `false` -* Return: {Integer} `offset` plus the number of bytes written +* Returns: {Integer} `offset` plus the number of bytes written Writes `value` to `buf` at the specified `offset` with specified endian format (`writeUInt32BE()` writes big endian, `writeUInt32LE()` writes little @@ -2259,7 +2259,7 @@ added: v0.5.5 * `byteLength` {Integer} How many bytes to write. Must satisfy: `0 < byteLength <= 6` * `noAssert` {Boolean} Skip `value`, `offset`, and `byteLength` validation? **Default:** `false` -* Return: {Integer} `offset` plus the number of bytes written +* Returns: {Integer} `offset` plus the number of bytes written Writes `byteLength` bytes of `value` to `buf` at the specified `offset`. Supports up to 48 bits of accuracy. Behavior is undefined when `value` is diff --git a/doc/api/child_process.md b/doc/api/child_process.md index 7885677effa6b1..fdffa0fc5a95ca 100644 --- a/doc/api/child_process.md +++ b/doc/api/child_process.md @@ -144,7 +144,7 @@ added: v0.1.90 * `error` {Error} * `stdout` {String|Buffer} * `stderr` {String|Buffer} -* Return: {ChildProcess} +* Returns: {ChildProcess} Spawns a shell then executes the `command` within that shell, buffering any generated output. @@ -217,7 +217,7 @@ added: v0.1.91 * `error` {Error} * `stdout` {String|Buffer} * `stderr` {String|Buffer} -* Return: {ChildProcess} +* Returns: {ChildProcess} The `child_process.execFile()` function is similar to [`child_process.exec()`][] except that it does not spawn a shell. Rather, the specified executable `file` @@ -267,7 +267,7 @@ added: v0.5.0 be thrown. For instance `[0, 1, 2, 'ipc']`. * `uid` {Number} Sets the user identity of the process. (See setuid(2).) * `gid` {Number} Sets the group identity of the process. (See setgid(2).) -* Return: {ChildProcess} +* Returns: {ChildProcess} The `child_process.fork()` method is a special case of [`child_process.spawn()`][] used specifically to spawn new Node.js processes. @@ -891,7 +891,7 @@ added: v0.5.9 * `sendHandle` {Handle} * `options` {Object} * `callback` {Function} -* Return: {Boolean} +* Returns: {Boolean} When an IPC channel has been established between the parent and child ( i.e. when using [`child_process.fork()`][]), the `child.send()` method can be diff --git a/doc/api/cluster.md b/doc/api/cluster.md index 07fdfb67458dab..c323282d0f94b1 100644 --- a/doc/api/cluster.md +++ b/doc/api/cluster.md @@ -414,7 +414,7 @@ added: v0.7.0 * `message` {Object} * `sendHandle` {Handle} * `callback` {Function} -* Return: Boolean +* Returns: Boolean Send a message to a worker or master, optionally with a handle. diff --git a/doc/api/modules.md b/doc/api/modules.md index 892aea26081873..8b8a5d65918ecf 100644 --- a/doc/api/modules.md +++ b/doc/api/modules.md @@ -619,7 +619,7 @@ added: v0.5.1 --> * `id` {String} -* Return: {Object} `module.exports` from the resolved module +* Returns: {Object} `module.exports` from the resolved module The `module.require` method provides a way to load a module as if `require()` was called from the original module. diff --git a/doc/api/path.md b/doc/api/path.md index 68356fac22f5ff..fdd3063e69bf81 100644 --- a/doc/api/path.md +++ b/doc/api/path.md @@ -61,7 +61,7 @@ added: v0.1.25 * `path` {String} * `ext` {String} An optional file extension -* Return: {String} +* Returns: {String} The `path.basename()` methods returns the last portion of a `path`, similar to the Unix `basename` command. @@ -117,7 +117,7 @@ added: v0.1.16 --> * `path` {String} -* Return: {String} +* Returns: {String} The `path.dirname()` method returns the directory name of a `path`, similar to the Unix `dirname` command. @@ -137,7 +137,7 @@ added: v0.1.25 --> * `path` {String} -* Return: {String} +* Returns: {String} The `path.extname()` method returns the extension of the `path`, from the last occurrence of the `.` (period) character to end of string in the last portion of @@ -177,7 +177,7 @@ added: v0.11.15 * `base` {String} * `name` {String} * `ext` {String} -* Return: {String} +* Returns: {String} The `path.format()` method returns a path string from an object. This is the opposite of [`path.parse()`][]. @@ -250,7 +250,7 @@ added: v0.11.2 --> * `path` {String} -* Return: {Boolean} +* Returns: {Boolean} The `path.isAbsolute()` method determines if `path` is an absolute path. @@ -285,7 +285,7 @@ added: v0.1.16 --> * `...paths` {String} A sequence of path segments -* Return: {String} +* Returns: {String} The `path.join()` method joins all given `path` segments together using the platform specific separator as a delimiter, then normalizes the resulting path. @@ -312,7 +312,7 @@ added: v0.1.23 --> * `path` {String} -* Return: {String} +* Returns: {String} The `path.normalize()` method normalizes the given `path`, resolving `'..'` and `'.'` segments. @@ -346,7 +346,7 @@ added: v0.11.15 --> * `path` {String} -* Return: {Object} +* Returns: {Object} The `path.parse()` method returns an object whose properties represent significant elements of the `path`. @@ -426,7 +426,7 @@ added: v0.5.0 * `from` {String} * `to` {String} -* Return: {String} +* Returns: {String} The `path.relative()` method returns the relative path from `from` to `to`. If `from` and `to` each resolve to the same path (after calling `path.resolve()` @@ -457,7 +457,7 @@ added: v0.3.4 --> * `...paths` {String} A sequence of paths or path segments -* Return: {String} +* Returns: {String} The `path.resolve()` method resolves a sequence of paths or path segments into an absolute path. diff --git a/doc/api/process.md b/doc/api/process.md index 44417e15384d5c..a5e2a8a549ca70 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -603,7 +603,7 @@ added: v6.1.0 * `previousValue` {Object} A previous return value from calling `process.cpuUsage()` -* Return: {Object} +* Returns: {Object} * `user` {Integer} * `system` {Integer} @@ -633,7 +633,7 @@ console.log(process.cpuUsage(startUsage)); added: v0.1.8 --> -* Return: {String} +* Returns: {String} The `process.cwd()` method returns the current working directory of the Node.js process. @@ -974,7 +974,7 @@ or Android) added: v2.0.0 --> -* Return: {Object} +* Returns: {Object} The `process.geteuid()` method returns the numerical effective user identity of the process. (See geteuid(2).) @@ -993,7 +993,7 @@ Android) added: v0.1.31 --> -* Return: {Object} +* Returns: {Object} The `process.getgid()` method returns the numerical group identity of the process. (See getgid(2).) @@ -1013,7 +1013,7 @@ Android) added: v0.9.4 --> -* Return: {Array} +* Returns: {Array} The `process.getgroups()` method returns an array with the supplementary group IDs. POSIX leaves it unspecified if the effective group ID is included but @@ -1027,7 +1027,7 @@ Android) added: v0.1.28 --> -* Return: {Integer} +* Returns: {Integer} The `process.getuid()` method returns the numeric user identity of the process. (See getuid(2).) @@ -1161,7 +1161,7 @@ is no entry script. added: v0.1.16 --> -* Return: {Object} +* Returns: {Object} * `rss` {Integer} * `heapTotal` {Integer} * `heapUsed` {Integer} @@ -1363,7 +1363,7 @@ added: v0.5.9 * `sendHandle` {Handle object} * `options` {Object} * `callback` {Function} -* Return: {Boolean} +* Returns: {Boolean} If Node.js is spawned with an IPC channel, the `process.send()` method can be used to send messages to the parent process. Messages will be received as a @@ -1657,7 +1657,7 @@ console.log( added: v0.5.0 --> -* Return: {Number} +* Returns: {Number} The `process.uptime()` method returns the number of seconds the current Node.js process has been running. diff --git a/doc/api/stream.md b/doc/api/stream.md index 6669f23a254faf..6217e8e6dc02d2 100644 --- a/doc/api/stream.md +++ b/doc/api/stream.md @@ -381,7 +381,7 @@ added: v0.11.15 --> * `encoding` {String} The new default encoding -* Return: `this` +* Returns: `this` The `writable.setDefaultEncoding()` method sets the default `encoding` for a [Writable][] stream. @@ -689,7 +689,7 @@ preferred over the use of the `'readable'` event. added: v0.11.14 --> -* Return: {Boolean} +* Returns: {Boolean} The `readable.isPaused()` method returns the current operating state of the Readable. This is used primarily by the mechanism that underlies the @@ -711,7 +711,7 @@ readable.isPaused() // === false added: v0.9.4 --> -* Return: `this` +* Returns: `this` The `readable.pause()` method will cause a stream in flowing mode to stop emitting [`'data'`][] events, switching out of flowing mode. Any data that @@ -843,7 +843,7 @@ event has been emitted will return `null`. No runtime error will be raised. added: v0.9.4 --> -* Return: `this` +* Returns: `this` The `readable.resume()` method causes an explicitly paused Readable stream to resume emitting [`'data'`][] events, switching the stream into flowing mode. @@ -866,7 +866,7 @@ added: v0.9.4 --> * `encoding` {String} The encoding to use. -* Return: `this` +* Returns: `this` The `readable.setEncoding()` method sets the default character encoding for data read from the Readable stream. From 241470cfbe44f53177ef5047ec334cc7a782c734 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Wed, 16 Nov 2016 01:41:14 +0200 Subject: [PATCH 275/313] doc: small improvements in readline code examples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Consistent template literals in `console.log()`. 2. === instead of ==. 3. const instead of var. PR-URL: https://github.com/nodejs/node/pull/9628 Reviewed-By: Colin Ihrig Reviewed-By: Michael Dawson Reviewed-By: James M Snell Reviewed-By: Michaël Zasso Reviewed-By: Jackson Tian --- doc/api/readline.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/api/readline.md b/doc/api/readline.md index c5da92213064ec..32fad5732c70df 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -21,7 +21,7 @@ const rl = readline.createInterface({ rl.question('What do you think of Node.js? ', (answer) => { // TODO: Log the answer in a database - console.log('Thank you for your valuable feedback:', answer); + console.log(`Thank you for your valuable feedback: ${answer}`); rl.close(); }); @@ -403,8 +403,8 @@ For instance: `[[substr1, substr2, ...], originalsubstring]`. ```js function completer(line) { - var completions = '.help .error .exit .quit .q'.split(' '); - var hits = completions.filter((c) => { return c.indexOf(line) == 0 }); + const completions = '.help .error .exit .quit .q'.split(' '); + const hits = completions.filter((c) => { return c.indexOf(line) === 0 }); // show all completions if none found return [hits.length ? hits : completions, line]; } @@ -512,7 +512,7 @@ const rl = readline.createInterface({ }); rl.on('line', (line) => { - console.log('Line from file:', line); + console.log(`Line from file: ${line}`); }); ``` From acebfedf8040c86b07eec898fe132ce7f21e2a3a Mon Sep 17 00:00:00 2001 From: imatvieiev Date: Wed, 16 Nov 2016 22:52:05 +0200 Subject: [PATCH 276/313] doc: add return types and props types to OS module PR-URL: https://github.com/nodejs/node/pull/9648 Reviewed-By: Roman Reiss Reviewed-By: Colin Ihrig Reviewed-By: Michael Dawson Reviewed-By: James M Snell Reviewed-By: Prince John Wesley Reviewed-By: Luigi Pinca --- doc/api/os.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/doc/api/os.md b/doc/api/os.md index 6dbc732edcfa52..bfe20c1bef5c7f 100644 --- a/doc/api/os.md +++ b/doc/api/os.md @@ -14,6 +14,8 @@ const os = require('os'); added: v0.7.8 --> +* {String} + A string constant defining the operating system-specific end-of-line marker: * `\n` on POSIX @@ -35,6 +37,8 @@ Equivalent to [`process.arch`][]. ## os.constants +* {Object} + Returns an object containing commonly used operating system specific constants for error codes, process signals, and so on. The specific constants currently defined are described in [OS Constants][]. @@ -44,6 +48,8 @@ defined are described in [OS Constants][]. added: v0.3.3 --> +* Returns: {Array} + The `os.cpus()` method returns an array of objects containing information about each CPU/core installed. @@ -161,6 +167,8 @@ all processors are always 0. added: v0.9.4 --> +* Returns: {String} + The `os.endianness()` method returns a string identifying the endianness of the CPU *for which the Node.js binary was compiled*. @@ -174,6 +182,8 @@ Possible values are: added: v0.3.3 --> +* Returns: {Integer} + The `os.freemem()` method returns the amount of free system memory in bytes as an integer. @@ -182,6 +192,8 @@ an integer. added: v2.3.0 --> +* Returns: {String} + The `os.homedir()` method returns the home directory of the current user as a string. @@ -190,6 +202,8 @@ string. added: v0.3.3 --> +* Returns: {String} + The `os.hostname()` method returns the hostname of the operating system as a string. @@ -198,6 +212,8 @@ string. added: v0.3.3 --> +* Returns: {Array} + The `os.loadavg()` method returns an array containing the 1, 5, and 15 minute load averages. @@ -213,6 +229,8 @@ Windows platforms. On Windows, the return value is always `[0, 0, 0]`. added: v0.6.0 --> +* Returns: {Object} + The `os.networkInterfaces()` method returns an object containing only network interfaces that have been assigned a network address. @@ -272,6 +290,8 @@ The properties available on the assigned network address object include: added: v0.5.0 --> +* Returns: {String} + The `os.platform()` method returns a string identifying the operating system platform as set during compile time of Node.js. @@ -296,6 +316,8 @@ to be experimental at this time. added: v0.3.3 --> +* Returns: {String} + The `os.release()` method returns a string identifying the operating system release. @@ -308,6 +330,8 @@ https://en.wikipedia.org/wiki/Uname#Examples for more information. added: v0.9.9 --> +* Returns: {String} + The `os.tmpdir()` method returns a string specifying the operating system's default directory for temporary files. @@ -316,6 +340,8 @@ default directory for temporary files. added: v0.3.3 --> +* Returns: {Integer} + The `os.totalmem()` method returns the total amount of system memory in bytes as an integer. @@ -324,6 +350,8 @@ as an integer. added: v0.3.3 --> +* Returns: {String} + The `os.type()` method returns a string identifying the operating system name as returned by uname(3). For example `'Linux'` on Linux, `'Darwin'` on OS X and `'Windows_NT'` on Windows. @@ -336,6 +364,8 @@ information about the output of running uname(3) on various operating systems. added: v0.3.3 --> +* Returns: {Integer} + The `os.uptime()` method returns the system uptime in number of seconds. *Note*: Within Node.js' internals, this number is represented as a `double`. @@ -351,6 +381,7 @@ added: v6.0.0 * `encoding` {String} Character encoding used to interpret resulting strings. If `encoding` is set to `'buffer'`, the `username`, `shell`, and `homedir` values will be `Buffer` instances. (Default: 'utf8') +* Returns: {Object} The `os.userInfo()` method returns information about the currently effective user -- on POSIX platforms, this is typically a subset of the password file. The From 8bb66cd920ab5d02678cfe5c3425940f04017357 Mon Sep 17 00:00:00 2001 From: Jeremiah Senkpiel Date: Fri, 18 Nov 2016 15:47:15 -0500 Subject: [PATCH 277/313] timers: use consistent checks for canceled timers Previously not all codepaths set `timer._idleTimeout = -1` for canceled or closed timers, and not all codepaths checked it either. Unenroll uses this to say that a timer is indeed closed and it is the closest thing there is to an authoritative source for this. Refs: https://github.com/nodejs/node/pull/9606 Fixes: https://github.com/nodejs/node/issues/9561 PR-URL: https://github.com/nodejs/node/pull/9685 Reviewed-By: Rich Trott --- lib/timers.js | 16 +++++- .../test-timers-unenroll-unref-interval.js | 49 +++++++++++++++++++ 2 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 test/parallel/test-timers-unenroll-unref-interval.js diff --git a/lib/timers.js b/lib/timers.js index 78953f25d5a17e..56af3a92d6bfe2 100644 --- a/lib/timers.js +++ b/lib/timers.js @@ -384,6 +384,9 @@ function ontimeout(timer) { function rearm(timer) { + // // Do not re-arm unenroll'd or closed timers. + if (timer._idleTimeout === -1) return; + // If timer is unref'd (or was - it's permanently removed from the list.) if (timer._handle && timer instanceof Timeout) { timer._handle.start(timer._repeat); @@ -463,9 +466,17 @@ function Timeout(after, callback, args) { function unrefdHandle() { - ontimeout(this.owner); - if (!this.owner._repeat) + // Don't attempt to call the callback if it is not a function. + if (typeof this.owner._onTimeout === 'function') { + ontimeout(this.owner); + } + + // Make sure we clean up if the callback is no longer a function + // even if the timer is an interval. + if (!this.owner._repeat + || typeof this.owner._onTimeout !== 'function') { this.owner.close(); + } } @@ -505,6 +516,7 @@ Timeout.prototype.ref = function() { Timeout.prototype.close = function() { this._onTimeout = null; if (this._handle) { + this._idleTimeout = -1; this._handle[kOnTimeout] = null; this._handle.close(); } else { diff --git a/test/parallel/test-timers-unenroll-unref-interval.js b/test/parallel/test-timers-unenroll-unref-interval.js new file mode 100644 index 00000000000000..2c8a6a385d2304 --- /dev/null +++ b/test/parallel/test-timers-unenroll-unref-interval.js @@ -0,0 +1,49 @@ +'use strict'; + +const common = require('../common'); +const timers = require('timers'); + +{ + const interval = setInterval(common.mustCall(() => { + clearTimeout(interval); + }), 1).unref(); +} + +{ + const interval = setInterval(common.mustCall(() => { + interval.close(); + }), 1).unref(); +} + +{ + const interval = setInterval(common.mustCall(() => { + timers.unenroll(interval); + }), 1).unref(); +} + +{ + const interval = setInterval(common.mustCall(() => { + interval._idleTimeout = -1; + }), 1).unref(); +} + +{ + const interval = setInterval(common.mustCall(() => { + interval._onTimeout = null; + }), 1).unref(); +} + +// Use timers' intrinsic behavior to keep this open +// exactly long enough for the problem to manifest. +// +// See https://github.com/nodejs/node/issues/9561 +// +// Since this is added after it will always fire later +// than the previous timeouts, unrefed or not. +// +// Keep the event loop alive for one timeout and then +// another. Any problems will occur when the second +// should be called but before it is able to be. +setTimeout(common.mustCall(() => { + setTimeout(common.mustCall(() => {}), 1); +}), 1); From 272a97178d3d996b79a519319acb02c4293ed7d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sat, 26 Nov 2016 09:34:43 +0100 Subject: [PATCH 278/313] test: refactor and fix test-crypto * var -> const. * Group and sort imports. * Replace use of the deprecated crypto.createCredentials. * Fix incorrect use of string instead of RegExp in `throws` assertions. * Clone array with `.slice()` and remove dependency on util. * assert.notEqual -> assert.notStrictEqual. * indexOf -> includes. PR-URL: https://github.com/nodejs/node/pull/9807 Reviewed-By: Luigi Pinca Reviewed-By: Michael Dawson --- test/parallel/test-crypto.js | 87 ++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 44 deletions(-) diff --git a/test/parallel/test-crypto.js b/test/parallel/test-crypto.js index be3e7f4d5f2fb7..a79a6b247bd2bc 100644 --- a/test/parallel/test-crypto.js +++ b/test/parallel/test-crypto.js @@ -1,34 +1,33 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var util = require('util'); +const common = require('../common'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var crypto = require('crypto'); -crypto.DEFAULT_ENCODING = 'buffer'; +const assert = require('assert'); +const crypto = require('crypto'); +const fs = require('fs'); +const tls = require('tls'); -var fs = require('fs'); +crypto.DEFAULT_ENCODING = 'buffer'; // Test Certificates -var caPem = fs.readFileSync(common.fixturesDir + '/test_ca.pem', 'ascii'); -var certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii'); -var certPfx = fs.readFileSync(common.fixturesDir + '/test_cert.pfx'); -var keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii'); -var tls = require('tls'); +const caPem = fs.readFileSync(common.fixturesDir + '/test_ca.pem', 'ascii'); +const certPem = fs.readFileSync(common.fixturesDir + '/test_cert.pem', 'ascii'); +const certPfx = fs.readFileSync(common.fixturesDir + '/test_cert.pfx'); +const keyPem = fs.readFileSync(common.fixturesDir + '/test_key.pem', 'ascii'); // 'this' safety // https://github.com/joyent/node/issues/6690 assert.throws(function() { - var options = {key: keyPem, cert: certPem, ca: caPem}; - var credentials = crypto.createCredentials(options); - var context = credentials.context; - var notcontext = { setOptions: context.setOptions, setKey: context.setKey }; - crypto.createCredentials({ secureOptions: 1 }, notcontext); -}, TypeError); + const options = {key: keyPem, cert: certPem, ca: caPem}; + const credentials = tls.createSecureContext(options); + const context = credentials.context; + const notcontext = { setOptions: context.setOptions, setKey: context.setKey }; + tls.createSecureContext({ secureOptions: 1 }, notcontext); +}, /^TypeError: Illegal invocation$/); // PFX tests assert.doesNotThrow(function() { @@ -37,55 +36,55 @@ assert.doesNotThrow(function() { assert.throws(function() { tls.createSecureContext({pfx: certPfx}); -}, 'mac verify failure'); +}, /^Error: mac verify failure$/); assert.throws(function() { tls.createSecureContext({pfx: certPfx, passphrase: 'test'}); -}, 'mac verify failure'); +}, /^Error: mac verify failure$/); assert.throws(function() { tls.createSecureContext({pfx: 'sample', passphrase: 'test'}); -}, 'not enough data'); +}, /^Error: not enough data$/); // update() should only take buffers / strings assert.throws(function() { crypto.createHash('sha1').update({foo: 'bar'}); -}, /buffer/); +}, /^TypeError: Data must be a string or a buffer$/); function assertSorted(list) { // Array#sort() modifies the list in place so make a copy. - var sorted = util._extend([], list).sort(); + const sorted = list.slice().sort(); assert.deepStrictEqual(list, sorted); } // Assume that we have at least AES-128-CBC. -assert.notEqual(0, crypto.getCiphers().length); -assert.notEqual(-1, crypto.getCiphers().indexOf('aes-128-cbc')); -assert.equal(-1, crypto.getCiphers().indexOf('AES-128-CBC')); +assert.notStrictEqual(0, crypto.getCiphers().length); +assert(crypto.getCiphers().includes('aes-128-cbc')); +assert(!crypto.getCiphers().includes('AES-128-CBC')); assertSorted(crypto.getCiphers()); // Assume that we have at least AES256-SHA. -assert.notEqual(0, tls.getCiphers().length); -assert.notEqual(-1, tls.getCiphers().indexOf('aes256-sha')); -assert.equal(-1, tls.getCiphers().indexOf('AES256-SHA')); +assert.notStrictEqual(0, tls.getCiphers().length); +assert(tls.getCiphers().includes('aes256-sha')); +assert(!tls.getCiphers().includes('AES256-SHA')); assertSorted(tls.getCiphers()); // Assert that we have sha and sha1 but not SHA and SHA1. -assert.notEqual(0, crypto.getHashes().length); -assert.notEqual(-1, crypto.getHashes().indexOf('sha1')); -assert.notEqual(-1, crypto.getHashes().indexOf('sha')); -assert.equal(-1, crypto.getHashes().indexOf('SHA1')); -assert.equal(-1, crypto.getHashes().indexOf('SHA')); -assert.notEqual(-1, crypto.getHashes().indexOf('RSA-SHA1')); -assert.equal(-1, crypto.getHashes().indexOf('rsa-sha1')); +assert.notStrictEqual(0, crypto.getHashes().length); +assert(crypto.getHashes().includes('sha1')); +assert(crypto.getHashes().includes('sha')); +assert(!crypto.getHashes().includes('SHA1')); +assert(!crypto.getHashes().includes('SHA')); +assert(crypto.getHashes().includes('RSA-SHA1')); +assert(!crypto.getHashes().includes('rsa-sha1')); assertSorted(crypto.getHashes()); // Assume that we have at least secp384r1. -assert.notEqual(0, crypto.getCurves().length); -assert.notEqual(-1, crypto.getCurves().indexOf('secp384r1')); -assert.equal(-1, crypto.getCurves().indexOf('SECP384R1')); +assert.notStrictEqual(0, crypto.getCurves().length); +assert(crypto.getCurves().includes('secp384r1')); +assert(!crypto.getCurves().includes('SECP384R1')); assertSorted(crypto.getCurves()); // Regression tests for #5725: hex input that's not a power of two should @@ -100,18 +99,18 @@ assert.throws(function() { assert.throws(function() { crypto.createHash('sha1').update('0', 'hex'); -}, /Bad input string/); +}, /^TypeError: Bad input string$/); assert.throws(function() { crypto.createSign('RSA-SHA1').update('0', 'hex'); -}, /Bad input string/); +}, /^TypeError: Bad input string$/); assert.throws(function() { crypto.createVerify('RSA-SHA1').update('0', 'hex'); -}, /Bad input string/); +}, /^TypeError: Bad input string$/); assert.throws(function() { - var priv = [ + const priv = [ '-----BEGIN RSA PRIVATE KEY-----', 'MIGrAgEAAiEA+3z+1QNF2/unumadiwEr+C5vfhezsb3hp4jAnCNRpPcCAwEAAQIgQNriSQK4', 'EFwczDhMZp2dvbcz7OUUyt36z3S4usFPHSECEQD/41K7SujrstBfoCPzwC1xAhEA+5kt4BJy', @@ -121,7 +120,7 @@ assert.throws(function() { '' ].join('\n'); crypto.createSign('RSA-SHA256').update('test').sign(priv); -}, /digest too big for rsa key/); +}, /digest too big for rsa key$/); assert.throws(function() { // The correct header inside `test_bad_rsa_privkey.pem` should have been @@ -133,7 +132,7 @@ assert.throws(function() { // $ openssl pkcs8 -topk8 -inform PEM -outform PEM -in mykey.pem \ // -out private_key.pem -nocrypt; // Then open private_key.pem and change its header and footer. - var sha1_privateKey = fs.readFileSync(common.fixturesDir + + const sha1_privateKey = fs.readFileSync(common.fixturesDir + '/test_bad_rsa_privkey.pem', 'ascii'); // this would inject errors onto OpenSSL's error stack crypto.createSign('sha1').sign(sha1_privateKey); From e60cafdb3bd681335fc1efa76d36e1b33e61ea95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Wed, 21 Dec 2016 16:20:19 +0100 Subject: [PATCH 279/313] deps: backport f795a79 from upstream V8 Original commit message: Rewrite scopes in computed properties in destructured parameters While we properly handled scopes of initializers in destructured parameters, we never did the right thing for computed properties. This patch fixes that by factoring out PatternRewriter's scope rewriting logic and calls it for the computed property case. BUG=chromium:620119 Review-Url: https://codereview.chromium.org/2084103002 Cr-Commit-Position: refs/heads/master@{#37228} Fixes: https://github.com/nodejs/node/issues/10347 PR-URL: https://github.com/nodejs/node/pull/10386 Reviewed-By: Ben Noordhuis Reviewed-By: James M Snell --- deps/v8/src/parsing/parser.h | 2 + deps/v8/src/parsing/pattern-rewriter.cc | 64 +++++++++++-------- .../mjsunit/regress/regress-crbug-620119.js | 8 +++ 3 files changed, 48 insertions(+), 26 deletions(-) create mode 100644 deps/v8/test/mjsunit/regress/regress-crbug-620119.js diff --git a/deps/v8/src/parsing/parser.h b/deps/v8/src/parsing/parser.h index c82682e323671c..5df11e77a01337 100644 --- a/deps/v8/src/parsing/parser.h +++ b/deps/v8/src/parsing/parser.h @@ -880,6 +880,8 @@ class Parser : public ParserBase { PatternContext SetAssignmentContextIfNeeded(Expression* node); PatternContext SetInitializerContextIfNeeded(Expression* node); + void RewriteParameterScopes(Expression* expr); + Variable* CreateTempVar(Expression* value = nullptr); AstNodeFactory* factory() const { return parser_->factory(); } diff --git a/deps/v8/src/parsing/pattern-rewriter.cc b/deps/v8/src/parsing/pattern-rewriter.cc index 26d166d6190b33..0c1153aea15bb6 100644 --- a/deps/v8/src/parsing/pattern-rewriter.cc +++ b/deps/v8/src/parsing/pattern-rewriter.cc @@ -387,6 +387,37 @@ void Parser::PatternRewriter::VisitRewritableExpression( return set_context(old_context); } +// Two cases for scope rewriting the scope of default parameters: +// - Eagerly parsed arrow functions are initially parsed as having +// expressions in the enclosing scope, but when the arrow is encountered, +// need to be in the scope of the function. +// - When an extra declaration scope needs to be inserted to account for +// a sloppy eval in a default parameter or function body, the expressions +// needs to be in that new inner scope which was added after initial +// parsing. +// Each of these cases can be handled by rewriting the contents of the +// expression to the current scope. The source scope is typically the outer +// scope when one case occurs; when both cases occur, both scopes need to +// be included as the outer scope. (Both rewritings still need to be done +// to account for lazily parsed arrow functions which hit the second case.) +// TODO(littledan): Remove the outer_scope parameter of +// RewriteParameterInitializerScope +void Parser::PatternRewriter::RewriteParameterScopes(Expression* expr) { + if (!IsBindingContext()) return; + if (descriptor_->declaration_kind != DeclarationDescriptor::PARAMETER) return; + if (!scope()->is_arrow_scope() && !scope()->is_block_scope()) return; + + // Either this scope is an arrow scope or a declaration block scope. + DCHECK(scope()->is_declaration_scope()); + + if (scope()->outer_scope()->is_arrow_scope() && scope()->is_block_scope()) { + RewriteParameterInitializerScope(parser_->stack_limit(), expr, + scope()->outer_scope()->outer_scope(), + scope()); + } + RewriteParameterInitializerScope(parser_->stack_limit(), expr, + scope()->outer_scope(), scope()); +} void Parser::PatternRewriter::VisitObjectLiteral(ObjectLiteral* pattern, Variable** temp_var) { @@ -396,6 +427,11 @@ void Parser::PatternRewriter::VisitObjectLiteral(ObjectLiteral* pattern, for (ObjectLiteralProperty* property : *pattern->properties()) { PatternContext context = SetInitializerContextIfNeeded(property->value()); + + // Computed property names contain expressions which might require + // scope rewriting. + if (!property->key()->IsLiteral()) RewriteParameterScopes(property->key()); + RecurseIntoSubpattern( property->value(), factory()->NewProperty(factory()->NewVariableProxy(temp), @@ -668,32 +704,8 @@ void Parser::PatternRewriter::VisitAssignment(Assignment* node) { RelocInfo::kNoPosition); } - // Two cases for scope rewriting the scope of default parameters: - // - Eagerly parsed arrow functions are initially parsed as having - // initializers in the enclosing scope, but when the arrow is encountered, - // need to be in the scope of the function. - // - When an extra declaration scope needs to be inserted to account for - // a sloppy eval in a default parameter or function body, the initializer - // needs to be in that new inner scope which was added after initial - // parsing. - // Each of these cases can be handled by rewriting the contents of the - // initializer to the current scope. The source scope is typically the outer - // scope when one case occurs; when both cases occur, both scopes need to - // be included as the outer scope. (Both rewritings still need to be done - // to account for lazily parsed arrow functions which hit the second case.) - // TODO(littledan): Remove the outer_scope parameter of - // RewriteParameterInitializerScope - if (IsBindingContext() && - descriptor_->declaration_kind == DeclarationDescriptor::PARAMETER && - (scope()->is_arrow_scope() || scope()->is_block_scope())) { - if (scope()->outer_scope()->is_arrow_scope() && scope()->is_block_scope()) { - RewriteParameterInitializerScope(parser_->stack_limit(), initializer, - scope()->outer_scope()->outer_scope(), - scope()); - } - RewriteParameterInitializerScope(parser_->stack_limit(), initializer, - scope()->outer_scope(), scope()); - } + // Initializer may have been parsed in the wrong scope. + RewriteParameterScopes(initializer); PatternContext old_context = SetAssignmentContextIfNeeded(initializer); RecurseIntoSubpattern(node->target(), value); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-620119.js b/deps/v8/test/mjsunit/regress/regress-crbug-620119.js new file mode 100644 index 00000000000000..cbe5a78713d81b --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-620119.js @@ -0,0 +1,8 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --no-lazy + +assertEquals(0, ((x, {[(x = function() { y = 0 }, "foo")]: y = eval(1)}) => { x(); return y })(42, {})); +assertEquals(0, (function (x, {[(x = function() { y = 0 }, "foo")]: y = eval(1)}) { x(); return y })(42, {})); From e0579253161ba73233416c4d1fa48359fde02266 Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Tue, 6 Dec 2016 18:09:11 +0100 Subject: [PATCH 280/313] test: set stdin too for pseudo-tty tests Ref: https://github.com/nodejs/node/pull/10037 Ref: https://github.com/nodejs/node/pull/10146 PR-URL: https://github.com/nodejs/node/pull/10149 Reviewed-By: Jeremiah Senkpiel Reviewed-By: James M Snell Reviewed-By: Italo A. Casas Reviewed-By: Ben Noordhuis --- tools/test.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/test.py b/tools/test.py index 4a272475ccfffc..c8edca2b991ad2 100755 --- a/tools/test.py +++ b/tools/test.py @@ -683,11 +683,12 @@ def Execute(args, context, timeout=None, env={}, faketty=False): if faketty: import pty (out_master, fd_out) = pty.openpty() - fd_err = fd_out + fd_in = fd_err = fd_out pty_out = out_master else: (fd_out, outname) = tempfile.mkstemp() (fd_err, errname) = tempfile.mkstemp() + fd_in = 0 pty_out = None # Extend environment @@ -699,6 +700,7 @@ def Execute(args, context, timeout=None, env={}, faketty=False): context, timeout, args = args, + stdin = fd_in, stdout = fd_out, stderr = fd_err, env = env_copy, From b5c8b355c82e17b6e89d1e209fcad44c96566050 Mon Sep 17 00:00:00 2001 From: Jonathan Darling Date: Tue, 6 Dec 2016 10:20:08 -0600 Subject: [PATCH 281/313] test: add stdin-setrawmode.out file Adds an accompanying .out file for test/pseudo-tty/stdin-setrawmode.js. The test was originally merged without this file and an astute observer found that it was causing an error message. See discussion at https://github.com/nodejs/node/pull/10037. PR-URL: https://github.com/nodejs/node/pull/10149 Reviewed-By: Jeremiah Senkpiel Reviewed-By: James M Snell Reviewed-By: Italo A. Casas Reviewed-By: Ben Noordhuis --- test/pseudo-tty/stdin-setrawmode.out | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test/pseudo-tty/stdin-setrawmode.out diff --git a/test/pseudo-tty/stdin-setrawmode.out b/test/pseudo-tty/stdin-setrawmode.out new file mode 100644 index 00000000000000..e69de29bb2d1d6 From 3d368d0322064e6e1a6dd0e67e32b733dca8d833 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sat, 26 Nov 2016 10:20:05 +0100 Subject: [PATCH 282/313] test: refactor test-buffer-bytelength * assert.equal -> assert.strictEqual. PR-URL: https://github.com/nodejs/node/pull/9808 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Prince John Wesley Reviewed-By: Rich Trott --- test/parallel/test-buffer-bytelength.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-buffer-bytelength.js b/test/parallel/test-buffer-bytelength.js index c88eb352842e5f..58286e61b4899b 100644 --- a/test/parallel/test-buffer-bytelength.js +++ b/test/parallel/test-buffer-bytelength.js @@ -27,7 +27,7 @@ assert.strictEqual(Buffer.byteLength(ascii), 3); // ArrayBuffer var buffer = new ArrayBuffer(8); -assert.equal(Buffer.byteLength(buffer), 8); +assert.strictEqual(Buffer.byteLength(buffer), 8); // TypedArray var int8 = new Int8Array(8); From 70d3b808a077c54efc46016640fbc34d5d86458d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sat, 26 Nov 2016 10:28:18 +0100 Subject: [PATCH 283/313] test: fix test-buffer-slow Fix incorrect use of string instead of RegExp in `throws` assertions. PR-URL: https://github.com/nodejs/node/pull/9809 Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott Reviewed-By: Prince John Wesley Reviewed-By: Michael Dawson --- test/parallel/test-buffer-slow.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-buffer-slow.js b/test/parallel/test-buffer-slow.js index d65459198a3547..69981d4dc38b73 100644 --- a/test/parallel/test-buffer-slow.js +++ b/test/parallel/test-buffer-slow.js @@ -51,10 +51,10 @@ assert.strictEqual(SlowBuffer('string').length, 0); // should throw with invalid length assert.throws(function() { SlowBuffer(Infinity); -}, 'invalid Buffer length'); +}, /^RangeError: Invalid typed array length$/); assert.throws(function() { SlowBuffer(-1); -}, 'invalid Buffer length'); +}, /^RangeError: Invalid typed array length$/); assert.throws(function() { SlowBuffer(buffer.kMaxLength + 1); -}, 'invalid Buffer length'); +}, /^RangeError: (Invalid typed array length|Array buffer allocation failed)$/); From 9c85d0f396da79b1279f0ac31d2ac993e9cee178 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Sat, 26 Nov 2016 11:31:10 +0100 Subject: [PATCH 284/313] tools: add ESLint rule for assert.throws arguments The second argument to "assert.throws" is usually a validation RegExp or function for the thrown error. However, the function also accepts a string and in this case it is interpreted as a message for the AssertionError and not used for validation. It is common for people to forget this and pass a validation string by mistake. This new rule checks that we never pass a string literal as a second argument to "assert.throws". Additionally, there is an option to enforce the function to be called with at least two arguments. It is currently off because we have many tests that do not comply with this rule. PR-URL: https://github.com/nodejs/node/pull/10089 Reviewed-By: Colin Ihrig Reviewed-By: Teddy Katz Reviewed-By: Rich Trott --- .eslintrc | 1 + tools/eslint-rules/assert-throws-arguments.js | 59 +++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 tools/eslint-rules/assert-throws-arguments.js diff --git a/.eslintrc b/.eslintrc index fdfdaf0833045d..e966348f5f063b 100644 --- a/.eslintrc +++ b/.eslintrc @@ -120,6 +120,7 @@ rules: align-function-arguments: 2 align-multiline-assignment: 2 assert-fail-single-argument: 2 + assert-throws-arguments: [2, { requireTwo: false }] new-with-error: [2, Error, RangeError, TypeError, SyntaxError, ReferenceError] # Global scoped method and vars diff --git a/tools/eslint-rules/assert-throws-arguments.js b/tools/eslint-rules/assert-throws-arguments.js new file mode 100644 index 00000000000000..434a0ca455b471 --- /dev/null +++ b/tools/eslint-rules/assert-throws-arguments.js @@ -0,0 +1,59 @@ +/** + * @fileoverview Check that assert.throws is never called with a string as + * second argument. + * @author Michaël Zasso + */ +'use strict'; + +//------------------------------------------------------------------------------ +// Rule Definition +//------------------------------------------------------------------------------ + +function checkThrowsArguments(context, node) { + if (node.callee.type === 'MemberExpression' && + node.callee.object.name === 'assert' && + node.callee.property.name === 'throws') { + const args = node.arguments; + if (args.length > 3) { + context.report({ + message: 'Too many arguments', + node: node + }); + } else if (args.length > 1) { + const error = args[1]; + if (error.type === 'Literal' && typeof error.value === 'string') { + context.report({ + message: 'Unexpected string as second argument', + node: error + }); + } + } else { + if (context.options[0].requireTwo) { + context.report({ + message: 'Expected at least two arguments', + node: node + }); + } + } + } +} + +module.exports = { + meta: { + schema: [ + { + type: 'object', + properties: { + requireTwo: { + type: 'boolean' + } + } + } + ] + }, + create: function(context) { + return { + CallExpression: (node) => checkThrowsArguments(context, node) + }; + } +}; From e355604aa55c4fd98a7dadf051a3524bbf19febb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Fri, 16 Dec 2016 09:34:25 +0100 Subject: [PATCH 285/313] tools: forbid template literals in assert.throws Extend the assert-throws-arguments custom ESLint rule to also check for the use of template literals as a second argument to assert.throws. PR-URL: https://github.com/nodejs/node/pull/10301 Ref: https://github.com/nodejs/node/pull/10282#discussion_r92607290 Reviewed-By: Prince John Wesley Reviewed-By: Jeremiah Senkpiel Reviewed-By: Colin Ihrig Reviewed-By: Roman Reiss Reviewed-By: Anna Henningsen Reviewed-By: Italo A. Casas --- tools/eslint-rules/assert-throws-arguments.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/eslint-rules/assert-throws-arguments.js b/tools/eslint-rules/assert-throws-arguments.js index 434a0ca455b471..3b51188c0c89bc 100644 --- a/tools/eslint-rules/assert-throws-arguments.js +++ b/tools/eslint-rules/assert-throws-arguments.js @@ -21,7 +21,8 @@ function checkThrowsArguments(context, node) { }); } else if (args.length > 1) { const error = args[1]; - if (error.type === 'Literal' && typeof error.value === 'string') { + if (error.type === 'Literal' && typeof error.value === 'string' || + error.type === 'TemplateLiteral') { context.report({ message: 'Unexpected string as second argument', node: error From f9d0cce9aec569daeb260ac350c6d6ae21759b4d Mon Sep 17 00:00:00 2001 From: Kevin Zurawel Date: Thu, 1 Dec 2016 10:12:46 -0600 Subject: [PATCH 286/313] doc: update process.versions.modules documentation This commit adds a description of `process.versions.modules`, based on the comment in `src/node_version.h` lines 47-50. PR-URL: https://github.com/nodejs/node/pull/9901 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen --- doc/api/process.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/doc/api/process.md b/doc/api/process.md index a5e2a8a549ca70..7b6ed03edfc79e 100644 --- a/doc/api/process.md +++ b/doc/api/process.md @@ -1683,7 +1683,9 @@ added: v0.2.0 * {Object} The `process.versions` property returns an object listing the version strings of -Node.js and its dependencies. +Node.js and its dependencies. In addition, `process.versions.modules` indicates +the current ABI version, which is increased whenever a C++ API changes. Node.js +will refuse to load native modules built for an older `modules` value. ```js console.log(process.versions); From 68836ec4550c22a8678baed4d5858bb51f1c20ae Mon Sep 17 00:00:00 2001 From: "Avery, Frank" Date: Thu, 1 Dec 2016 10:22:35 -0600 Subject: [PATCH 287/313] test: added validation regex argument to test In this change, I've added the regex pattern to the assert.throws() in order to provide the validation argument for the call. PR-URL: https://github.com/nodejs/node/pull/9918 Reviewed-By: Teddy Katz Reviewed-By: Colin Ihrig --- test/parallel/test-file-write-stream.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-file-write-stream.js b/test/parallel/test-file-write-stream.js index 3c7cf8f341dce2..3b6883444249e6 100644 --- a/test/parallel/test-file-write-stream.js +++ b/test/parallel/test-file-write-stream.js @@ -46,7 +46,7 @@ file assert.throws(function() { console.error('write after end should not be allowed'); file.write('should not work anymore'); - }); + }, /^Error: write after end$/); fs.unlinkSync(fn); }); From b8511aba04806ed699d100cd95f6b69c3abef704 Mon Sep 17 00:00:00 2001 From: Amar Zavery Date: Thu, 1 Dec 2016 10:27:02 -0600 Subject: [PATCH 288/313] test: replace var with const in test-require-dot PR-URL: https://github.com/nodejs/node/pull/9916 Reviewed-By: Colin Ihrig Reviewed-By: Teddy Katz Reviewed-By: Gibson Fahnestock Reviewed-By: James M Snell Reviewed-By: Italo A. Casas --- test/parallel/test-require-dot.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-require-dot.js b/test/parallel/test-require-dot.js index 2fb161486a9241..26733c7fc438a1 100644 --- a/test/parallel/test-require-dot.js +++ b/test/parallel/test-require-dot.js @@ -1,17 +1,17 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var module = require('module'); +const common = require('../common'); +const assert = require('assert'); +const m = require('module'); -var a = require(common.fixturesDir + '/module-require/relative/dot.js'); -var b = require(common.fixturesDir + '/module-require/relative/dot-slash.js'); +const a = require(common.fixturesDir + '/module-require/relative/dot.js'); +const b = require(common.fixturesDir + '/module-require/relative/dot-slash.js'); -assert.equal(a.value, 42); -assert.equal(a, b, 'require(".") should resolve like require("./")'); +assert.strictEqual(a.value, 42); +assert.strictEqual(a, b, 'require(".") should resolve like require("./")'); process.env.NODE_PATH = common.fixturesDir + '/module-require/relative'; -module._initPaths(); +m._initPaths(); -var c = require('.'); +const c = require('.'); -assert.equal(c.value, 42, 'require(".") should honor NODE_PATH'); +assert.strictEqual(c.value, 42, 'require(".") should honor NODE_PATH'); From 420b3b851e7087cb12dd53039feb83d0f8383d58 Mon Sep 17 00:00:00 2001 From: Kailean Courtney Date: Thu, 1 Dec 2016 10:33:36 -0600 Subject: [PATCH 289/313] test: clean up repl-reset-event file * Change vars to let/const * Add mustCall * equal -> strictEqual * remove timeout PR-URL: https://github.com/nodejs/node/pull/9931 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- test/parallel/test-repl-reset-event.js | 47 ++++++++++++-------------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/test/parallel/test-repl-reset-event.js b/test/parallel/test-repl-reset-event.js index eee61ac17356f4..190aa2227de9a3 100644 --- a/test/parallel/test-repl-reset-event.js +++ b/test/parallel/test-repl-reset-event.js @@ -1,52 +1,49 @@ 'use strict'; -var common = require('../common'); +const common = require('../common'); common.globalCheck = false; -var assert = require('assert'); -var repl = require('repl'); +const assert = require('assert'); +const repl = require('repl'); // Create a dummy stream that does nothing const dummy = new common.ArrayStream(); function testReset(cb) { - var r = repl.start({ + const r = repl.start({ input: dummy, output: dummy, useGlobal: false }); r.context.foo = 42; - r.on('reset', function(context) { + r.on('reset', common.mustCall(function(context) { assert(!!context, 'REPL did not emit a context with reset event'); - assert.equal(context, r.context, 'REPL emitted incorrect context'); - assert.equal(context.foo, undefined, 'REPL emitted the previous context' + - ', and is not using global as context'); + assert.strictEqual(context, r.context, 'REPL emitted incorrect context'); + assert.strictEqual( + context.foo, + undefined, + 'REPL emitted the previous context, and is not using global as context' + ); context.foo = 42; cb(); - }); + })); r.resetContext(); } -function testResetGlobal(cb) { - var r = repl.start({ +function testResetGlobal() { + const r = repl.start({ input: dummy, output: dummy, useGlobal: true }); r.context.foo = 42; - r.on('reset', function(context) { - assert.equal(context.foo, 42, - '"foo" property is missing from REPL using global as context'); - cb(); - }); + r.on('reset', common.mustCall(function(context) { + assert.strictEqual( + context.foo, + 42, + '"foo" property is missing from REPL using global as context' + ); + })); r.resetContext(); } -var timeout = setTimeout(function() { - common.fail('Timeout, REPL did not emit reset events'); -}, 5000); - -testReset(function() { - testResetGlobal(function() { - clearTimeout(timeout); - }); -}); +testReset(common.mustCall(testResetGlobal)); From b37fce91d3db1b507e59ddd73b468f9e49c51d24 Mon Sep 17 00:00:00 2001 From: Jason Wohlgemuth Date: Thu, 1 Dec 2016 10:36:16 -0600 Subject: [PATCH 290/313] test: test: refactor test-sync-fileread change equal to strictEqual and var to const PR-URL: https://github.com/nodejs/node/pull/9941 Reviewed-By: Prince John Wesley Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott --- test/parallel/test-sync-fileread.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-sync-fileread.js b/test/parallel/test-sync-fileread.js index 36ac23fd8789a0..6882513c50b950 100644 --- a/test/parallel/test-sync-fileread.js +++ b/test/parallel/test-sync-fileread.js @@ -1,9 +1,9 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var path = require('path'); -var fs = require('fs'); +const common = require('../common'); +const assert = require('assert'); +const path = require('path'); +const fs = require('fs'); -var fixture = path.join(common.fixturesDir, 'x.txt'); +const fixture = path.join(common.fixturesDir, 'x.txt'); -assert.equal('xyz\n', fs.readFileSync(fixture)); +assert.strictEqual(fs.readFileSync(fixture).toString(), 'xyz\n'); From eff85e659f0b282cba1795ed51b1e27657b2e377 Mon Sep 17 00:00:00 2001 From: Richard Karmazin Date: Thu, 1 Dec 2016 10:17:17 -0600 Subject: [PATCH 291/313] test: refactor test-tls-0-dns-altname * var -> const, let * assert.equal() -> assert.strictEqual() PR-URL: https://github.com/nodejs/node/pull/9948 Reviewed-By: Teddy Katz Reviewed-By: Colin Ihrig Reviewed-By: Italo A. Casas Reviewed-By: James M Snell --- test/parallel/test-tls-0-dns-altname.js | 26 ++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/test/parallel/test-tls-0-dns-altname.js b/test/parallel/test-tls-0-dns-altname.js index 4ae9f2c91b00ad..874dc6b235d644 100644 --- a/test/parallel/test-tls-0-dns-altname.js +++ b/test/parallel/test-tls-0-dns-altname.js @@ -1,16 +1,16 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const tls = require('tls'); -var fs = require('fs'); +const fs = require('fs'); -var server = tls.createServer({ +const server = tls.createServer({ key: fs.readFileSync(common.fixturesDir + '/keys/0-dns-key.pem'), cert: fs.readFileSync(common.fixturesDir + '/keys/0-dns-cert.pem') }, function(c) { @@ -19,16 +19,16 @@ var server = tls.createServer({ server.close(); }); }).listen(0, common.mustCall(function() { - var c = tls.connect(this.address().port, { + const c = tls.connect(this.address().port, { rejectUnauthorized: false }, common.mustCall(function() { - var cert = c.getPeerCertificate(); - assert.equal(cert.subjectaltname, - 'DNS:google.com\0.evil.com, ' + - 'DNS:just-another.com, ' + - 'IP Address:8.8.8.8, ' + - 'IP Address:8.8.4.4, ' + - 'DNS:last.com'); + const cert = c.getPeerCertificate(); + assert.strictEqual(cert.subjectaltname, + 'DNS:google.com\0.evil.com, ' + + 'DNS:just-another.com, ' + + 'IP Address:8.8.8.8, ' + + 'IP Address:8.8.4.4, ' + + 'DNS:last.com'); c.write('ok'); })); })); From 9991bcbadaa1b4774fe0626efeb96352e43ebbb8 Mon Sep 17 00:00:00 2001 From: CodeVana Date: Thu, 1 Dec 2016 08:22:36 -0800 Subject: [PATCH 292/313] test: improve domain-top-level-error-handler-throw Use assert.strictEqual instead of assert.equal. PR-URL: https://github.com/nodejs/node/pull/9950 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Rich Trott --- test/parallel/test-domain-top-level-error-handler-throw.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-domain-top-level-error-handler-throw.js b/test/parallel/test-domain-top-level-error-handler-throw.js index c98dfc3f1f1b7b..b65b94012393c6 100644 --- a/test/parallel/test-domain-top-level-error-handler-throw.js +++ b/test/parallel/test-domain-top-level-error-handler-throw.js @@ -48,8 +48,8 @@ if (process.argv[2] === 'child') { var expectedExitCode = 7; var expectedSignal = null; - assert.equal(exitCode, expectedExitCode); - assert.equal(signal, expectedSignal); + assert.strictEqual(exitCode, expectedExitCode); + assert.strictEqual(signal, expectedSignal); }); } } From da3ccb969dd7e1569a92f0db5f0021fdb084b169 Mon Sep 17 00:00:00 2001 From: Rico Cai Date: Thu, 1 Dec 2016 10:20:48 -0600 Subject: [PATCH 293/313] test: improve test-cluster-net-listen.js convert var to const PR-URL: https://github.com/nodejs/node/pull/9953 Reviewed-By: Rich Trott Reviewed-By: James M Snell Reviewed-By: Gibson Fahnestock --- test/parallel/test-cluster-net-listen.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-cluster-net-listen.js b/test/parallel/test-cluster-net-listen.js index 829d1806d52889..f302b3def8bcef 100644 --- a/test/parallel/test-cluster-net-listen.js +++ b/test/parallel/test-cluster-net-listen.js @@ -1,8 +1,8 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var cluster = require('cluster'); -var net = require('net'); +const common = require('../common'); +const assert = require('assert'); +const cluster = require('cluster'); +const net = require('net'); if (cluster.isMaster) { // ensure that the worker exits peacefully From 3c3d2d6776cb80514a8bf22aebfdfd67bdbd8250 Mon Sep 17 00:00:00 2001 From: Harish Tejwani Date: Thu, 1 Dec 2016 10:52:33 -0600 Subject: [PATCH 294/313] test: refactor test-tls-client-getephemeralkeyinfo change var to const and add mustCall PR-URL: https://github.com/nodejs/node/pull/9954 Reviewed-By: Prince John Wesley Reviewed-By: James M Snell Reviewed-By: Colin Ihrig --- .../test-tls-client-getephemeralkeyinfo.js | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-tls-client-getephemeralkeyinfo.js b/test/parallel/test-tls-client-getephemeralkeyinfo.js index 38fd602b1c2262..c1e6597245a612 100644 --- a/test/parallel/test-tls-client-getephemeralkeyinfo.js +++ b/test/parallel/test-tls-client-getephemeralkeyinfo.js @@ -1,16 +1,16 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); if (!common.hasCrypto) { common.skip('missing crypto'); process.exit(); } -var tls = require('tls'); +const tls = require('tls'); -var fs = require('fs'); -var key = fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'); -var cert = fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'); +const fs = require('fs'); +const key = fs.readFileSync(common.fixturesDir + '/keys/agent2-key.pem'); +const cert = fs.readFileSync(common.fixturesDir + '/keys/agent2-cert.pem'); var ntests = 0; var nsuccess = 0; @@ -45,12 +45,12 @@ function test(size, type, name, next) { conn.end(); }); - server.on('close', function(err) { + server.on('close', common.mustCall(function(err) { assert(!err); if (next) next(); - }); + })); - server.listen(0, '127.0.0.1', function() { + server.listen(0, '127.0.0.1', common.mustCall(function() { var client = tls.connect({ port: this.address().port, rejectUnauthorized: false @@ -62,7 +62,7 @@ function test(size, type, name, next) { nsuccess++; server.close(); }); - }); + })); } function testNOT_PFS() { From 77334a2143b718e2f23fbeeb5e7dafa887248d94 Mon Sep 17 00:00:00 2001 From: Christopher Rokita Date: Thu, 1 Dec 2016 11:41:17 -0500 Subject: [PATCH 295/313] test: refactoring test-cluster-worker-constructor - Using assert.strictEqual instead assert.equal PR-URL: https://github.com/nodejs/node/pull/9956 Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Italo A. Casas --- .../test-cluster-worker-constructor.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/parallel/test-cluster-worker-constructor.js b/test/parallel/test-cluster-worker-constructor.js index 2a96d24a8a3459..f3ae7db73168a9 100644 --- a/test/parallel/test-cluster-worker-constructor.js +++ b/test/parallel/test-cluster-worker-constructor.js @@ -8,21 +8,21 @@ var cluster = require('cluster'); var worker; worker = new cluster.Worker(); -assert.equal(worker.suicide, undefined); -assert.equal(worker.state, 'none'); -assert.equal(worker.id, 0); -assert.equal(worker.process, undefined); +assert.strictEqual(worker.suicide, undefined); +assert.strictEqual(worker.state, 'none'); +assert.strictEqual(worker.id, 0); +assert.strictEqual(worker.process, undefined); worker = new cluster.Worker({ id: 3, state: 'online', process: process }); -assert.equal(worker.suicide, undefined); -assert.equal(worker.state, 'online'); -assert.equal(worker.id, 3); -assert.equal(worker.process, process); +assert.strictEqual(worker.suicide, undefined); +assert.strictEqual(worker.state, 'online'); +assert.strictEqual(worker.id, 3); +assert.strictEqual(worker.process, process); worker = cluster.Worker.call({}, {id: 5}); assert(worker instanceof cluster.Worker); -assert.equal(worker.id, 5); +assert.strictEqual(worker.id, 5); From bdf633a32e785ef59f24f8afce01c9189154b7ae Mon Sep 17 00:00:00 2001 From: Outsider Date: Thu, 1 Dec 2016 10:31:42 -0600 Subject: [PATCH 296/313] test: use const/let and common.mustCall remove process.on('exit') because all callbacks are wrapped by common.mustCall. PR-URL: https://github.com/nodejs/node/pull/9959 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Roman Reiss --- test/parallel/test-tls-cnnic-whitelist.js | 36 ++++++++++------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/test/parallel/test-tls-cnnic-whitelist.js b/test/parallel/test-tls-cnnic-whitelist.js index f16698c736be39..c2b9c0849296bc 100644 --- a/test/parallel/test-tls-cnnic-whitelist.js +++ b/test/parallel/test-tls-cnnic-whitelist.js @@ -1,16 +1,15 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); -var fs = require('fs'); -var path = require('path'); -var finished = 0; +const assert = require('assert'); +const tls = require('tls'); +const fs = require('fs'); +const path = require('path'); function filenamePEM(n) { return path.join(common.fixturesDir, 'keys', n + '.pem'); @@ -20,7 +19,7 @@ function loadPEM(n) { return fs.readFileSync(filenamePEM(n)); } -var testCases = [ +const testCases = [ { // Test 0: for the check of a cert not existed in the whitelist. // agent7-cert.pem is issued by the fake CNNIC root CA so that its // hash is not listed in the whitelist. @@ -58,27 +57,22 @@ var testCases = [ ]; function runTest(tindex) { - var tcase = testCases[tindex]; + const tcase = testCases[tindex]; if (!tcase) return; - var server = tls.createServer(tcase.serverOpts, function(s) { + const server = tls.createServer(tcase.serverOpts, (s) => { s.resume(); - }).listen(0, function() { + }).listen(0, common.mustCall(function() { tcase.clientOpts = this.address().port; - var client = tls.connect(tcase.clientOpts); - client.on('error', function(e) { + const client = tls.connect(tcase.clientOpts); + client.on('error', common.mustCall((e) => { assert.strictEqual(e.code, tcase.errorCode); - server.close(function() { - finished++; + server.close(common.mustCall(() => { runTest(tindex + 1); - }); - }); - }); + })); + })); + })); } runTest(0); - -process.on('exit', function() { - assert.equal(finished, testCases.length); -}); From e53506ac01e1685f9b6291f991007e36c34ab5d0 Mon Sep 17 00:00:00 2001 From: Kevin Cox Date: Thu, 1 Dec 2016 11:01:49 -0600 Subject: [PATCH 297/313] test: update test-tls-check-server-identity.js Changed var to const, assert.equal to assert.strictEqual, and used a template string for error output. PR-URL: https://github.com/nodejs/node/pull/9986 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- .../test-tls-check-server-identity.js | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-tls-check-server-identity.js b/test/parallel/test-tls-check-server-identity.js index 0732ab3c0fcd67..5c89ef8bf4d425 100644 --- a/test/parallel/test-tls-check-server-identity.js +++ b/test/parallel/test-tls-check-server-identity.js @@ -1,16 +1,17 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var util = require('util'); +const common = require('../common'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const assert = require('assert'); +const util = require('util'); -var tests = [ +const tls = require('tls'); + +const tests = [ // False-y values. { host: false, @@ -253,9 +254,9 @@ var tests = [ ]; tests.forEach(function(test, i) { - var err = tls.checkServerIdentity(test.host, test.cert); - assert.equal(err && err.reason, - test.error, - 'Test#' + i + ' failed: ' + util.inspect(test) + '\n' + - test.error + ' != ' + (err && err.reason)); + const err = tls.checkServerIdentity(test.host, test.cert); + assert.strictEqual(err && err.reason, + test.error, + `Test# ${i} failed: ${util.inspect(test)} \n` + + `${test.error} != ${(err && err.reason)}`); }); From 21a60912a8a60dd671d33363f65e6b8b84fcb107 Mon Sep 17 00:00:00 2001 From: Brian Chirgwin Date: Thu, 1 Dec 2016 11:10:28 -0600 Subject: [PATCH 298/313] test: refactor test-tls-interleave var -> let / const added common.mustCall() to callback assert.equal() -> assert.strictEqual() PR-URL: https://github.com/nodejs/node/pull/10017 Reviewed-By: Colin Ihrig --- test/parallel/test-tls-interleave.js | 34 +++++++++++++++------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/test/parallel/test-tls-interleave.js b/test/parallel/test-tls-interleave.js index d03ed249d53253..9cccee82506005 100644 --- a/test/parallel/test-tls-interleave.js +++ b/test/parallel/test-tls-interleave.js @@ -1,37 +1,38 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); if (!common.hasCrypto) { common.skip('missing crypto'); return; } -var tls = require('tls'); +const assert = require('assert'); -var fs = require('fs'); +const tls = require('tls'); -var dir = common.fixturesDir; -var options = { key: fs.readFileSync(dir + '/test_key.pem'), - cert: fs.readFileSync(dir + '/test_cert.pem'), - ca: [ fs.readFileSync(dir + '/test_ca.pem') ] }; +const fs = require('fs'); -var writes = [ +const dir = common.fixturesDir; +const options = { key: fs.readFileSync(dir + '/test_key.pem'), + cert: fs.readFileSync(dir + '/test_cert.pem'), + ca: [ fs.readFileSync(dir + '/test_ca.pem') ] }; + +const writes = [ 'some server data', 'and a separate packet', 'and one more', ]; -var receivedWrites = 0; +let receivedWrites = 0; -var server = tls.createServer(options, function(c) { +const server = tls.createServer(options, function(c) { writes.forEach(function(str) { c.write(str); }); -}).listen(0, function() { +}).listen(0, common.mustCall(function() { const connectOpts = { rejectUnauthorized: false }; - var c = tls.connect(this.address().port, connectOpts, function() { + const c = tls.connect(this.address().port, connectOpts, function() { c.write('some client data'); c.on('readable', function() { - var data = c.read(); + let data = c.read(); if (data === null) return; @@ -47,8 +48,9 @@ var server = tls.createServer(options, function(c) { } }); }); -}); +})); + process.on('exit', function() { - assert.equal(receivedWrites, writes.length); + assert.strictEqual(receivedWrites, writes.length); }); From 49e7029283f5d23038928a9d8fab7112cd70df26 Mon Sep 17 00:00:00 2001 From: Christy Leung Date: Thu, 1 Dec 2016 11:03:32 -0600 Subject: [PATCH 299/313] test: refactor test-internal-modules * var -> const * add RegExp to assert.throws() to check error message PR-URL: https://github.com/nodejs/node/pull/10016 Reviewed-By: James M Snell --- test/parallel/test-internal-modules.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-internal-modules.js b/test/parallel/test-internal-modules.js index ea300d5c5fb85c..2f11ca18dd6b34 100644 --- a/test/parallel/test-internal-modules.js +++ b/test/parallel/test-internal-modules.js @@ -1,11 +1,11 @@ 'use strict'; -var common = require('../common'); -var path = require('path'); -var assert = require('assert'); +const common = require('../common'); +const path = require('path'); +const assert = require('assert'); assert.throws(function() { require('internal/freelist'); -}); +}, /^Error: Cannot find module 'internal\/freelist'$/); assert.strictEqual( require(path.join(common.fixturesDir, 'internal-modules')), From ff3a1e69f59ad464f869b5a6a0a0b4467ad76d02 Mon Sep 17 00:00:00 2001 From: Travis Bretton Date: Thu, 1 Dec 2016 09:53:01 -0700 Subject: [PATCH 300/313] test: cleanup test-stdout-close-catch.js MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added common.mustCall in child process on 'close' callback Changed several 'var' statements to 'const' or 'let' where appropriate Also linting PR-URL: https://github.com/nodejs/node/pull/10006 Reviewed-By: Michael Dawson Reviewed-By: Michaël Zasso Reviewed-By: Colin Ihrig Reviewed-By: Roman Reiss --- test/parallel/test-stdout-close-catch.js | 35 +++++++++++++----------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/test/parallel/test-stdout-close-catch.js b/test/parallel/test-stdout-close-catch.js index d84d8e93b0c0b0..322ed76aee8fc0 100644 --- a/test/parallel/test-stdout-close-catch.js +++ b/test/parallel/test-stdout-close-catch.js @@ -1,27 +1,30 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var path = require('path'); -var child_process = require('child_process'); +const common = require('../common'); +const assert = require('assert'); +const path = require('path'); +const child_process = require('child_process'); -var testScript = path.join(common.fixturesDir, 'catch-stdout-error.js'); +const testScript = path.join(common.fixturesDir, 'catch-stdout-error.js'); -var cmd = JSON.stringify(process.execPath) + ' ' + - JSON.stringify(testScript) + ' | ' + - JSON.stringify(process.execPath) + ' ' + - '-pe "process.stdin.on(\'data\' , () => process.exit(1))"'; +const cmd = JSON.stringify(process.execPath) + ' ' + + JSON.stringify(testScript) + ' | ' + + JSON.stringify(process.execPath) + ' ' + + '-pe "process.stdin.on(\'data\' , () => process.exit(1))"'; -var child = child_process.exec(cmd); -var output = ''; -var outputExpect = { 'code': 'EPIPE', - 'errno': 'EPIPE', - 'syscall': 'write' }; +const child = child_process.exec(cmd); +let output = ''; +const outputExpect = { + code: 'EPIPE', + errno: 'EPIPE', + syscall: 'write' +}; child.stderr.on('data', function(c) { output += c; }); -child.on('close', function(code) { + +child.on('close', common.mustCall(function(code) { try { output = JSON.parse(output); } catch (er) { @@ -31,4 +34,4 @@ child.on('close', function(code) { assert.deepStrictEqual(output, outputExpect); console.log('ok'); -}); +})); From 610ec557a6c6f5f55b9148391f1440b583d42e40 Mon Sep 17 00:00:00 2001 From: malen Date: Thu, 1 Dec 2016 08:54:06 -0800 Subject: [PATCH 301/313] test: refactor test-child-process-ipc Change var to const or let. Change assert.equal() to assert.strictEqual(). PR-URL: https://github.com/nodejs/node/pull/9990 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell Reviewed-By: Roman Reiss --- test/parallel/test-child-process-ipc.js | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/test/parallel/test-child-process-ipc.js b/test/parallel/test-child-process-ipc.js index 7d0447569ffe73..cbaa270f5e8440 100644 --- a/test/parallel/test-child-process-ipc.js +++ b/test/parallel/test-child-process-ipc.js @@ -1,17 +1,18 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var spawn = require('child_process').spawn; +const common = require('../common'); +const assert = require('assert'); -var path = require('path'); +const spawn = require('child_process').spawn; -var sub = path.join(common.fixturesDir, 'echo.js'); +const path = require('path'); -var gotHelloWorld = false; -var gotEcho = false; +const sub = path.join(common.fixturesDir, 'echo.js'); -var child = spawn(process.argv[0], [sub]); +let gotHelloWorld = false; +let gotEcho = false; + +const child = spawn(process.argv[0], [sub]); child.stderr.on('data', function(data) { console.log('parent stderr: ' + data); @@ -23,7 +24,7 @@ child.stdout.on('data', function(data) { console.log('child said: ' + JSON.stringify(data)); if (!gotHelloWorld) { console.error('testing for hello world'); - assert.equal('hello world\r\n', data); + assert.strictEqual('hello world\r\n', data); gotHelloWorld = true; console.error('writing echo me'); child.stdin.write('echo me\r\n'); From 0ab2cfc64e76e364056bd0d6fca1da125b0577cb Mon Sep 17 00:00:00 2001 From: Ken Russo Date: Thu, 1 Dec 2016 09:57:52 -0700 Subject: [PATCH 302/313] test: add second argument to assert.throws() The assert.throws() calls in test-event-emitter-max-listeners.js should include a constructor or RegExp as a second argument. PR-URL: https://github.com/nodejs/node/pull/9987 Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-event-emitter-max-listeners.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-event-emitter-max-listeners.js b/test/parallel/test-event-emitter-max-listeners.js index 5dabbac6ae28c0..0ace154aa00a5c 100644 --- a/test/parallel/test-event-emitter-max-listeners.js +++ b/test/parallel/test-event-emitter-max-listeners.js @@ -1,8 +1,8 @@ 'use strict'; const common = require('../common'); -var assert = require('assert'); -var events = require('events'); -var e = new events.EventEmitter(); +const assert = require('assert'); +const events = require('events'); +const e = new events.EventEmitter(); e.on('maxListeners', common.mustCall(function() {})); @@ -11,14 +11,14 @@ e.setMaxListeners(42); assert.throws(function() { e.setMaxListeners(NaN); -}); +}, /^TypeError: "n" argument must be a positive number$/); assert.throws(function() { e.setMaxListeners(-1); -}); +}, /^TypeError: "n" argument must be a positive number$/); assert.throws(function() { e.setMaxListeners('and even this'); -}); +}, /^TypeError: "n" argument must be a positive number$/); e.emit('maxListeners'); From ac9348d79f3a9b00f01b0203945c179c14f93369 Mon Sep 17 00:00:00 2001 From: Travis Bretton Date: Thu, 1 Dec 2016 10:45:24 -0700 Subject: [PATCH 303/313] test: refactoring test-pipe-head - Updated assert.equal to assert.strictEqual - Updated 'var' to 'const' - Using template literals PR-URL: https://github.com/nodejs/node/pull/10036 Reviewed-By: James M Snell Reviewed-By: Rich Trott Reviewed-By: Italo A. Casas --- test/parallel/test-pipe-head.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-pipe-head.js b/test/parallel/test-pipe-head.js index dcb4e89137f536..c838be03aa9a01 100644 --- a/test/parallel/test-pipe-head.js +++ b/test/parallel/test-pipe-head.js @@ -1,17 +1,17 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); +const common = require('../common'); +const assert = require('assert'); -var exec = require('child_process').exec; -var join = require('path').join; +const exec = require('child_process').exec; +const join = require('path').join; -var nodePath = process.argv[0]; -var script = join(common.fixturesDir, 'print-10-lines.js'); +const nodePath = process.argv[0]; +const script = join(common.fixturesDir, 'print-10-lines.js'); -var cmd = '"' + nodePath + '" "' + script + '" | head -2'; +const cmd = `"${nodePath}" "${script}" | head -2`; exec(cmd, common.mustCall(function(err, stdout, stderr) { - if (err) throw err; - var lines = stdout.split('\n'); - assert.equal(3, lines.length); + assert.ifError(err); + const lines = stdout.split('\n'); + assert.strictEqual(3, lines.length); })); From aba15fb9f2fe43469202d7e0ebdbf6a10d51326e Mon Sep 17 00:00:00 2001 From: Sam Shull Date: Thu, 1 Dec 2016 09:49:28 -0800 Subject: [PATCH 304/313] test: add regex check in test-buffer-bad-overload Creating a buffer from a number should throw an error with a message that describes the issue. PR-URL: https://github.com/nodejs/node/pull/10038 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-buffer-bad-overload.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/parallel/test-buffer-bad-overload.js b/test/parallel/test-buffer-bad-overload.js index 3d99dd532e9b93..d5626e16d14419 100644 --- a/test/parallel/test-buffer-bad-overload.js +++ b/test/parallel/test-buffer-bad-overload.js @@ -8,7 +8,7 @@ assert.doesNotThrow(function() { assert.throws(function() { Buffer.from(10, 'hex'); -}); +}, /^TypeError: "value" argument must not be a number$/); assert.doesNotThrow(function() { Buffer.from('deadbeaf', 'hex'); From f9f2cda5dc604f74273fff1067e8383204c30874 Mon Sep 17 00:00:00 2001 From: Amar Zavery Date: Thu, 1 Dec 2016 11:55:13 -0600 Subject: [PATCH 305/313] test: refactor test-cluster-send-handle-twice.js - `var` --> `const` as applicable - `assert.equal` --> `assert.strictEqual` - `assert(false, ..)` --> `common.fail()` - `common.mustCall` for functions that need to be called exactly once - modified an `assert(!signal, 'Worker exited by a signal');` call to `assert.strictEqual(signal, null);` call as that made more sense PR-URL: https://github.com/nodejs/node/pull/10049 Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig --- .../test-cluster-send-handle-twice.js | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/test/parallel/test-cluster-send-handle-twice.js b/test/parallel/test-cluster-send-handle-twice.js index 172a5563f306f5..f4d1bd8e0cc137 100644 --- a/test/parallel/test-cluster-send-handle-twice.js +++ b/test/parallel/test-cluster-send-handle-twice.js @@ -1,36 +1,36 @@ 'use strict'; // Testing to send an handle twice to the parent process. -var common = require('../common'); -var assert = require('assert'); -var cluster = require('cluster'); -var net = require('net'); +const common = require('../common'); +const assert = require('assert'); +const cluster = require('cluster'); +const net = require('net'); -var workers = { +const workers = { toStart: 1 }; if (cluster.isMaster) { - for (var i = 0; i < workers.toStart; ++i) { - var worker = cluster.fork(); - worker.on('exit', function(code, signal) { + for (let i = 0; i < workers.toStart; ++i) { + const worker = cluster.fork(); + worker.on('exit', common.mustCall(function(code, signal) { assert.strictEqual(code, 0, 'Worker exited with an error code'); - assert(!signal, 'Worker exited by a signal'); - }); + assert.strictEqual(signal, null, 'Worker exited by a signal'); + })); } } else { - var server = net.createServer(function(socket) { + const server = net.createServer(function(socket) { process.send('send-handle-1', socket); process.send('send-handle-2', socket); }); server.listen(common.PORT, function() { - var client = net.connect({ host: 'localhost', port: common.PORT }); - client.on('close', function() { cluster.worker.disconnect(); }); + const client = net.connect({ host: 'localhost', port: common.PORT }); + client.on('close', common.mustCall(() => { cluster.worker.disconnect(); })); setTimeout(function() { client.end(); }, 50); }).on('error', function(e) { console.error(e); - assert(false, 'server.listen failed'); + common.fail('server.listen failed'); cluster.worker.disconnect(); }); } From 8389a1eef44ebdd1de5761ade1d63e4f926bd840 Mon Sep 17 00:00:00 2001 From: Josh Mays Date: Thu, 1 Dec 2016 11:57:14 -0600 Subject: [PATCH 306/313] test: refactor test-pipe-file-to-http Changing var defs to const/let, changing assert.equal to assert.strictEqual. Wrapping functions called once with common.mustCall PR-URL: https://github.com/nodejs/node/pull/10054 Reviewed-By: Colin Ihrig --- test/parallel/test-pipe-file-to-http.js | 41 ++++++++++++------------- 1 file changed, 19 insertions(+), 22 deletions(-) diff --git a/test/parallel/test-pipe-file-to-http.js b/test/parallel/test-pipe-file-to-http.js index 8d804f70b7b0e1..f72cfe7d793348 100644 --- a/test/parallel/test-pipe-file-to-http.js +++ b/test/parallel/test-pipe-file-to-http.js @@ -1,20 +1,19 @@ 'use strict'; -var common = require('../common'); -var assert = require('assert'); -var fs = require('fs'); -var http = require('http'); -var path = require('path'); -var cp = require('child_process'); +const common = require('../common'); +const assert = require('assert'); +const fs = require('fs'); +const http = require('http'); +const path = require('path'); +const cp = require('child_process'); common.refreshTmpDir(); -var filename = path.join(common.tmpDir || '/tmp', 'big'); -var clientReqComplete = false; -var count = 0; +const filename = path.join(common.tmpDir || '/tmp', 'big'); +let count = 0; -var server = http.createServer(function(req, res) { - var timeoutId; - assert.equal('POST', req.method); +const server = http.createServer(function(req, res) { + let timeoutId; + assert.strictEqual('POST', req.method); req.pause(); setTimeout(function() { @@ -36,27 +35,26 @@ var server = http.createServer(function(req, res) { server.listen(0); server.on('listening', function() { - var cmd = common.ddCommand(filename, 10240); + const cmd = common.ddCommand(filename, 10240); - cp.exec(cmd, function(err, stdout, stderr) { + cp.exec(cmd, function(err) { if (err) throw err; makeRequest(); }); }); function makeRequest() { - var req = http.request({ + const req = http.request({ port: server.address().port, path: '/', method: 'POST' }); - var s = fs.ReadStream(filename); + const s = fs.ReadStream(filename); s.pipe(req); - s.on('close', function(err) { - if (err) throw err; - clientReqComplete = true; - }); + s.on('close', common.mustCall((err) => { + assert.ifError(err); + })); req.on('response', function(res) { res.resume(); @@ -67,6 +65,5 @@ function makeRequest() { } process.on('exit', function() { - assert.equal(1024 * 10240, count); - assert.ok(clientReqComplete); + assert.strictEqual(1024 * 10240, count); }); From 25b76a44a7582bcd605ec7218fd0545c13e17944 Mon Sep 17 00:00:00 2001 From: Wallace Zhang Date: Thu, 1 Dec 2016 12:07:23 -0600 Subject: [PATCH 307/313] test: test error messages in test-dns-regress-7070 Add a RegExp as a second argument to assert.throws(). PR-URL: https://github.com/nodejs/node/pull/10058 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: Anna Henningsen --- test/parallel/test-dns-regress-7070.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-dns-regress-7070.js b/test/parallel/test-dns-regress-7070.js index 25cf60cf6a19f2..eb939b47559a9d 100644 --- a/test/parallel/test-dns-regress-7070.js +++ b/test/parallel/test-dns-regress-7070.js @@ -4,5 +4,7 @@ const assert = require('assert'); const dns = require('dns'); // Should not raise assertion error. Issue #7070 -assert.throws(() => dns.resolveNs([])); // bad name -assert.throws(() => dns.resolveNs('')); // bad callback +assert.throws(() => dns.resolveNs([]), // bad name + /^Error: "name" argument must be a string$/); +assert.throws(() => dns.resolveNs(''), // bad callback + /^Error: "callback" argument must be a function$/); From 26aa148ac5a9691ddb8555eafc0c60f638d2afe3 Mon Sep 17 00:00:00 2001 From: Segu Riluvan Date: Thu, 22 Dec 2016 21:27:56 -0600 Subject: [PATCH 308/313] test: refactor test-child-process-stdin Use assert.strictEqual instead of assert.equal and assert.ok PR-URL: https://github.com/nodejs/node/pull/10420 Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-child-process-stdin.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-child-process-stdin.js b/test/parallel/test-child-process-stdin.js index 95be2d4c8a12b2..eccced0c32d7be 100644 --- a/test/parallel/test-child-process-stdin.js +++ b/test/parallel/test-child-process-stdin.js @@ -9,8 +9,8 @@ cat.stdin.write('hello'); cat.stdin.write(' '); cat.stdin.write('world'); -assert.ok(cat.stdin.writable); -assert.ok(!cat.stdin.readable); +assert.strictEqual(true, cat.stdin.writable); +assert.strictEqual(false, cat.stdin.readable); cat.stdin.end(); @@ -34,8 +34,8 @@ cat.on('exit', common.mustCall(function(status) { cat.on('close', common.mustCall(function() { if (common.isWindows) { - assert.equal('hello world\r\n', response); + assert.strictEqual('hello world\r\n', response); } else { - assert.equal('hello world', response); + assert.strictEqual('hello world', response); } })); From 487f91a09715f9632319afcff804fb2dad940bf9 Mon Sep 17 00:00:00 2001 From: Adao Junior Date: Thu, 1 Dec 2016 11:13:29 -0600 Subject: [PATCH 309/313] test: refactor domain test Use assert.strictEqual() instead of assert.equal(). PR-URL: https://github.com/nodejs/node/pull/10269 Reviewed-By: Luigi Pinca Reviewed-By: Italo A. Casas Reviewed-By: Colin Ihrig --- ...st-domain-stack-empty-in-process-uncaughtexception.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-domain-stack-empty-in-process-uncaughtexception.js b/test/parallel/test-domain-stack-empty-in-process-uncaughtexception.js index 8b345741ec95e3..a1699d106d9c7c 100644 --- a/test/parallel/test-domain-stack-empty-in-process-uncaughtexception.js +++ b/test/parallel/test-domain-stack-empty-in-process-uncaughtexception.js @@ -7,13 +7,14 @@ const assert = require('assert'); const d = domain.create(); process.on('uncaughtException', common.mustCall(function onUncaught() { - assert.equal(process.domain, null, - 'domains stack should be empty in uncaughtException handler'); + assert.strictEqual(process.domain, null, + 'domains stack should be empty in uncaughtException' + + ' handler'); })); process.on('beforeExit', common.mustCall(function onBeforeExit() { - assert.equal(process.domain, null, - 'domains stack should be empty in beforeExit handler'); + assert.strictEqual(process.domain, null, + 'domains stack should be empty in beforeExit handler'); })); d.run(function() { From 1684d6d65ecc87f699dfaf14225d6b7a15d99156 Mon Sep 17 00:00:00 2001 From: sarahmeyer Date: Thu, 1 Dec 2016 14:03:12 -0600 Subject: [PATCH 310/313] doc: update CONTRIBUTING.MD with link to V8 guide MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, two of the guides in the `/doc/guides` directory are actually guides for working on the Nodei.js project. Of those, one is linked from this page. This change adds a note to point people to the other. PR-URL: https://github.com/nodejs/node/pull/10070 Reviewed-By: Michaël Zasso Reviewed-By: James M Snell Reviewed-By: Myles Borins --- CONTRIBUTING.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6f44949a31e0ca..c9d09436c8cb0a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -60,16 +60,21 @@ always welcome but API or behavioral changes to modules at stability level 3 Node.js has several bundled dependencies in the *deps/* and the *tools/* directories that are not part of the project proper. Any changes to files in those directories or its subdirectories should be sent to their respective -projects. Do not send your patch to us, we cannot accept it. +projects. Do not send a patch to Node.js. We cannot accept such patches. In case of doubt, open an issue in the [issue tracker](https://github.com/nodejs/node/issues/) or contact one of the [project Collaborators](https://github.com/nodejs/node/#current-project-team-members). Especially do so if you plan to work on something big. Nothing is more frustrating than seeing your hard work go to waste because your vision -does not align with the project team. Node.js has two IRC channels, -[#Node.js](http://webchat.freenode.net/?channels=node.js) for general help and questions, and -[#Node-dev](http://webchat.freenode.net/?channels=node-dev) for development of node core specifically. +does not align with the project team. (Node.js has two IRC channels: +[#Node.js](http://webchat.freenode.net/?channels=node.js) for general help and +questions, and +[#Node-dev](http://webchat.freenode.net/?channels=node-dev) for development of +Node.js core specifically. + +For instructions on updating the version of V8 included in the *deps/* +directory, please refer to [the Maintaining V8 in Node.js guide](https://github.com/nodejs/node/blob/master/doc/guides/maintaining-V8.md). ### Step 2: Branch From dee5a7f9be1fd290118fef9eeed0aa6370d772aa Mon Sep 17 00:00:00 2001 From: Sam Shull Date: Thu, 1 Dec 2016 09:55:07 -0800 Subject: [PATCH 311/313] test: invalid package.json causes error when require()ing in directory Requiring a file from a directory that contains an invalid package.json file should throw an error. PR-URL: https://github.com/nodejs/node/pull/10044 Reviewed-By: Rich Trott Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/fixtures/packages/invalid/index.js | 1 + test/fixtures/packages/invalid/package.json | 1 + test/sequential/test-module-loading.js | 7 +++++++ 3 files changed, 9 insertions(+) create mode 100644 test/fixtures/packages/invalid/index.js create mode 100644 test/fixtures/packages/invalid/package.json diff --git a/test/fixtures/packages/invalid/index.js b/test/fixtures/packages/invalid/index.js new file mode 100644 index 00000000000000..014fa39dc365d1 --- /dev/null +++ b/test/fixtures/packages/invalid/index.js @@ -0,0 +1 @@ +exports.ok = 'ok'; diff --git a/test/fixtures/packages/invalid/package.json b/test/fixtures/packages/invalid/package.json new file mode 100644 index 00000000000000..004e1e20324524 --- /dev/null +++ b/test/fixtures/packages/invalid/package.json @@ -0,0 +1 @@ +{,} diff --git a/test/sequential/test-module-loading.js b/test/sequential/test-module-loading.js index b32434f4d89ddb..2ddaffdf2030a5 100644 --- a/test/sequential/test-module-loading.js +++ b/test/sequential/test-module-loading.js @@ -69,6 +69,13 @@ assert.strictEqual(threeFolder, threeIndex); assert.notStrictEqual(threeFolder, three); console.error('test package.json require() loading'); +assert.throws( + function() { + require('../fixtures/packages/invalid'); + }, + /^SyntaxError: Error parsing \S+: Unexpected token , in JSON at position 1$/ +); + assert.strictEqual(require('../fixtures/packages/main').ok, 'ok', 'Failed loading package'); assert.strictEqual(require('../fixtures/packages/main-index').ok, 'ok', From 868e5e624cc59a126927d2f667f1464fc29a8724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Zasso?= Date: Mon, 26 Dec 2016 17:58:29 +0100 Subject: [PATCH 312/313] build: remove node.dsYM directory MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was added by mistake in https://github.com/nodejs/node/commit/d283704cd6cb08ef012de60b6857cb2c153eee63 PR-URL: https://github.com/nodejs/node/pull/10463 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Johan Bergström Reviewed-By: Myles Borins --- node.dSYM/Contents/Info.plist | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 node.dSYM/Contents/Info.plist diff --git a/node.dSYM/Contents/Info.plist b/node.dSYM/Contents/Info.plist deleted file mode 100644 index 98da865a1dda13..00000000000000 --- a/node.dSYM/Contents/Info.plist +++ /dev/null @@ -1,20 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleIdentifier - com.apple.xcode.dsym.node - CFBundleInfoDictionaryVersion - 6.0 - CFBundlePackageType - dSYM - CFBundleSignature - ???? - CFBundleShortVersionString - 1.0 - CFBundleVersion - 1 - - From 42149d73468c0f844c693b2eead8d24f078fa1bb Mon Sep 17 00:00:00 2001 From: Myles Borins Date: Wed, 21 Dec 2016 15:31:45 -0500 Subject: [PATCH 313/313] 2017-01-03, Version 6.9.3 'Boron' (LTS) Release MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This LTS release comes with 312 commits. This includes 229 that are test related, 62 that are docs related, 17 which are build / tools related, and 4 commits which are updates to dependencies. Notable Changes: * build: - shared library support is now working for AIX builds (Stewart Addison) https://github.com/nodejs/node/pull/9675 * deps: - *npm*: upgrade npm to 3.10.10 (Rebecca Turner) https://github.com/nodejs/node/pull/9847 - *V8*: Destructuring of arrow function arguments via computed property no longer throws (Michaël Zasso) https://github.com/nodejs/node/pull/10386) * inspector: - /json/version returns object, not an object wrapped in an array (Ben Noordhuis) https://github.com/nodejs/node/pull/9762 * module: - using --debug-brk and --eval together now works as expected (Kelvin Jin) https://github.com/nodejs/node/pull/8876 * process: - improve performance of nextTick up to 20% (Evan Lucas) https://github.com/nodejs/node/pull/8932 * repl: - the division operator will no longer be accidentally parsed as regex (Teddy Katz) https://github.com/nodejs/node/pull/10103 - improved support for generator functions (Teddy Katz) https://github.com/nodejs/node/pull/9852 * timers: - Re canceling a cancelled timers will no longer throw (Jeremiah Senkpiel) https://github.com/nodejs/node/pull/9685 PR-URL: https://github.com/nodejs/node/pull/10394 --- CHANGELOG.md | 3 +- doc/changelogs/CHANGELOG_V6.md | 339 ++++++++++++++++++++++++++++++++- src/node_version.h | 2 +- 3 files changed, 341 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b17d06773b8420..bfb8b73a0feb24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,7 +26,8 @@ release. -6.9.2
    +6.9.3
    +6.9.2
    6.9.1
    6.9.0
    6.8.1
    diff --git a/doc/changelogs/CHANGELOG_V6.md b/doc/changelogs/CHANGELOG_V6.md index ba3ea5e610f823..dbcb2cc05b2921 100644 --- a/doc/changelogs/CHANGELOG_V6.md +++ b/doc/changelogs/CHANGELOG_V6.md @@ -7,9 +7,10 @@ -6.9.2
    +6.9.3
    +6.9.2
    6.9.1
    6.9.0
    6.8.1
    @@ -41,6 +42,342 @@ [Node.js Long Term Support Plan](https://github.com/nodejs/LTS) and will be supported actively until April 2018 and maintained until April 2019. + +## 2017-01-03, Version 6.9.3 'Boron' (LTS), @MylesBorins + +This LTS release comes with 312 commits. This includes 229 that are test related, +62 that are docs related, 17 which are build / tools related, and 4 commits which +are updates to dependencies. + +### Notable Changes + +* **build**: shared library support is now working for AIX builds (Stewart Addison) [#9675](https://github.com/nodejs/node/pull/9675) +* **deps**: + - *npm*: upgrade npm to 3.10.10 (Rebecca Turner) [#9847](https://github.com/nodejs/node/pull/9847) + - *V8*: Destructuring of arrow function arguments via computed property no longer throws (Michaël Zasso) [#10386](https://github.com/nodejs/node/pull/10386) +* **inspector**: /json/version returns object, not an object wrapped in an array (Ben Noordhuis) [#9762](https://github.com/nodejs/node/pull/9762) +* **module**: using --debug-brk and --eval together now works as expected (Kelvin Jin) [#8876](https://github.com/nodejs/node/pull/8876) +* **process**: improve performance of nextTick up to 20% (Evan Lucas) [#8932](https://github.com/nodejs/node/pull/8932) +* **repl**: + - the division operator will no longer be accidentally parsed as regex (Teddy Katz) [#10103](https://github.com/nodejs/node/pull/10103) + - improved support for generator functions (Teddy Katz) [#9852](https://github.com/nodejs/node/pull/9852) +* **timers**: Re canceling a cancelled timers will no longer throw (Jeremiah Senkpiel) [#9685](https://github.com/nodejs/node/pull/9685) + +### Commits + +* [[`98b2eae328`](https://github.com/nodejs/node/commit/98b2eae328)] - **benchmark**: split timers benchmark and refactor (Rich Trott) [#9497](https://github.com/nodejs/node/pull/9497) +* [[`c32c86b3c3`](https://github.com/nodejs/node/commit/c32c86b3c3)] - **benchmark**: reformat code for clarity (Rich Trott) [#9790](https://github.com/nodejs/node/pull/9790) +* [[`a8909b833e`](https://github.com/nodejs/node/commit/a8909b833e)] - **benchmark,lib,test,tools**: remove unneeded . escape (Rich Trott) [#9449](https://github.com/nodejs/node/pull/9449) +* [[`a9d528be5b`](https://github.com/nodejs/node/commit/a9d528be5b)] - **buffer**: fix range checks for slice() (Trevor Norris) [#9174](https://github.com/nodejs/node/pull/9174) +* [[`868e5e624c`](https://github.com/nodejs/node/commit/868e5e624c)] - **build**: remove node.dsYM directory (Michaël Zasso) [#10463](https://github.com/nodejs/node/pull/10463) +* [[`66687c0906`](https://github.com/nodejs/node/commit/66687c0906)] - **build**: prioritise --shared-X-Y over pkg-config (Rod Vagg) [#9368](https://github.com/nodejs/node/pull/9368) +* [[`9703bf14ef`](https://github.com/nodejs/node/commit/9703bf14ef)] - **build**: add MAKEFLAGS="-j1" to node-gyp (Daniel Bevenius) [#9450](https://github.com/nodejs/node/pull/9450) +* [[`18b8e7bd8b`](https://github.com/nodejs/node/commit/18b8e7bd8b)] - **build**: Make configure file parseable on python3 (kalrover) [#9657](https://github.com/nodejs/node/pull/9657) +* [[`12993b298a`](https://github.com/nodejs/node/commit/12993b298a)] - **build**: default to ppc64 on AIX (Gibson Fahnestock) [#9645](https://github.com/nodejs/node/pull/9645) +* [[`5c0d82bae6`](https://github.com/nodejs/node/commit/5c0d82bae6)] - **build**: Add option to compile for coverage reports (Wayne Andrews) [#9463](https://github.com/nodejs/node/pull/9463) +* [[`168241a98a`](https://github.com/nodejs/node/commit/168241a98a)] - **build**: add shared library support to AIX build (Stewart Addison) [#9675](https://github.com/nodejs/node/pull/9675) +* [[`9a526cb8fe`](https://github.com/nodejs/node/commit/9a526cb8fe)] - **child_process**: remove unreachable code (cjihrig) [#9307](https://github.com/nodejs/node/pull/9307) +* [[`166eea7534`](https://github.com/nodejs/node/commit/166eea7534)] - **constants**: errors -> errno (Bryan English) [#9349](https://github.com/nodejs/node/pull/9349) +* [[`3c09579eee`](https://github.com/nodejs/node/commit/3c09579eee)] - **crypto**: use SSL_get_servername. (Adam Langley) [#9347](https://github.com/nodejs/node/pull/9347) +* [[`106e6cdebd`](https://github.com/nodejs/node/commit/106e6cdebd)] - **debugger**: refactor _debugger.js (Rich Trott) [#9860](https://github.com/nodejs/node/pull/9860) +* [[`e60cafdb3b`](https://github.com/nodejs/node/commit/e60cafdb3b)] - **deps**: backport f795a79 from upstream V8 (Michaël Zasso) [#10386](https://github.com/nodejs/node/pull/10386) +* [[`284d3cc3b7`](https://github.com/nodejs/node/commit/284d3cc3b7)] - **deps**: upgrade npm to 3.10.10 (Rebecca Turner) [#9847](https://github.com/nodejs/node/pull/9847) +* [[`ee09828622`](https://github.com/nodejs/node/commit/ee09828622)] - **deps**: backport 2bd7464 from upstream V8 (Cristian Cavalli) [#10169](https://github.com/nodejs/node/pull/10169) +* [[`10222128e9`](https://github.com/nodejs/node/commit/10222128e9)] - **deps**: backport GYP fix to fix AIX shared suffix (Stewart Addison) [#9675](https://github.com/nodejs/node/pull/9675) +* [[`1684d6d65e`](https://github.com/nodejs/node/commit/1684d6d65e)] - **doc**: update CONTRIBUTING.MD with link to V8 guide (sarahmeyer) [#10070](https://github.com/nodejs/node/pull/10070) +* [[`f9d0cce9ae`](https://github.com/nodejs/node/commit/f9d0cce9ae)] - **doc**: update process.versions.modules documentation (Kevin Zurawel) [#9901](https://github.com/nodejs/node/pull/9901) +* [[`acebfedf80`](https://github.com/nodejs/node/commit/acebfedf80)] - **doc**: add return types and props types to OS module (imatvieiev) [#9648](https://github.com/nodejs/node/pull/9648) +* [[`241470cfbe`](https://github.com/nodejs/node/commit/241470cfbe)] - **doc**: small improvements in readline code examples (Vse Mozhet Byt) [#9628](https://github.com/nodejs/node/pull/9628) +* [[`d33520cdd2`](https://github.com/nodejs/node/commit/d33520cdd2)] - **doc**: consistent 'Returns:' (Roman Reiss) [#9554](https://github.com/nodejs/node/pull/9554) +* [[`c87ccfa3c3`](https://github.com/nodejs/node/commit/c87ccfa3c3)] - **doc**: added types to path docs (imatvieiev) [#9514](https://github.com/nodejs/node/pull/9514) +* [[`d2a1a670e1`](https://github.com/nodejs/node/commit/d2a1a670e1)] - **doc**: add process api data types to documentation (imatvieiev) [#9505](https://github.com/nodejs/node/pull/9505) +* [[`912cae626b`](https://github.com/nodejs/node/commit/912cae626b)] - **doc**: clarify eventType in fs.watch (Nikolai Vavilov) [#9318](https://github.com/nodejs/node/pull/9318) +* [[`30f7802b78`](https://github.com/nodejs/node/commit/30f7802b78)] - **doc**: clarify fs.link and fs.linkSync arguments (Kyle E. Mitchell) [#9145](https://github.com/nodejs/node/pull/9145) +* [[`c55fb737c5`](https://github.com/nodejs/node/commit/c55fb737c5)] - **doc**: adding missing - in README (Italo A. Casas) [#10170](https://github.com/nodejs/node/pull/10170) +* [[`7f4cef1170`](https://github.com/nodejs/node/commit/7f4cef1170)] - **doc**: removing extra space in README (Italo A. Casas) [#10168](https://github.com/nodejs/node/pull/10168) +* [[`e0dbb453e4`](https://github.com/nodejs/node/commit/e0dbb453e4)] - **doc**: remove repeated info onboarding.md (BethGriggs) [#9635](https://github.com/nodejs/node/pull/9635) +* [[`fa7d378335`](https://github.com/nodejs/node/commit/fa7d378335)] - **doc**: correct it's vs. its usage (Rich Trott) [#10098](https://github.com/nodejs/node/pull/10098) +* [[`176f680432`](https://github.com/nodejs/node/commit/176f680432)] - **doc**: add people to cc for async_wrap (Anna Henningsen) [#9471](https://github.com/nodejs/node/pull/9471) +* [[`b77d3d86f7`](https://github.com/nodejs/node/commit/b77d3d86f7)] - **doc**: add link to `net.Server` in tls.md (Devon Rifkin) [#10109](https://github.com/nodejs/node/pull/10109) +* [[`b167727dcc`](https://github.com/nodejs/node/commit/b167727dcc)] - **doc**: fix typo for `decipher.final`. (iamchenxin) [#10086](https://github.com/nodejs/node/pull/10086) +* [[`adb30676b2`](https://github.com/nodejs/node/commit/adb30676b2)] - **doc**: suggest Buffer.alloc instead of Buffer#fill (Teddy Katz) [#10000](https://github.com/nodejs/node/pull/10000) +* [[`36b45c1112`](https://github.com/nodejs/node/commit/36b45c1112)] - **doc**: clarify fs.createReadStream options (Wes Tyler) [#10078](https://github.com/nodejs/node/pull/10078) +* [[`fc6c666d49`](https://github.com/nodejs/node/commit/fc6c666d49)] - **doc**: var => const in js code examples of addons.md (Vse Mozhet Byt) [#10092](https://github.com/nodejs/node/pull/10092) +* [[`0e46f7e745`](https://github.com/nodejs/node/commit/0e46f7e745)] - **doc**: rename writing_tests.md to writing-tests.md (Safia Abdalla) [#9867](https://github.com/nodejs/node/pull/9867) +* [[`99ed5ed5f4`](https://github.com/nodejs/node/commit/99ed5ed5f4)] - **doc**: it’s -> its in api/child_process.md (Devon Rifkin) [#10090](https://github.com/nodejs/node/pull/10090) +* [[`d068fe5ab6`](https://github.com/nodejs/node/commit/d068fe5ab6)] - **doc**: update Collaborators list in README (Rich Trott) [#9846](https://github.com/nodejs/node/pull/9846) +* [[`e5ab0e8670`](https://github.com/nodejs/node/commit/e5ab0e8670)] - **doc**: remove minor contradiction in debugger doc (Rich Trott) [#9832](https://github.com/nodejs/node/pull/9832) +* [[`b74d8cdbdb`](https://github.com/nodejs/node/commit/b74d8cdbdb)] - **doc**: clarify introductory module material (Rich Trott) [#9816](https://github.com/nodejs/node/pull/9816) +* [[`ba077a424b`](https://github.com/nodejs/node/commit/ba077a424b)] - **doc**: improve description of module `exports` (Sam Roberts) [#9622](https://github.com/nodejs/node/pull/9622) +* [[`5396408690`](https://github.com/nodejs/node/commit/5396408690)] - **doc**: fix crypto Verify cut-n-paste from Sign (子丶言) [#9796](https://github.com/nodejs/node/pull/9796) +* [[`9c3f4d63cc`](https://github.com/nodejs/node/commit/9c3f4d63cc)] - **doc**: minor fixes event-loop-timers-and-nexttick.md (Dan Koster) [#9126](https://github.com/nodejs/node/pull/9126) +* [[`87f008393e`](https://github.com/nodejs/node/commit/87f008393e)] - **doc**: changed order of invocations in https.request() example. (atrioom) [#9614](https://github.com/nodejs/node/pull/9614) +* [[`7051ea8606`](https://github.com/nodejs/node/commit/7051ea8606)] - **doc**: fix crypto "decipher.setAAD()" typo (子丶言) [#9782](https://github.com/nodejs/node/pull/9782) +* [[`4b7200ef7b`](https://github.com/nodejs/node/commit/4b7200ef7b)] - **doc**: clarify slashes-appending in url module (Rich Trott) [#9731](https://github.com/nodejs/node/pull/9731) +* [[`1c9817cbeb`](https://github.com/nodejs/node/commit/1c9817cbeb)] - **doc**: "util" is not needed to extend ES6 classes (Adam Brunner) [#9737](https://github.com/nodejs/node/pull/9737) +* [[`4334d6a85a`](https://github.com/nodejs/node/commit/4334d6a85a)] - **doc**: fix typo in assert code example (Vse Mozhet Byt) [#9704](https://github.com/nodejs/node/pull/9704) +* [[`cbea672214`](https://github.com/nodejs/node/commit/cbea672214)] - **doc**: fix typo in BUILDING.md (monkick) [#9569](https://github.com/nodejs/node/pull/9569) +* [[`7a02eb2b03`](https://github.com/nodejs/node/commit/7a02eb2b03)] - **doc**: remove backtick escaping for manpage refs (Anna Henningsen) [#9632](https://github.com/nodejs/node/pull/9632) +* [[`cd3b91bc4e`](https://github.com/nodejs/node/commit/cd3b91bc4e)] - **doc**: improve description of urlObject.query (Rahat Ahmed) [#9625](https://github.com/nodejs/node/pull/9625) +* [[`ff7d85647b`](https://github.com/nodejs/node/commit/ff7d85647b)] - **doc**: remove invalid padding from privateEncrypt (JungMinu) [#9611](https://github.com/nodejs/node/pull/9611) +* [[`50947b7b0f`](https://github.com/nodejs/node/commit/50947b7b0f)] - **doc**: remove Sam Roberts from release team (Sam Roberts) [#9862](https://github.com/nodejs/node/pull/9862) +* [[`cf131bfa90`](https://github.com/nodejs/node/commit/cf131bfa90)] - **doc**: add guide for maintaining V8 (Ali Ijaz Sheikh) [#9777](https://github.com/nodejs/node/pull/9777) +* [[`9796efabc6`](https://github.com/nodejs/node/commit/9796efabc6)] - **doc**: strip trailing whitespace (Sam Roberts) [#9620](https://github.com/nodejs/node/pull/9620) +* [[`35b094b8fe`](https://github.com/nodejs/node/commit/35b094b8fe)] - **doc**: fix "either as either" typo (Sam Roberts) [#9665](https://github.com/nodejs/node/pull/9665) +* [[`1a58a21d29`](https://github.com/nodejs/node/commit/1a58a21d29)] - **doc**: fix tls "the the" typo (Sam Roberts) [#9665](https://github.com/nodejs/node/pull/9665) +* [[`4f205deb66`](https://github.com/nodejs/node/commit/4f205deb66)] - **doc**: describe when a tls server emits 'close' (Sam Roberts) [#9665](https://github.com/nodejs/node/pull/9665) +* [[`4d4ac071da`](https://github.com/nodejs/node/commit/4d4ac071da)] - **doc**: fix an SNI mistyped as SNS (Sam Roberts) [#9665](https://github.com/nodejs/node/pull/9665) +* [[`8475ba294d`](https://github.com/nodejs/node/commit/8475ba294d)] - **doc**: move TSC and CTC meeting minutes out of core repo (James M Snell) [#9503](https://github.com/nodejs/node/pull/9503) +* [[`d343595216`](https://github.com/nodejs/node/commit/d343595216)] - **doc**: fix typo in doc/repl.md line: 6 (Mitsuo Utano) [#9582](https://github.com/nodejs/node/pull/9582) +* [[`d283704cd6`](https://github.com/nodejs/node/commit/d283704cd6)] - **doc**: make comment indentation consistent (Daniel Bevenius) [#9518](https://github.com/nodejs/node/pull/9518) +* [[`b99a9e9a81`](https://github.com/nodejs/node/commit/b99a9e9a81)] - **doc**: wrap long lines in http.request (Timothy Gu) [#9584](https://github.com/nodejs/node/pull/9584) +* [[`fd75b25cbf`](https://github.com/nodejs/node/commit/fd75b25cbf)] - **doc**: fix type of http.request's `agent` option (Timothy Gu) [#9584](https://github.com/nodejs/node/pull/9584) +* [[`1783d3b5fc`](https://github.com/nodejs/node/commit/1783d3b5fc)] - **doc**: fix a typo in the assert.md (Vse Mozhet Byt) [#9598](https://github.com/nodejs/node/pull/9598) +* [[`c286f5719c`](https://github.com/nodejs/node/commit/c286f5719c)] - **doc**: fix typo e.g., => e.g. (Daijiro Yamada) [#9563](https://github.com/nodejs/node/pull/9563) +* [[`82fd0e192f`](https://github.com/nodejs/node/commit/82fd0e192f)] - **doc**: fix typo about cluster doc, (eg. -> e.g.) (YutamaKotaro) [#9568](https://github.com/nodejs/node/pull/9568) +* [[`1bbc2c682a`](https://github.com/nodejs/node/commit/1bbc2c682a)] - **doc**: fix typo in doc/tls.md (Syuhei Kobayashi) [#9566](https://github.com/nodejs/node/pull/9566) +* [[`97093314c2`](https://github.com/nodejs/node/commit/97093314c2)] - **doc**: fix e.g., to e.g. in doc/http.md (ikasumi_wt) [#9564](https://github.com/nodejs/node/pull/9564) +* [[`caa0a7876d`](https://github.com/nodejs/node/commit/caa0a7876d)] - **doc**: fix the index order in pseudocode of modules (kohta ito) [#9562](https://github.com/nodejs/node/pull/9562) +* [[`0088ed87ea`](https://github.com/nodejs/node/commit/0088ed87ea)] - **doc**: remove Roadmap Working Group (William Kapke) [#9545](https://github.com/nodejs/node/pull/9545) +* [[`3219ecea2a`](https://github.com/nodejs/node/commit/3219ecea2a)] - **doc**: fix fs constants link (Timothy) [#9508](https://github.com/nodejs/node/pull/9508) +* [[`cb367ec1b3`](https://github.com/nodejs/node/commit/cb367ec1b3)] - **doc**: fix minor style issue in code examples (Daniel Bevenius) [#9482](https://github.com/nodejs/node/pull/9482) +* [[`ff8c31abfd`](https://github.com/nodejs/node/commit/ff8c31abfd)] - **doc**: grammar and structure revisions of wg doc (Ryan Lewis) [#9495](https://github.com/nodejs/node/pull/9495) +* [[`6f850f4037`](https://github.com/nodejs/node/commit/6f850f4037)] - **doc**: clarify the exit code part of writing_tests (Jeremiah Senkpiel) [#9502](https://github.com/nodejs/node/pull/9502) +* [[`16b53141f7`](https://github.com/nodejs/node/commit/16b53141f7)] - **doc**: fix link to Event Loop page (timathon) [#9527](https://github.com/nodejs/node/pull/9527) +* [[`2d581f1cb5`](https://github.com/nodejs/node/commit/2d581f1cb5)] - **doc**: Fix inaccuracy in https.request docs (Andreas Lind) [#9453](https://github.com/nodejs/node/pull/9453) +* [[`f707b006eb`](https://github.com/nodejs/node/commit/f707b006eb)] - **doc**: add npm link to README (Oscar Morrison) [#7894](https://github.com/nodejs/node/pull/7894) +* [[`2ce6916ddc`](https://github.com/nodejs/node/commit/2ce6916ddc)] - **events**: remove unnecessary checks (cjihrig) [#9330](https://github.com/nodejs/node/pull/9330) +* [[`fe821fbefa`](https://github.com/nodejs/node/commit/fe821fbefa)] - **fs**: clarify fs.link and fs.linkSync arguments (Kyle E. Mitchell) [#9145](https://github.com/nodejs/node/pull/9145) +* [[`a3ba4ff49f`](https://github.com/nodejs/node/commit/a3ba4ff49f)] - **inspector**: /json/version returns object, not array (Ben Noordhuis) [#9762](https://github.com/nodejs/node/pull/9762) +* [[`6632b3d1ab`](https://github.com/nodejs/node/commit/6632b3d1ab)] - **lib**: use === in _http_server and _tls_wrap (Walter Beller-Morales) [#9849](https://github.com/nodejs/node/pull/9849) +* [[`f3861c200d`](https://github.com/nodejs/node/commit/f3861c200d)] - **lib,test**: remove unneeded escaping of / (Rich Trott) [#9485](https://github.com/nodejs/node/pull/9485) +* [[`0be56cd1e9`](https://github.com/nodejs/node/commit/0be56cd1e9)] - **meta**: whitelist dotfiles in .gitignore (Claudio Rodriguez) [#8016](https://github.com/nodejs/node/pull/8016) +* [[`3689813fdd`](https://github.com/nodejs/node/commit/3689813fdd)] - **module**: check -e flag in debug break setup (Kelvin Jin) [#8876](https://github.com/nodejs/node/pull/8876) +* [[`db10e94083`](https://github.com/nodejs/node/commit/db10e94083)] - **process**: improve performance of nextTick (Evan Lucas) [#8932](https://github.com/nodejs/node/pull/8932) +* [[`fac61118f9`](https://github.com/nodejs/node/commit/fac61118f9)] - **repl**: avoid parsing division operator as regex (Teddy Katz) [#10103](https://github.com/nodejs/node/pull/10103) +* [[`86efc93a41`](https://github.com/nodejs/node/commit/86efc93a41)] - **repl**: preprocess only for defaultEval (Prince J Wesley) [#9752](https://github.com/nodejs/node/pull/9752) +* [[`eba4f9a3ff`](https://github.com/nodejs/node/commit/eba4f9a3ff)] - **repl**: fix generator function preprocessing (Teddy Katz) [#9852](https://github.com/nodejs/node/pull/9852) +* [[`70062f7cd7`](https://github.com/nodejs/node/commit/70062f7cd7)] - **repl**: refactor lib/repl.js (Rich Trott) [#9374](https://github.com/nodejs/node/pull/9374) +* [[`f9fd53d82d`](https://github.com/nodejs/node/commit/f9fd53d82d)] - **src**: fix method name, output format (Josh Gavant) [#9627](https://github.com/nodejs/node/pull/9627) +* [[`dee5a7f9be`](https://github.com/nodejs/node/commit/dee5a7f9be)] - **test**: invalid package.json causes error when require()ing in directory (Sam Shull) [#10044](https://github.com/nodejs/node/pull/10044) +* [[`487f91a097`](https://github.com/nodejs/node/commit/487f91a097)] - **test**: refactor domain test (Adao Junior) [#10269](https://github.com/nodejs/node/pull/10269) +* [[`26aa148ac5`](https://github.com/nodejs/node/commit/26aa148ac5)] - **test**: refactor test-child-process-stdin (Segu Riluvan) [#10420](https://github.com/nodejs/node/pull/10420) +* [[`25b76a44a7`](https://github.com/nodejs/node/commit/25b76a44a7)] - **test**: test error messages in test-dns-regress-7070 (Wallace Zhang) [#10058](https://github.com/nodejs/node/pull/10058) +* [[`8389a1eef4`](https://github.com/nodejs/node/commit/8389a1eef4)] - **test**: refactor test-pipe-file-to-http (Josh Mays) [#10054](https://github.com/nodejs/node/pull/10054) +* [[`f9f2cda5dc`](https://github.com/nodejs/node/commit/f9f2cda5dc)] - **test**: refactor test-cluster-send-handle-twice.js (Amar Zavery) [#10049](https://github.com/nodejs/node/pull/10049) +* [[`aba15fb9f2`](https://github.com/nodejs/node/commit/aba15fb9f2)] - **test**: add regex check in test-buffer-bad-overload (Sam Shull) [#10038](https://github.com/nodejs/node/pull/10038) +* [[`ac9348d79f`](https://github.com/nodejs/node/commit/ac9348d79f)] - **test**: refactoring test-pipe-head (Travis Bretton) [#10036](https://github.com/nodejs/node/pull/10036) +* [[`0ab2cfc64e`](https://github.com/nodejs/node/commit/0ab2cfc64e)] - **test**: add second argument to assert.throws() (Ken Russo) [#9987](https://github.com/nodejs/node/pull/9987) +* [[`610ec557a6`](https://github.com/nodejs/node/commit/610ec557a6)] - **test**: refactor test-child-process-ipc (malen) [#9990](https://github.com/nodejs/node/pull/9990) +* [[`ff3a1e69f5`](https://github.com/nodejs/node/commit/ff3a1e69f5)] - **test**: cleanup test-stdout-close-catch.js (Travis Bretton) [#10006](https://github.com/nodejs/node/pull/10006) +* [[`49e7029283`](https://github.com/nodejs/node/commit/49e7029283)] - **test**: refactor test-internal-modules (Christy Leung) [#10016](https://github.com/nodejs/node/pull/10016) +* [[`21a60912a8`](https://github.com/nodejs/node/commit/21a60912a8)] - **test**: refactor test-tls-interleave (Brian Chirgwin) [#10017](https://github.com/nodejs/node/pull/10017) +* [[`e53506ac01`](https://github.com/nodejs/node/commit/e53506ac01)] - **test**: update test-tls-check-server-identity.js (Kevin Cox) [#9986](https://github.com/nodejs/node/pull/9986) +* [[`bdf633a32e`](https://github.com/nodejs/node/commit/bdf633a32e)] - **test**: use const/let and common.mustCall (Outsider) [#9959](https://github.com/nodejs/node/pull/9959) +* [[`77334a2143`](https://github.com/nodejs/node/commit/77334a2143)] - **test**: refactoring test-cluster-worker-constructor (Christopher Rokita) [#9956](https://github.com/nodejs/node/pull/9956) +* [[`3c3d2d6776`](https://github.com/nodejs/node/commit/3c3d2d6776)] - **test**: refactor test-tls-client-getephemeralkeyinfo (Harish Tejwani) [#9954](https://github.com/nodejs/node/pull/9954) +* [[`da3ccb969d`](https://github.com/nodejs/node/commit/da3ccb969d)] - **test**: improve test-cluster-net-listen.js (Rico Cai) [#9953](https://github.com/nodejs/node/pull/9953) +* [[`9991bcbada`](https://github.com/nodejs/node/commit/9991bcbada)] - **test**: improve domain-top-level-error-handler-throw (CodeVana) [#9950](https://github.com/nodejs/node/pull/9950) +* [[`eff85e659f`](https://github.com/nodejs/node/commit/eff85e659f)] - **test**: refactor test-tls-0-dns-altname (Richard Karmazin) [#9948](https://github.com/nodejs/node/pull/9948) +* [[`b37fce91d3`](https://github.com/nodejs/node/commit/b37fce91d3)] - **test**: test: refactor test-sync-fileread (Jason Wohlgemuth) [#9941](https://github.com/nodejs/node/pull/9941) +* [[`420b3b851e`](https://github.com/nodejs/node/commit/420b3b851e)] - **test**: clean up repl-reset-event file (Kailean Courtney) [#9931](https://github.com/nodejs/node/pull/9931) +* [[`b8511aba04`](https://github.com/nodejs/node/commit/b8511aba04)] - **test**: replace var with const in test-require-dot (Amar Zavery) [#9916](https://github.com/nodejs/node/pull/9916) +* [[`68836ec455`](https://github.com/nodejs/node/commit/68836ec455)] - **test**: added validation regex argument to test (Avery, Frank) [#9918](https://github.com/nodejs/node/pull/9918) +* [[`70d3b808a0`](https://github.com/nodejs/node/commit/70d3b808a0)] - **test**: fix test-buffer-slow (Michaël Zasso) [#9809](https://github.com/nodejs/node/pull/9809) +* [[`3d368d0322`](https://github.com/nodejs/node/commit/3d368d0322)] - **test**: refactor test-buffer-bytelength (Michaël Zasso) [#9808](https://github.com/nodejs/node/pull/9808) +* [[`b5c8b355c8`](https://github.com/nodejs/node/commit/b5c8b355c8)] - **test**: add stdin-setrawmode.out file (Jonathan Darling) [#10149](https://github.com/nodejs/node/pull/10149) +* [[`e057925316`](https://github.com/nodejs/node/commit/e057925316)] - **test**: set stdin too for pseudo-tty tests (Anna Henningsen) [#10149](https://github.com/nodejs/node/pull/10149) +* [[`272a97178d`](https://github.com/nodejs/node/commit/272a97178d)] - **test**: refactor and fix test-crypto (Michaël Zasso) [#9807](https://github.com/nodejs/node/pull/9807) +* [[`65e27176f6`](https://github.com/nodejs/node/commit/65e27176f6)] - **test**: add child_process customFds test (cjihrig) [#9307](https://github.com/nodejs/node/pull/9307) +* [[`dc76aaef50`](https://github.com/nodejs/node/commit/dc76aaef50)] - **test**: refactor test-crypto-hmac (eudaimos) [#9958](https://github.com/nodejs/node/pull/9958) +* [[`1bbf143898`](https://github.com/nodejs/node/commit/1bbf143898)] - **test**: renamed assert.Equal to assert.strictEqual (Jared Young) +* [[`6dbff7aaed`](https://github.com/nodejs/node/commit/6dbff7aaed)] - **test**: convert assert.equal to assert.strictEqual (Jonathan Darling) [#9925](https://github.com/nodejs/node/pull/9925) +* [[`bbebebe087`](https://github.com/nodejs/node/commit/bbebebe087)] - **test**: strictEqual() and RegExp in test-buffer-fill.js (J Scott Chapman) [#9895](https://github.com/nodejs/node/pull/9895) +* [[`afbd8df7fd`](https://github.com/nodejs/node/commit/afbd8df7fd)] - **test**: increase coverage for lib/events.js (Safia Abdalla) [#9865](https://github.com/nodejs/node/pull/9865) +* [[`99ef3c0e45`](https://github.com/nodejs/node/commit/99ef3c0e45)] - **test**: run cpplint on files in test/cctest (Ben Noordhuis) [#9787](https://github.com/nodejs/node/pull/9787) +* [[`2ffd13e90d`](https://github.com/nodejs/node/commit/2ffd13e90d)] - **test**: move tick-processor tests to own directory (Rich Trott) [#9506](https://github.com/nodejs/node/pull/9506) +* [[`fb525f1507`](https://github.com/nodejs/node/commit/fb525f1507)] - **test**: fix error in test-cluster-worker-death.js (Bruce Lai) [#9981](https://github.com/nodejs/node/pull/9981) +* [[`1288d074ab`](https://github.com/nodejs/node/commit/1288d074ab)] - **test**: use `assert.strictEqual` (anoff) [#9975](https://github.com/nodejs/node/pull/9975) +* [[`653f2b76f3`](https://github.com/nodejs/node/commit/653f2b76f3)] - **test**: change assert.equal to assert.strictEqual (Aileen) [#9946](https://github.com/nodejs/node/pull/9946) +* [[`70c5e4fca2`](https://github.com/nodejs/node/commit/70c5e4fca2)] - **test**: changed assert.equal to assert.strictEqual (vazina robertson) [#10015](https://github.com/nodejs/node/pull/10015) +* [[`690cc2a88f`](https://github.com/nodejs/node/commit/690cc2a88f)] - **test**: improves test-tls-client-verify (Paul Graham) [#10051](https://github.com/nodejs/node/pull/10051) +* [[`780d444d3f`](https://github.com/nodejs/node/commit/780d444d3f)] - **test**: refactor test-https-agent-session-reuse (Diego Paez) [#10105](https://github.com/nodejs/node/pull/10105) +* [[`3686687cd2`](https://github.com/nodejs/node/commit/3686687cd2)] - **test**: refactor test-beforeexit-event (Rob Adelmann) [#10121](https://github.com/nodejs/node/pull/10121) +* [[`314b04d2d9`](https://github.com/nodejs/node/commit/314b04d2d9)] - **test**: improve test-fs-read-stream.js (Jenna Vuong) [#9629](https://github.com/nodejs/node/pull/9629) +* [[`a6bc868bf9`](https://github.com/nodejs/node/commit/a6bc868bf9)] - **test**: refactor test-domain-from-timer (Daniel Sims) [#9889](https://github.com/nodejs/node/pull/9889) +* [[`793addf585`](https://github.com/nodejs/node/commit/793addf585)] - **test**: refactor test-domain-exit-dispose-again (Ethan Arrowood) [#10003](https://github.com/nodejs/node/pull/10003) +* [[`faf0f2d254`](https://github.com/nodejs/node/commit/faf0f2d254)] - **test**: use const and strictEqual in test-os-homedir-no-envvar (CodeVana) [#9899](https://github.com/nodejs/node/pull/9899) +* [[`a696934faa`](https://github.com/nodejs/node/commit/a696934faa)] - **test**: check result of uv_loop_init and uv_write (Ben Noordhuis) [#10126](https://github.com/nodejs/node/pull/10126) +* [[`c2d7e67458`](https://github.com/nodejs/node/commit/c2d7e67458)] - **test**: refactor test-dgram-bind-default-address (Michael-Bryant Choa) [#9947](https://github.com/nodejs/node/pull/9947) +* [[`3c46ab69af`](https://github.com/nodejs/node/commit/3c46ab69af)] - **test**: assert.throws() should include a RegExp (Chris Bystrek) [#9976](https://github.com/nodejs/node/pull/9976) +* [[`0e3593a454`](https://github.com/nodejs/node/commit/0e3593a454)] - **test**: refactor test-listen-fd-ebadf (Richard Karmazin) [#10034](https://github.com/nodejs/node/pull/10034) +* [[`e49c7bbae3`](https://github.com/nodejs/node/commit/e49c7bbae3)] - **test**: refactor test-event-emitter-method-names (Rodrigo Palma) [#10027](https://github.com/nodejs/node/pull/10027) +* [[`290f359857`](https://github.com/nodejs/node/commit/290f359857)] - **test**: refactor tls-ticket-cluster (Yojan Shrestha) [#10023](https://github.com/nodejs/node/pull/10023) +* [[`5d9c224384`](https://github.com/nodejs/node/commit/5d9c224384)] - **test**: refactor test-domain-exit-dispose (Chris Henney) [#9938](https://github.com/nodejs/node/pull/9938) +* [[`7c929591c1`](https://github.com/nodejs/node/commit/7c929591c1)] - **test**: refactor test-stdin-from-file.js (amrios) [#10012](https://github.com/nodejs/node/pull/10012) +* [[`9af076e97d`](https://github.com/nodejs/node/commit/9af076e97d)] - **test**: use ES6 to update let & const (Jason Humphrey) [#9917](https://github.com/nodejs/node/pull/9917) +* [[`dd4586bd41`](https://github.com/nodejs/node/commit/dd4586bd41)] - **test**: fix test for buffer regression #649 (joyeecheung) [#9924](https://github.com/nodejs/node/pull/9924) +* [[`fed9acd8af`](https://github.com/nodejs/node/commit/fed9acd8af)] - **test**: update parallel/test-crypto-hash.js (Deepti Agrawal) [#10009](https://github.com/nodejs/node/pull/10009) +* [[`d64cb1e04e`](https://github.com/nodejs/node/commit/d64cb1e04e)] - **test**: refactor test-require-extensions-main (Daryl Thayil) [#9912](https://github.com/nodejs/node/pull/9912) +* [[`cdb803d18b`](https://github.com/nodejs/node/commit/cdb803d18b)] - **test**: refactor test-tls-ocsp-callback (k3kathy) [#9970](https://github.com/nodejs/node/pull/9970) +* [[`78b5a8d5c2`](https://github.com/nodejs/node/commit/78b5a8d5c2)] - **test**: use assert.strictEqual and fix setTimeout (Matt Phillips) [#9957](https://github.com/nodejs/node/pull/9957) +* [[`f4c8044007`](https://github.com/nodejs/node/commit/f4c8044007)] - **test**: clean up tls junk test (Danny Guo) [#9940](https://github.com/nodejs/node/pull/9940) +* [[`626d59f7a6`](https://github.com/nodejs/node/commit/626d59f7a6)] - **test**: update test-stdout-to-file (scalkpdev) [#9939](https://github.com/nodejs/node/pull/9939) +* [[`223ec17080`](https://github.com/nodejs/node/commit/223ec17080)] - **test**: changed assert.Equal to asset.strictEqual (Paul Chin) [#9973](https://github.com/nodejs/node/pull/9973) +* [[`230d552a85`](https://github.com/nodejs/node/commit/230d552a85)] - **test**: refactor test-domain-multi (Wes Tyler) [#9963](https://github.com/nodejs/node/pull/9963) +* [[`b893dc986c`](https://github.com/nodejs/node/commit/b893dc986c)] - **test**: refactor test-fs-write.js (hirabhullar) [#9982](https://github.com/nodejs/node/pull/9982) +* [[`c506b7be90`](https://github.com/nodejs/node/commit/c506b7be90)] - **test**: refactor test-child-fork-exec-path.js (hirabhullar) [#9982](https://github.com/nodejs/node/pull/9982) +* [[`050bae63f1`](https://github.com/nodejs/node/commit/050bae63f1)] - **test**: use assert.strictEqual in test-cli-eval (Nigel Kibodeaux) [#9919](https://github.com/nodejs/node/pull/9919) +* [[`2a514f20e1`](https://github.com/nodejs/node/commit/2a514f20e1)] - **test**: refactor test-tls-connect-simple (Russell Sherman) [#9934](https://github.com/nodejs/node/pull/9934) +* [[`75c37fa8a2`](https://github.com/nodejs/node/commit/75c37fa8a2)] - **test**: refactor test-signal-unregister (mark hughes) [#9920](https://github.com/nodejs/node/pull/9920) +* [[`093adcac9a`](https://github.com/nodejs/node/commit/093adcac9a)] - **test**: update test-net-connect-handle-econnrefused (Punit Buch) [#9932](https://github.com/nodejs/node/pull/9932) +* [[`75712a3032`](https://github.com/nodejs/node/commit/75712a3032)] - **test**: refactor test-require-resolve (blugavere) [#10120](https://github.com/nodejs/node/pull/10120) +* [[`4a28eac54b`](https://github.com/nodejs/node/commit/4a28eac54b)] - **test**: refactor test-fs-symlink-dir-junction (Walter Beller-Morales) [#9928](https://github.com/nodejs/node/pull/9928) +* [[`09de7149f2`](https://github.com/nodejs/node/commit/09de7149f2)] - **test**: refactor test-fs-read-stream-resume (Matt Webb) [#9927](https://github.com/nodejs/node/pull/9927) +* [[`8ce6dd2a57`](https://github.com/nodejs/node/commit/8ce6dd2a57)] - **test**: replace equal with strictEqual (Tracy Hinds) [#10011](https://github.com/nodejs/node/pull/10011) +* [[`3b765cb231`](https://github.com/nodejs/node/commit/3b765cb231)] - **test**: use strictEqual instead of equal (Uttam Pawar) [#9921](https://github.com/nodejs/node/pull/9921) +* [[`baa0adfe46`](https://github.com/nodejs/node/commit/baa0adfe46)] - **test**: using const and strictEqual (Fabrice Tatieze) [#9926](https://github.com/nodejs/node/pull/9926) +* [[`8ceca4a135`](https://github.com/nodejs/node/commit/8ceca4a135)] - **test**: changed assert.equal to assert.strictEqual (Scott Smereka) [#9936](https://github.com/nodejs/node/pull/9936) +* [[`f248c67da6`](https://github.com/nodejs/node/commit/f248c67da6)] - **test**: test-file-write-stream3.js refactor (Richard Karmazin) [#10035](https://github.com/nodejs/node/pull/10035) +* [[`dd4f9195f1`](https://github.com/nodejs/node/commit/dd4f9195f1)] - **test**: implemented es6 conventions (Erez Weiss) [#9669](https://github.com/nodejs/node/pull/9669) +* [[`c30332daa6`](https://github.com/nodejs/node/commit/c30332daa6)] - **test**: Modernize test-tls-peer-certificate.js (Ilya Potuzhnov) [#10014](https://github.com/nodejs/node/pull/10014) +* [[`ba5e37765a`](https://github.com/nodejs/node/commit/ba5e37765a)] - **test**: strictCompare and explcit inputs mprovement to test-buffer-slice (Michael Alexander) [#10048](https://github.com/nodejs/node/pull/10048) +* [[`ec7df6c0a4`](https://github.com/nodejs/node/commit/ec7df6c0a4)] - **test**: add test for process.stdin.setRawMode() (Jonathan Darling) [#10037](https://github.com/nodejs/node/pull/10037) +* [[`4fce85554a`](https://github.com/nodejs/node/commit/4fce85554a)] - **test**: refactor test for net listen on fd0 (Julian Duque) [#10025](https://github.com/nodejs/node/pull/10025) +* [[`b7619e3b16`](https://github.com/nodejs/node/commit/b7619e3b16)] - **test**: update assert.equal() to assert.strictEqual() (Peter Diaz) [#10024](https://github.com/nodejs/node/pull/10024) +* [[`a6096041c6`](https://github.com/nodejs/node/commit/a6096041c6)] - **test**: use const or let and assert.strictEqual (Christopher Rokita) [#10001](https://github.com/nodejs/node/pull/10001) +* [[`cc8100a529`](https://github.com/nodejs/node/commit/cc8100a529)] - **test**: fix buffer alloc tests (levsoroka) [#9998](https://github.com/nodejs/node/pull/9998) +* [[`eb61d918b1`](https://github.com/nodejs/node/commit/eb61d918b1)] - **test**: Added more validations to setEncoding (Paul Lucas) [#9997](https://github.com/nodejs/node/pull/9997) +* [[`fe59a67b6e`](https://github.com/nodejs/node/commit/fe59a67b6e)] - **test**: use strictEqual() domain-http (cdnadmin) [#9996](https://github.com/nodejs/node/pull/9996) +* [[`ced89ede03`](https://github.com/nodejs/node/commit/ced89ede03)] - **test**: refactor test-cluster-worker-events (fmizzell) [#9994](https://github.com/nodejs/node/pull/9994) +* [[`aea0d47b77`](https://github.com/nodejs/node/commit/aea0d47b77)] - **test**: update repl tests (makenova) [#9991](https://github.com/nodejs/node/pull/9991) +* [[`a749604e11`](https://github.com/nodejs/node/commit/a749604e11)] - **test**: modernize test-fs-truncate-fd (Nigel Kibodeaux) [#9978](https://github.com/nodejs/node/pull/9978) +* [[`1addb3ba53`](https://github.com/nodejs/node/commit/1addb3ba53)] - **test**: update tls test to use const/let and common.mustCall (rgoodwin) [#9968](https://github.com/nodejs/node/pull/9968) +* [[`6d79c0cd2c`](https://github.com/nodejs/node/commit/6d79c0cd2c)] - **test**: adding strictEqual to test-buffer-indexof.js (Eric Gonzalez) [#9955](https://github.com/nodejs/node/pull/9955) +* [[`eeab546fb6`](https://github.com/nodejs/node/commit/eeab546fb6)] - **test**: strictEqual in test-beforeexit-event.js (CodeTheInternet) [#10004](https://github.com/nodejs/node/pull/10004) +* [[`b71d3fd748`](https://github.com/nodejs/node/commit/b71d3fd748)] - **test**: refactor test-child-process-double-pipe (Dan Villa) [#9930](https://github.com/nodejs/node/pull/9930) +* [[`47c925a4ac`](https://github.com/nodejs/node/commit/47c925a4ac)] - **test**: updated tls-getcipher test (Ethan Arrowood) [#9923](https://github.com/nodejs/node/pull/9923) +* [[`bc3b77f525`](https://github.com/nodejs/node/commit/bc3b77f525)] - **test**: replace equal with strictEqual in test-freelist.js (Adrian Estrada) [#9910](https://github.com/nodejs/node/pull/9910) +* [[`5afcf3ac78`](https://github.com/nodejs/node/commit/5afcf3ac78)] - **test**: updated test-stream-pipe-unpipe-stream (Raja Panidepu) [#10100](https://github.com/nodejs/node/pull/10100) +* [[`3aa51ecb6f`](https://github.com/nodejs/node/commit/3aa51ecb6f)] - **test**: refactor test-crypto-ecb (michael6) [#10029](https://github.com/nodejs/node/pull/10029) +* [[`af5c4a9958`](https://github.com/nodejs/node/commit/af5c4a9958)] - **test**: refactor test-require-exceptions (Oscar Martinez) [#9882](https://github.com/nodejs/node/pull/9882) +* [[`26d61c3dbc`](https://github.com/nodejs/node/commit/26d61c3dbc)] - **test**: refactor test-console (Matt Crummey) [#9873](https://github.com/nodejs/node/pull/9873) +* [[`5ba08d9473`](https://github.com/nodejs/node/commit/5ba08d9473)] - **test**: refactor test-crypto-certificate (Josh Mays) [#9911](https://github.com/nodejs/node/pull/9911) +* [[`81def1857d`](https://github.com/nodejs/node/commit/81def1857d)] - **test**: refactor dgram-send-multi-buffer-copy (Konstantin Likhter) [#9909](https://github.com/nodejs/node/pull/9909) +* [[`6fc75ba498`](https://github.com/nodejs/node/commit/6fc75ba498)] - **test**: refactor test-domain (Johnny Reading) [#9890](https://github.com/nodejs/node/pull/9890) +* [[`b343a584e6`](https://github.com/nodejs/node/commit/b343a584e6)] - **test**: refactor test-cli-syntax (Exlipse7) [#10057](https://github.com/nodejs/node/pull/10057) +* [[`76dda9ca37`](https://github.com/nodejs/node/commit/76dda9ca37)] - **test**: refactor test-child-process-constructor (k3kathy) [#10060](https://github.com/nodejs/node/pull/10060) +* [[`f78b81750d`](https://github.com/nodejs/node/commit/f78b81750d)] - **test**: refactor test-repl-mode.js (Cesar Hernandez) [#10061](https://github.com/nodejs/node/pull/10061) +* [[`2127798eaa`](https://github.com/nodejs/node/commit/2127798eaa)] - **test**: var to const, assert.equal to assert.strictEqual in net (Sean Villars) [#9907](https://github.com/nodejs/node/pull/9907) +* [[`cf9f6f8dbf`](https://github.com/nodejs/node/commit/cf9f6f8dbf)] - **test**: changed vars to const in test-net-better-error-messages-listen-path.js (anoff) [#9905](https://github.com/nodejs/node/pull/9905) +* [[`e9d4665b29`](https://github.com/nodejs/node/commit/e9d4665b29)] - **test**: use const instead of var in test-require-json.js (Sarah Meyer) [#9904](https://github.com/nodejs/node/pull/9904) +* [[`f4b6b9faa7`](https://github.com/nodejs/node/commit/f4b6b9faa7)] - **test**: refactor test-http-dns-error (Outsider) [#10062](https://github.com/nodejs/node/pull/10062) +* [[`7a228fe4ae`](https://github.com/nodejs/node/commit/7a228fe4ae)] - **test**: Changed assert.equal to assert.strictEqual (Daniel Pittman) [#9902](https://github.com/nodejs/node/pull/9902) +* [[`7c4b59f9b1`](https://github.com/nodejs/node/commit/7c4b59f9b1)] - **test**: refactor test-vm-syntax-error-stderr.js (Jay Brownlee) [#9900](https://github.com/nodejs/node/pull/9900) +* [[`5d28864d7f`](https://github.com/nodejs/node/commit/5d28864d7f)] - **test**: refactor test-tls-destroy-whilst-write (Chris Bystrek) [#10064](https://github.com/nodejs/node/pull/10064) +* [[`1c3227fd8c`](https://github.com/nodejs/node/commit/1c3227fd8c)] - **test**: refactor test-net-dns-custom-lookup (Kent.Fan) [#10071](https://github.com/nodejs/node/pull/10071) +* [[`9b7d7487ef`](https://github.com/nodejs/node/commit/9b7d7487ef)] - **test**: refactor test-https-truncate (davidmarkclements) [#10074](https://github.com/nodejs/node/pull/10074) +* [[`d698f9d0ac`](https://github.com/nodejs/node/commit/d698f9d0ac)] - **test**: refactor test-tls-server-verify (Hutson Betts) [#10076](https://github.com/nodejs/node/pull/10076) +* [[`7277c376c2`](https://github.com/nodejs/node/commit/7277c376c2)] - **test**: use strictEqual in test-cli-eval-event.js (Richard Karmazin) [#9964](https://github.com/nodejs/node/pull/9964) +* [[`404306fd0e`](https://github.com/nodejs/node/commit/404306fd0e)] - **test**: refactor test-crypto-padding.js (Konstantin Likhter) [#9971](https://github.com/nodejs/node/pull/9971) +* [[`821518d4e4`](https://github.com/nodejs/node/commit/821518d4e4)] - **test**: refactor test-tls-friendly-error-message.js (Adrian Estrada) [#9967](https://github.com/nodejs/node/pull/9967) +* [[`55269c106b`](https://github.com/nodejs/node/commit/55269c106b)] - **test**: refactor test-fs-append-file.js (adelmann) [#10110](https://github.com/nodejs/node/pull/10110) +* [[`bffbf6881a`](https://github.com/nodejs/node/commit/bffbf6881a)] - **test**: assert.equal -> assert.strictEqual (davidmarkclements) [#10065](https://github.com/nodejs/node/pull/10065) +* [[`f10c3210a1`](https://github.com/nodejs/node/commit/f10c3210a1)] - **test**: refactor test-dgram-exclusive-implicit-bind (Cesar Hernandez) [#10066](https://github.com/nodejs/node/pull/10066) +* [[`67b11a429b`](https://github.com/nodejs/node/commit/67b11a429b)] - **test**: assert.equal -> assert.strictEqual (davidmarkclements) [#10067](https://github.com/nodejs/node/pull/10067) +* [[`bb950a6997`](https://github.com/nodejs/node/commit/bb950a6997)] - **test**: improve test for crypto padding (Julian Duque) [#9906](https://github.com/nodejs/node/pull/9906) +* [[`7bf13f3834`](https://github.com/nodejs/node/commit/7bf13f3834)] - **test**: polish test-net-better-error-messages-listen (Hitesh Kanwathirtha) [#10087](https://github.com/nodejs/node/pull/10087) +* [[`776cfc5898`](https://github.com/nodejs/node/commit/776cfc5898)] - **test**: change var to const in test-tls-key-mismatch.js (bjdelro) [#9897](https://github.com/nodejs/node/pull/9897) +* [[`f3ef0d9c1b`](https://github.com/nodejs/node/commit/f3ef0d9c1b)] - **test**: use strictEqual in cwd-enoent (JDHarmon) [#10077](https://github.com/nodejs/node/pull/10077) +* [[`5377f72b5a`](https://github.com/nodejs/node/commit/5377f72b5a)] - **test**: refactor test-fs-read-stream-inherit.js (Jonathan Darling) [#9894](https://github.com/nodejs/node/pull/9894) +* [[`a11f9ab82e`](https://github.com/nodejs/node/commit/a11f9ab82e)] - **test**: refactor test-child-process-stdio-inherit (Wes Tyler) [#9893](https://github.com/nodejs/node/pull/9893) +* [[`80e3aabedd`](https://github.com/nodejs/node/commit/80e3aabedd)] - **test**: change var to const for require and strict equality checks (Harish Tejwani) [#9892](https://github.com/nodejs/node/pull/9892) +* [[`8097b3b1ec`](https://github.com/nodejs/node/commit/8097b3b1ec)] - **test**: Update to const and use regex for assertions (Daniel Flores) [#9891](https://github.com/nodejs/node/pull/9891) +* [[`6d5b21517a`](https://github.com/nodejs/node/commit/6d5b21517a)] - **test**: swap var->const/let and equal->strictEqual (Peter Masucci) [#9888](https://github.com/nodejs/node/pull/9888) +* [[`5446b3c6a0`](https://github.com/nodejs/node/commit/5446b3c6a0)] - **test**: replace equal with strictEqual in crypto (Julian Duque) [#9886](https://github.com/nodejs/node/pull/9886) +* [[`0c66f68fe2`](https://github.com/nodejs/node/commit/0c66f68fe2)] - **test**: replace equal with strictEqual (Julian Duque) [#9879](https://github.com/nodejs/node/pull/9879) +* [[`c5bfe90900`](https://github.com/nodejs/node/commit/c5bfe90900)] - **test**: var to const/let in test-tls-set-ciphers (rajatk) [#9877](https://github.com/nodejs/node/pull/9877) +* [[`7fa3b6fad3`](https://github.com/nodejs/node/commit/7fa3b6fad3)] - **test**: refactor test-tls-timeout-server-2 (Devon Rifkin) [#9876](https://github.com/nodejs/node/pull/9876) +* [[`e6747048e7`](https://github.com/nodejs/node/commit/e6747048e7)] - **test**: Updating vars to const and tsl server test (Matt Webb) [#9874](https://github.com/nodejs/node/pull/9874) +* [[`393cb97cbb`](https://github.com/nodejs/node/commit/393cb97cbb)] - **test**: refactor test-crypto-hash-stream-pipe (Matt Wilson) [#10055](https://github.com/nodejs/node/pull/10055) +* [[`b48d83190a`](https://github.com/nodejs/node/commit/b48d83190a)] - **test**: crypto-hash-stream-pipe use strict equal (Mitchell Stoutin) [#9935](https://github.com/nodejs/node/pull/9935) +* [[`91b942ec8a`](https://github.com/nodejs/node/commit/91b942ec8a)] - **test**: refactor child-process-spawn-error (Johnny Reading) [#9951](https://github.com/nodejs/node/pull/9951) +* [[`a2e88f6e0c`](https://github.com/nodejs/node/commit/a2e88f6e0c)] - **test**: refactor test-child-process-spawn-error (stokingerl) [#9937](https://github.com/nodejs/node/pull/9937) +* [[`52cc1bb08e`](https://github.com/nodejs/node/commit/52cc1bb08e)] - **test**: refactor test-vm-static-this.js (David Bradford) [#9887](https://github.com/nodejs/node/pull/9887) +* [[`895472474b`](https://github.com/nodejs/node/commit/895472474b)] - **test**: refactor test-crypto-cipheriv-decipheriv (Aileen) [#10018](https://github.com/nodejs/node/pull/10018) +* [[`c4277d9b5e`](https://github.com/nodejs/node/commit/c4277d9b5e)] - **test**: refactor test for crypto cipher/decipher iv (Julian Duque) [#9943](https://github.com/nodejs/node/pull/9943) +* [[`346ea432b4`](https://github.com/nodejs/node/commit/346ea432b4)] - **test**: refactor test-cluster-setup-master-argv (Oscar Martinez) [#9960](https://github.com/nodejs/node/pull/9960) +* [[`5009de4a53`](https://github.com/nodejs/node/commit/5009de4a53)] - **test**: refactor test-cluster-setup-master-argv (Christine Hong) [#9993](https://github.com/nodejs/node/pull/9993) +* [[`e75f81495d`](https://github.com/nodejs/node/commit/e75f81495d)] - **test**: refactor test-fs-append-file-sync (Chris Bystrek) [#10056](https://github.com/nodejs/node/pull/10056) +* [[`61225eac1a`](https://github.com/nodejs/node/commit/61225eac1a)] - **test**: refactor test-fs-append-file-sync (Ian White) [#9977](https://github.com/nodejs/node/pull/9977) +* [[`f093760166`](https://github.com/nodejs/node/commit/f093760166)] - **test**: use assert.strictEqual in test-crypto-ecb (Daniel Pittman) [#9980](https://github.com/nodejs/node/pull/9980) +* [[`1bbaace480`](https://github.com/nodejs/node/commit/1bbaace480)] - **test**: refactor test-fs-write-file (adelmann) [#10030](https://github.com/nodejs/node/pull/10030) +* [[`ac5bf86fd1`](https://github.com/nodejs/node/commit/ac5bf86fd1)] - **test**: refactor test/parallel/test-fs-write-file.js (Kyle Carter) [#9992](https://github.com/nodejs/node/pull/9992) +* [[`bf71b63444`](https://github.com/nodejs/node/commit/bf71b63444)] - **test**: update to const iin cluster test (Greg Valdez) [#10007](https://github.com/nodejs/node/pull/10007) +* [[`a36389ee08`](https://github.com/nodejs/node/commit/a36389ee08)] - **test**: use assert.strictEqual() cluster test (Bidur Adhikari) [#10042](https://github.com/nodejs/node/pull/10042) +* [[`effa15ead9`](https://github.com/nodejs/node/commit/effa15ead9)] - **test**: use const in test-crypto-pbkdf2 (Greg Valdez) [#9974](https://github.com/nodejs/node/pull/9974) +* [[`59f643096a`](https://github.com/nodejs/node/commit/59f643096a)] - **test**: improve test for crypto pbkdf2 (joyeecheung) [#9883](https://github.com/nodejs/node/pull/9883) +* [[`503167ba36`](https://github.com/nodejs/node/commit/503167ba36)] - **test**: var -> let/const, .equal -> .strictEqual (shiya) [#9913](https://github.com/nodejs/node/pull/9913) +* [[`f1d0bf4757`](https://github.com/nodejs/node/commit/f1d0bf4757)] - **test**: increase coverage for timers (lrlna) [#10068](https://github.com/nodejs/node/pull/10068) +* [[`e14a597d35`](https://github.com/nodejs/node/commit/e14a597d35)] - **test**: change equal to strictEqual (Kevin Zurawel) [#9872](https://github.com/nodejs/node/pull/9872) +* [[`076c2c2c54`](https://github.com/nodejs/node/commit/076c2c2c54)] - **test**: test for http.request() invalid method error (Ashton Kinslow) [#10080](https://github.com/nodejs/node/pull/10080) +* [[`f38cb9bbe2`](https://github.com/nodejs/node/commit/f38cb9bbe2)] - **test**: update net-local-address-port (scalkpdev) [#9885](https://github.com/nodejs/node/pull/9885) +* [[`c9ac2b366f`](https://github.com/nodejs/node/commit/c9ac2b366f)] - **test**: refactor test-tls-ecdh (Adriana Rios) [#9878](https://github.com/nodejs/node/pull/9878) +* [[`5186604fa9`](https://github.com/nodejs/node/commit/5186604fa9)] - **test**: refactor test-vm-debug-context (makenova) [#9875](https://github.com/nodejs/node/pull/9875) +* [[`fcc511a57b`](https://github.com/nodejs/node/commit/fcc511a57b)] - **test**: use strictEqual in test-zlib-truncated (ben_cripps) [#9858](https://github.com/nodejs/node/pull/9858) +* [[`e55a5936cd`](https://github.com/nodejs/node/commit/e55a5936cd)] - **test**: use strictEqual in test-debugger-client.js (ben_cripps) [#9857](https://github.com/nodejs/node/pull/9857) +* [[`a773843c01`](https://github.com/nodejs/node/commit/a773843c01)] - **test**: refactor test-debug-args (Rich Trott) [#9833](https://github.com/nodejs/node/pull/9833) +* [[`015812e2b8`](https://github.com/nodejs/node/commit/015812e2b8)] - **test**: refactor test-fs-non-number-arguments-throw (Michaël Zasso) [#9844](https://github.com/nodejs/node/pull/9844) +* [[`74919eb5ef`](https://github.com/nodejs/node/commit/74919eb5ef)] - **test**: replace assert.equal with assert.strictEqual (brad-decker) [#9842](https://github.com/nodejs/node/pull/9842) +* [[`0605c74538`](https://github.com/nodejs/node/commit/0605c74538)] - **test**: refactor test-crypto-timing-safe-equal (Michaël Zasso) [#9843](https://github.com/nodejs/node/pull/9843) +* [[`b93c3d89f5`](https://github.com/nodejs/node/commit/b93c3d89f5)] - **test**: add toASCII and toUnicode punycode tests (Claudio Rodriguez) [#9741](https://github.com/nodejs/node/pull/9741) +* [[`51c8fe0c66`](https://github.com/nodejs/node/commit/51c8fe0c66)] - **test**: refactor test-util-inspect (Rich Trott) [#9804](https://github.com/nodejs/node/pull/9804) +* [[`e2e51c52c9`](https://github.com/nodejs/node/commit/e2e51c52c9)] - **test**: refactor test-preload (Rich Trott) [#9803](https://github.com/nodejs/node/pull/9803) +* [[`8c6b127c93`](https://github.com/nodejs/node/commit/8c6b127c93)] - **test**: refine test-http-status-reason-invalid-chars (Rich Trott) [#9802](https://github.com/nodejs/node/pull/9802) +* [[`ca0e577673`](https://github.com/nodejs/node/commit/ca0e577673)] - **test**: refactor test-crypto-binary-default (Michaël Zasso) [#9810](https://github.com/nodejs/node/pull/9810) +* [[`3219586512`](https://github.com/nodejs/node/commit/3219586512)] - **test**: refactor test-net-pingpong (Michaël Zasso) [#9812](https://github.com/nodejs/node/pull/9812) +* [[`ca461bf561`](https://github.com/nodejs/node/commit/ca461bf561)] - **test**: refactor and fix test-dns (Michaël Zasso) [#9811](https://github.com/nodejs/node/pull/9811) +* [[`aebc8dfa57`](https://github.com/nodejs/node/commit/aebc8dfa57)] - **test**: fix flaky test-cluster-dgram-2 (Rich Trott) [#9791](https://github.com/nodejs/node/pull/9791) +* [[`5542a72558`](https://github.com/nodejs/node/commit/5542a72558)] - **test**: fix test-tls-connect-address-family (mkamakura) [#9573](https://github.com/nodejs/node/pull/9573) +* [[`6105c91f89`](https://github.com/nodejs/node/commit/6105c91f89)] - **test**: fix test-http-status-reason-invalid-chars (Yosuke Saito) [#9572](https://github.com/nodejs/node/pull/9572) +* [[`d1f5e99a2a`](https://github.com/nodejs/node/commit/d1f5e99a2a)] - **test**: refactor test-child-process-exec-error (Rich Trott) [#9780](https://github.com/nodejs/node/pull/9780) +* [[`0772984cb3`](https://github.com/nodejs/node/commit/0772984cb3)] - **test**: refactor common.js (Rich Trott) [#9732](https://github.com/nodejs/node/pull/9732) +* [[`605c84f8d6`](https://github.com/nodejs/node/commit/605c84f8d6)] - **test**: exclude no_interleaved_stdio test for AIX (Michael Dawson) [#9772](https://github.com/nodejs/node/pull/9772) +* [[`75bebbf3a0`](https://github.com/nodejs/node/commit/75bebbf3a0)] - **test**: fix flaky test-dgram-empty-packet & friends (Rich Trott) [#9724](https://github.com/nodejs/node/pull/9724) +* [[`1296a689b6`](https://github.com/nodejs/node/commit/1296a689b6)] - **test**: fix flaky test-inspector (Rich Trott) [#9727](https://github.com/nodejs/node/pull/9727) +* [[`c5e806c894`](https://github.com/nodejs/node/commit/c5e806c894)] - **test**: refactor test-tls-hello-parser-failure (Rich Trott) [#9715](https://github.com/nodejs/node/pull/9715) +* [[`9e4ce6fc8e`](https://github.com/nodejs/node/commit/9e4ce6fc8e)] - **test**: refactor test-async-wrap-* (Rich Trott) [#9663](https://github.com/nodejs/node/pull/9663) +* [[`31304144cd`](https://github.com/nodejs/node/commit/31304144cd)] - **test**: Use strictEqual in test-tls-writewrap-leak (Aaron Petcoff) [#9666](https://github.com/nodejs/node/pull/9666) +* [[`333e5d1c49`](https://github.com/nodejs/node/commit/333e5d1c49)] - **test**: run tests even if os.cpus() fails (Bethany Griggs) [#9616](https://github.com/nodejs/node/pull/9616) +* [[`1bb626610a`](https://github.com/nodejs/node/commit/1bb626610a)] - **test**: use setImmediate() in test of stream2 (masashi.g) [#9583](https://github.com/nodejs/node/pull/9583) +* [[`70691e3c53`](https://github.com/nodejs/node/commit/70691e3c53)] - **test**: add test case of PassThrough (Yoshiya Hinosawa) [#9581](https://github.com/nodejs/node/pull/9581) +* [[`7e031170a6`](https://github.com/nodejs/node/commit/7e031170a6)] - **test**: check that `process.execPath` is a realpath (Anna Henningsen) [#9229](https://github.com/nodejs/node/pull/9229) +* [[`14fead0299`](https://github.com/nodejs/node/commit/14fead0299)] - **test**: add test for broken child process stdio (cjihrig) [#9528](https://github.com/nodejs/node/pull/9528) +* [[`2c5e6afd97`](https://github.com/nodejs/node/commit/2c5e6afd97)] - **test**: ensure nextTick is not scheduled in exit (Jeremiah Senkpiel) [#9555](https://github.com/nodejs/node/pull/9555) +* [[`f7a2f75fa9`](https://github.com/nodejs/node/commit/f7a2f75fa9)] - **test**: increase coverage of process.emitWarning (Jeremiah Senkpiel) [#9556](https://github.com/nodejs/node/pull/9556) +* [[`7bd9ecdb14`](https://github.com/nodejs/node/commit/7bd9ecdb14)] - **test**: refactor test-zlib.js (Rich Trott) [#9544](https://github.com/nodejs/node/pull/9544) +* [[`8a94c69c79`](https://github.com/nodejs/node/commit/8a94c69c79)] - **test**: change from setTimeout to setImmediate (MURAKAMI Masahiko) [#9578](https://github.com/nodejs/node/pull/9578) +* [[`92f8073879`](https://github.com/nodejs/node/commit/92f8073879)] - **test**: improve test-stream2-objects.js (Yoshiya Hinosawa) [#9565](https://github.com/nodejs/node/pull/9565) +* [[`64d7ea9ce4`](https://github.com/nodejs/node/commit/64d7ea9ce4)] - **test**: refactor test-next-tick-error-spin (Rich Trott) [#9537](https://github.com/nodejs/node/pull/9537) +* [[`d8eb4c2595`](https://github.com/nodejs/node/commit/d8eb4c2595)] - **test**: refactor test-tls-inception (Rich Trott) [#9536](https://github.com/nodejs/node/pull/9536) +* [[`0db54ab98e`](https://github.com/nodejs/node/commit/0db54ab98e)] - **test**: refactor inspector-helper.js (Rich Trott) [#9499](https://github.com/nodejs/node/pull/9499) +* [[`31a3328269`](https://github.com/nodejs/node/commit/31a3328269)] - **test**: refactor make-callback-recurse test (Rich Trott) [#9498](https://github.com/nodejs/node/pull/9498) +* [[`9808985689`](https://github.com/nodejs/node/commit/9808985689)] - **test**: move timer-dependent test to sequential (Rich Trott) [#9487](https://github.com/nodejs/node/pull/9487) +* [[`e97c610850`](https://github.com/nodejs/node/commit/e97c610850)] - **test**: fix helper-debugger-repl.js (Rich Trott) [#9486](https://github.com/nodejs/node/pull/9486) +* [[`13b16881ef`](https://github.com/nodejs/node/commit/13b16881ef)] - **test,url**: improve escaping in url.parse (joyeecheung) [#10083](https://github.com/nodejs/node/pull/10083) +* [[`8bb66cd920`](https://github.com/nodejs/node/commit/8bb66cd920)] - **timers**: use consistent checks for canceled timers (Jeremiah Senkpiel) [#9685](https://github.com/nodejs/node/pull/9685) +* [[`e355604aa5`](https://github.com/nodejs/node/commit/e355604aa5)] - **tools**: forbid template literals in assert.throws (Michaël Zasso) [#10301](https://github.com/nodejs/node/pull/10301) +* [[`9c85d0f396`](https://github.com/nodejs/node/commit/9c85d0f396)] - **tools**: add ESLint rule for assert.throws arguments (Michaël Zasso) [#10089](https://github.com/nodejs/node/pull/10089) +* [[`a5d27f3515`](https://github.com/nodejs/node/commit/a5d27f3515)] - **tools**: enable final newline in .editorconfig (Roman Reiss) [#9410](https://github.com/nodejs/node/pull/9410) +* [[`e94b72e41e`](https://github.com/nodejs/node/commit/e94b72e41e)] - **tools**: remove unneeded escaping in generate.js (Rich Trott) [#9781](https://github.com/nodejs/node/pull/9781) +* [[`f05f0fe74e`](https://github.com/nodejs/node/commit/f05f0fe74e)] - **tools**: disallow trailing whitespace for markdown (Sam Roberts) [#9676](https://github.com/nodejs/node/pull/9676) +* [[`0256b7b057`](https://github.com/nodejs/node/commit/0256b7b057)] - **tools**: use better regexp for manpage references (Anna Henningsen) [#9632](https://github.com/nodejs/node/pull/9632) +* [[`232026d8b9`](https://github.com/nodejs/node/commit/232026d8b9)] - **tools**: improve docopen target in Makefile (Sakthipriyan Vairamani (thefourtheye)) [#9436](https://github.com/nodejs/node/pull/9436) +* [[`79e0577702`](https://github.com/nodejs/node/commit/79e0577702)] - **tools**: make run-valgrind.py useful (Ben Noordhuis) [#9520](https://github.com/nodejs/node/pull/9520) +* [[`8a8646c0b2`](https://github.com/nodejs/node/commit/8a8646c0b2)] - **tools**: fix run-valgrind.py script (Ben Noordhuis) [#9520](https://github.com/nodejs/node/pull/9520) +* [[`5401b04648`](https://github.com/nodejs/node/commit/5401b04648)] - **tools**: copy run-valgrind.py to tools/ (Ben Noordhuis) [#9520](https://github.com/nodejs/node/pull/9520) +* [[`12fe071abf`](https://github.com/nodejs/node/commit/12fe071abf)] - **util**: move the case 'latin1' (Jackson Tian) [#9646](https://github.com/nodejs/node/pull/9646) + ## 2016-12-06, Version 6.9.2 'Boron' (LTS), @thealphanerd diff --git a/src/node_version.h b/src/node_version.h index dac327619ba4d5..bdbcf095343319 100644 --- a/src/node_version.h +++ b/src/node_version.h @@ -8,7 +8,7 @@ #define NODE_VERSION_IS_LTS 1 #define NODE_VERSION_LTS_CODENAME "Boron" -#define NODE_VERSION_IS_RELEASE 0 +#define NODE_VERSION_IS_RELEASE 1 #ifndef NODE_STRINGIFY #define NODE_STRINGIFY(n) NODE_STRINGIFY_HELPER(n)