diff --git a/lib/internal/worker.js b/lib/internal/worker.js index 41432f55e94d35..88580893cdc015 100644 --- a/lib/internal/worker.js +++ b/lib/internal/worker.js @@ -71,7 +71,6 @@ Object.setPrototypeOf(MessagePort.prototype, EventEmitter.prototype); // Finally, purge methods we don't want to be public. delete MessagePort.prototype.stop; delete MessagePort.prototype.drain; -delete MessagePort.prototype.hasRef; MessagePort.prototype.ref = MessagePortPrototype.ref; MessagePort.prototype.unref = MessagePortPrototype.unref; diff --git a/test/addons/make-callback/test.js b/test/addons/make-callback/test.js index efea43df3c9f9e..c5a71b5ab7a3e0 100644 --- a/test/addons/make-callback/test.js +++ b/test/addons/make-callback/test.js @@ -6,39 +6,39 @@ const vm = require('vm'); const binding = require(`./build/${common.buildType}/binding`); const makeCallback = binding.makeCallback; -assert.strictEqual(42, makeCallback(process, common.mustCall(function() { - assert.strictEqual(0, arguments.length); - assert.strictEqual(this, process); +assert.strictEqual(makeCallback(process, common.mustCall(function() { + assert.strictEqual(arguments.length, 0); + assert.strictEqual(process, this); return 42; -}))); +})), 42); -assert.strictEqual(42, makeCallback(process, common.mustCall(function(x) { - assert.strictEqual(1, arguments.length); - assert.strictEqual(this, process); +assert.strictEqual(makeCallback(process, common.mustCall(function(x) { + assert.strictEqual(arguments.length, 1); + assert.strictEqual(process, this); assert.strictEqual(x, 1337); return 42; -}), 1337)); +}), 1337), 42); const recv = { one: common.mustCall(function() { - assert.strictEqual(0, arguments.length); - assert.strictEqual(this, recv); + assert.strictEqual(arguments.length, 0); + assert.strictEqual(recv, this); return 42; }), two: common.mustCall(function(x) { - assert.strictEqual(1, arguments.length); - assert.strictEqual(this, recv); + assert.strictEqual(arguments.length, 1); + assert.strictEqual(recv, this); assert.strictEqual(x, 1337); return 42; }), }; -assert.strictEqual(42, makeCallback(recv, 'one')); -assert.strictEqual(42, makeCallback(recv, 'two', 1337)); +assert.strictEqual(makeCallback(recv, 'one'), 42); +assert.strictEqual(makeCallback(recv, 'two', 1337), 42); // Check that callbacks on a receiver from a different context works. const foreignObject = vm.runInNewContext('({ fortytwo() { return 42; } })'); -assert.strictEqual(42, makeCallback(foreignObject, 'fortytwo')); +assert.strictEqual(makeCallback(foreignObject, 'fortytwo'), 42); // Check that the callback is made in the context of the receiver. const target = vm.runInNewContext(` @@ -48,7 +48,7 @@ const target = vm.runInNewContext(` return Object; }) `); -assert.notStrictEqual(Object, makeCallback(process, target, Object)); +assert.notStrictEqual(makeCallback(process, target, Object), Object); // Runs in inner context. const forward = vm.runInNewContext(` @@ -62,4 +62,4 @@ function endpoint($Object) { throw new Error('bad'); return Object; } -assert.strictEqual(Object, makeCallback(process, forward, endpoint)); +assert.strictEqual(makeCallback(process, forward, endpoint), Object); diff --git a/test/parallel/test-fs-write.js b/test/parallel/test-fs-write.js index a3c8814bc392ce..d75974b58d33cf 100644 --- a/test/parallel/test-fs-write.js +++ b/test/parallel/test-fs-write.js @@ -41,59 +41,59 @@ common.allowGlobals(externalizeString, isOneByteString, x); { const expected = 'ümlaut eins'; // Must be a unique string. externalizeString(expected); - assert.strictEqual(true, isOneByteString(expected)); + assert.strictEqual(isOneByteString(expected), true); const fd = fs.openSync(fn, 'w'); fs.writeSync(fd, expected, 0, 'latin1'); fs.closeSync(fd); - assert.strictEqual(expected, fs.readFileSync(fn, 'latin1')); + assert.strictEqual(fs.readFileSync(fn, 'latin1'), expected); } { const expected = 'ümlaut zwei'; // Must be a unique string. externalizeString(expected); - assert.strictEqual(true, isOneByteString(expected)); + assert.strictEqual(isOneByteString(expected), true); const fd = fs.openSync(fn, 'w'); fs.writeSync(fd, expected, 0, 'utf8'); fs.closeSync(fd); - assert.strictEqual(expected, fs.readFileSync(fn, 'utf8')); + assert.strictEqual(fs.readFileSync(fn, 'utf8'), expected); } { const expected = '中文 1'; // Must be a unique string. externalizeString(expected); - assert.strictEqual(false, isOneByteString(expected)); + assert.strictEqual(isOneByteString(expected), false); const fd = fs.openSync(fn, 'w'); fs.writeSync(fd, expected, 0, 'ucs2'); fs.closeSync(fd); - assert.strictEqual(expected, fs.readFileSync(fn, 'ucs2')); + assert.strictEqual(fs.readFileSync(fn, 'ucs2'), expected); } { const expected = '中文 2'; // Must be a unique string. externalizeString(expected); - assert.strictEqual(false, isOneByteString(expected)); + assert.strictEqual(isOneByteString(expected), false); const fd = fs.openSync(fn, 'w'); fs.writeSync(fd, expected, 0, 'utf8'); fs.closeSync(fd); - assert.strictEqual(expected, fs.readFileSync(fn, 'utf8')); + assert.strictEqual(fs.readFileSync(fn, 'utf8'), expected); } /* eslint-enable no-undef */ -fs.open(fn, 'w', 0o644, common.mustCall(function(err, fd) { +fs.open(fn, 'w', 0o644, common.mustCall((err, fd) => { assert.ifError(err); - const done = common.mustCall(function(err, written) { + const done = common.mustCall((err, written) => { assert.ifError(err); - assert.strictEqual(Buffer.byteLength(expected), written); + assert.strictEqual(written, Buffer.byteLength(expected)); fs.closeSync(fd); const found = fs.readFileSync(fn, 'utf8'); fs.unlinkSync(fn); - assert.strictEqual(expected, found); + assert.strictEqual(found, expected); }); - const written = common.mustCall(function(err, written) { + const written = common.mustCall((err, written) => { assert.ifError(err); - assert.strictEqual(0, written); + assert.strictEqual(written, 0); fs.write(fd, expected, 0, 'utf8', done); }); @@ -106,28 +106,28 @@ fs.open(fn2, args, 0o644, common.mustCall((err, fd) => { const done = common.mustCall((err, written) => { assert.ifError(err); - assert.strictEqual(Buffer.byteLength(expected), written); + assert.strictEqual(written, Buffer.byteLength(expected)); fs.closeSync(fd); const found = fs.readFileSync(fn2, 'utf8'); fs.unlinkSync(fn2); - assert.strictEqual(expected, found); + assert.strictEqual(found, expected); }); - const written = common.mustCall(function(err, written) { + const written = common.mustCall((err, written) => { assert.ifError(err); - assert.strictEqual(0, written); + assert.strictEqual(written, 0); fs.write(fd, expected, 0, 'utf8', done); }); fs.write(fd, '', 0, 'utf8', written); })); -fs.open(fn3, 'w', 0o644, common.mustCall(function(err, fd) { +fs.open(fn3, 'w', 0o644, common.mustCall((err, fd) => { assert.ifError(err); - const done = common.mustCall(function(err, written) { + const done = common.mustCall((err, written) => { assert.ifError(err); - assert.strictEqual(Buffer.byteLength(expected), written); + assert.strictEqual(written, Buffer.byteLength(expected)); fs.closeSync(fd); }); diff --git a/test/parallel/test-readline-emit-keypress-events.js b/test/parallel/test-readline-emit-keypress-events.js index ddadf6d223feaf..3b9aece4654ac1 100644 --- a/test/parallel/test-readline-emit-keypress-events.js +++ b/test/parallel/test-readline-emit-keypress-events.js @@ -20,11 +20,9 @@ stream.on('keypress', (s, k) => { stream.write('foo'); -process.on('exit', () => { - assert.deepStrictEqual(sequence, ['f', 'o', 'o']); - assert.deepStrictEqual(keys, [ - { sequence: 'f', name: 'f', ctrl: false, meta: false, shift: false }, - { sequence: 'o', name: 'o', ctrl: false, meta: false, shift: false }, - { sequence: 'o', name: 'o', ctrl: false, meta: false, shift: false } - ]); -}); +assert.deepStrictEqual(sequence, ['f', 'o', 'o']); +assert.deepStrictEqual(keys, [ + { sequence: 'f', name: 'f', ctrl: false, meta: false, shift: false }, + { sequence: 'o', name: 'o', ctrl: false, meta: false, shift: false }, + { sequence: 'o', name: 'o', ctrl: false, meta: false, shift: false } +]); diff --git a/test/sequential/test-inspector-debug-brk-flag.js b/test/sequential/test-inspector-debug-brk-flag.js index d488eea2626584..7fa85c269c9343 100644 --- a/test/sequential/test-inspector-debug-brk-flag.js +++ b/test/sequential/test-inspector-debug-brk-flag.js @@ -34,7 +34,7 @@ async function runTests() { await testBreakpointOnStart(session); await session.runToCompletion(); - assert.strictEqual(55, (await child.expectShutdown()).exitCode); + assert.strictEqual((await child.expectShutdown()).exitCode, 55); } runTests();