diff --git a/test/parallel/test-buffer-alloc.js b/test/parallel/test-buffer-alloc.js index ff6a00964aa..e1fef8e22bc 100644 --- a/test/parallel/test-buffer-alloc.js +++ b/test/parallel/test-buffer-alloc.js @@ -780,32 +780,6 @@ assert.strictEqual(Buffer.from('13.37').length, 5); // issue GH-3416 Buffer.from(Buffer.allocUnsafe(0), 0, 0); -// GH-5110 -{ - const buffer = Buffer.from('test'); - const string = JSON.stringify(buffer); - - assert.strictEqual(string, '{"type":"Buffer","data":[116,101,115,116]}'); - - assert.deepStrictEqual(buffer, JSON.parse(string, (key, value) => { - return value && value.type === 'Buffer' ? - Buffer.from(value.data) : - value; - })); -} - -// issue GH-7849 -{ - const buf = Buffer.from('test'); - const json = JSON.stringify(buf); - const obj = JSON.parse(json); - const copy = Buffer.from(obj); - - assert(buf.equals(copy)); -} -assert.throws(() => Buffer.allocUnsafe(0xFFFFFFFF), RangeError); -assert.throws(() => Buffer.allocUnsafe(0xFFFFFFFFF), RangeError); - // issue GH-5587 assert.throws(() => Buffer.alloc(8).writeFloatLE(0, 5), RangeError); assert.throws(() => Buffer.alloc(16).writeDoubleLE(0, 9), RangeError); @@ -934,7 +908,6 @@ assert.throws(() => Buffer.from('', 'buffer'), } } - if (common.hasCrypto) { // Test truncation after decode const crypto = require('crypto'); diff --git a/test/parallel/test-buffer-slow.js b/test/parallel/test-buffer-slow.js index 601e32ec487..7f094efcb6a 100644 --- a/test/parallel/test-buffer-slow.js +++ b/test/parallel/test-buffer-slow.js @@ -52,10 +52,10 @@ assert.strictEqual(SlowBuffer(NaN).length, 0); assert.strictEqual(SlowBuffer({}).length, 0); assert.strictEqual(SlowBuffer('string').length, 0); +// should throw with invalid length assert.throws(function() { SlowBuffer(Infinity); }, common.bufferMaxSizeMsg); - assert.throws(function() { SlowBuffer(-1); }, /^RangeError: "size" argument must not be negative$/); diff --git a/test/parallel/test-child-process-double-pipe.js b/test/parallel/test-child-process-double-pipe.js index 8026c9115dd..a028963739b 100644 --- a/test/parallel/test-child-process-double-pipe.js +++ b/test/parallel/test-child-process-double-pipe.js @@ -27,7 +27,7 @@ const util = require('util'); const spawn = require('child_process').spawn; // We're trying to reproduce: -// $ echo "hello\nnode\nand\nworld" | grep o | sed s/o/O/ +// $ echo "hello\nnode\nand\nworld" | grep o | sed s/o/a/ let grep, sed, echo; diff --git a/test/parallel/test-debug-brk-no-arg.js b/test/parallel/test-debug-brk-no-arg.js deleted file mode 100644 index 332e48d7aba..00000000000 --- a/test/parallel/test-debug-brk-no-arg.js +++ /dev/null @@ -1,19 +0,0 @@ -'use strict'; -const common = require('../common'); -const assert = require('assert'); -const spawn = require('child_process').spawn; - -if (common.isChakraEngine) { - console.log('1..0 # Skipped: This test is disabled for chakra engine ' + - 'because debugger support is not implemented yet.'); - return; -} - -const child = spawn(process.execPath, ['--debug-brk=' + common.PORT, '-i']); -child.stderr.once('data', common.mustCall(function() { - child.stdin.end('.exit'); -})); - -child.on('exit', common.mustCall(function(c) { - assert.strictEqual(c, 0); -})); diff --git a/test/parallel/test-debug-brk.js b/test/parallel/test-debug-brk.js deleted file mode 100644 index 28e6ffdef36..00000000000 --- a/test/parallel/test-debug-brk.js +++ /dev/null @@ -1,76 +0,0 @@ -'use strict'; - -const common = require('../common'); -const spawn = require('child_process').spawn; -let run = common.noop; - -if (common.isChakraEngine) { - console.log('1..0 # Skipped: This test is disabled for chakra engine ' + - 'because debugger support is not implemented yet.'); - return; -} - -function test(extraArgs, stdoutPattern) { - const next = run; - run = () => { - let procStdout = ''; - let procStderr = ''; - let agentStdout = ''; - let debuggerListening = false; - let outputMatched = false; - let needToSpawnAgent = true; - let needToExit = true; - - const procArgs = [`--debug-brk=${common.PORT}`].concat(extraArgs); - const proc = spawn(process.execPath, procArgs); - proc.stderr.setEncoding('utf8'); - - const tryStartAgent = () => { - if (debuggerListening && outputMatched && needToSpawnAgent) { - needToSpawnAgent = false; - const agentArgs = ['debug', `localhost:${common.PORT}`]; - const agent = spawn(process.execPath, agentArgs); - agent.stdout.setEncoding('utf8'); - - agent.stdout.on('data', (chunk) => { - agentStdout += chunk; - if (/connecting to .+ ok/.test(agentStdout) && needToExit) { - needToExit = false; - exitAll([proc, agent]); - } - }); - } - }; - - const exitAll = common.mustCall((processes) => { - processes.forEach((myProcess) => { myProcess.kill(); }); - }); - - if (stdoutPattern != null) { - proc.stdout.on('data', (chunk) => { - procStdout += chunk; - outputMatched = outputMatched || stdoutPattern.test(procStdout); - tryStartAgent(); - }); - } else { - outputMatched = true; - } - - proc.stderr.on('data', (chunk) => { - procStderr += chunk; - debuggerListening = debuggerListening || - /Debugger listening on/.test(procStderr); - tryStartAgent(); - }); - - proc.on('exit', () => { - next(); - }); - }; -} - -test(['-e', '0']); -test(['-e', '0', 'foo']); -test(['-p', 'process.argv[1]', 'foo'], /^\s*foo\s*$/); - -run(); diff --git a/test/parallel/test-debug-no-context.js b/test/parallel/test-debug-no-context.js deleted file mode 100644 index 17329bd7436..00000000000 --- a/test/parallel/test-debug-no-context.js +++ /dev/null @@ -1,33 +0,0 @@ -'use strict'; - -const common = require('../common'); - -if (common.isChakraEngine) { - console.log('1..0 # Skipped: This test is disabled for chakra engine ' + - 'because debugger support is not implemented yet.'); - return; -} - -const assert = require('assert'); -const spawn = require('child_process').spawn; -const args = ['--debug', `--debug-port=${common.PORT}`, '--interactive']; -const proc = spawn(process.execPath, args); - -proc.stdin.write(` - util.inspect(Promise.resolve(42)); - util.inspect(Promise.resolve(1337)); - .exit -`); -proc.on('exit', common.mustCall((exitCode, signalCode) => { - // This next line should be included but unfortunately Win10 fails from time - // to time in CI. See https://github.com/nodejs/node/issues/5268 - // assert.strictEqual(exitCode, 0); - assert.strictEqual(signalCode, null); -})); -let stdout = ''; -proc.stdout.setEncoding('utf8'); -proc.stdout.on('data', (data) => stdout += data); -process.on('exit', () => { - assert(stdout.includes('Promise { 42 }')); - assert(stdout.includes('Promise { 1337 }')); -}); diff --git a/test/parallel/test-debug-port-cluster.js b/test/parallel/test-debug-port-cluster.js deleted file mode 100644 index 06e5cdbf822..00000000000 --- a/test/parallel/test-debug-port-cluster.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; -const common = require('../common'); -const assert = require('assert'); -const spawn = require('child_process').spawn; - -if (common.isChakraEngine) { - console.log('1..0 # Skipped: This test is disabled for chakra engine ' + - 'because debugger support is not implemented yet.'); - return; -} - -const PORT_MIN = common.PORT + 1; // The fixture uses common.PORT. - -const PORT_MAX = PORT_MIN + 2; - -const args = [ - '--debug=' + PORT_MIN, - common.fixturesDir + '/clustered-server/app.js' -]; - -const child = spawn(process.execPath, args); -child.stderr.setEncoding('utf8'); - -const checkMessages = common.mustCall(() => { - for (let port = PORT_MIN; port <= PORT_MAX; port += 1) { - assert(stderr.includes(`Debugger listening on 127.0.0.1:${port}`)); - } -}); - -let stderr = ''; -child.stderr.on('data', (data) => { - process.stderr.write(`[DATA] ${data}`); - stderr += data; - if (child.killed !== true && stderr.includes('all workers are running')) { - child.kill(); - checkMessages(); - } -}); diff --git a/test/parallel/test-debug-port-from-cmdline.js b/test/parallel/test-debug-port-from-cmdline.js deleted file mode 100644 index ced6eecf211..00000000000 --- a/test/parallel/test-debug-port-from-cmdline.js +++ /dev/null @@ -1,70 +0,0 @@ -'use strict'; -const common = require('../common'); -const assert = require('assert'); -const spawn = require('child_process').spawn; -const os = require('os'); - - -if (common.isChakraEngine) { - console.log('1..0 # Skipped: This test is disabled for chakra engine ' + - 'because debugger support is not implemented yet.'); - return; -} - -const debugPort = common.PORT; -const args = ['--interactive', '--debug-port=' + debugPort]; -const childOptions = { stdio: ['pipe', 'pipe', 'pipe', 'ipc'] }; -const child = spawn(process.execPath, args, childOptions); - -const reDeprecationWarning = new RegExp( - /^\(node:\d+\) \[DEP0062\] DeprecationWarning: /.source + - /node --debug is deprecated\. /.source + - /Please use node --inspect instead\.$/.source -); - -child.stdin.write("process.send({ msg: 'childready' });\n"); - -child.stderr.on('data', function(data) { - const lines = data.toString().replace(/\r/g, '').trim().split('\n'); - lines.forEach(processStderrLine); -}); - -child.on('message', function onChildMsg(message) { - if (message.msg === 'childready') { - process._debugProcess(child.pid); - } -}); - -process.on('exit', function() { - child.kill(); - assertOutputLines(); -}); - -const outputLines = []; -function processStderrLine(line) { - console.log('> ' + line); - outputLines.push(line); - - if (/Debugger listening/.test(line)) { - process.exit(); - } -} - -function assertOutputLines() { - // need a var so can swap the first two lines in following - // eslint-disable-next-line no-var - var expectedLines = [ - /^Starting debugger agent\.$/, - reDeprecationWarning, - new RegExp(`^Debugger listening on 127\\.0\\.0\\.1:${debugPort}$`) - ]; - - if (os.platform() === 'win32') { - expectedLines[1] = expectedLines[0]; - expectedLines[0] = reDeprecationWarning; - } - - assert.strictEqual(outputLines.length, expectedLines.length); - for (let i = 0; i < expectedLines.length; i++) - assert(expectedLines[i].test(outputLines[i])); -} diff --git a/test/parallel/test-debug-port-numbers.js b/test/parallel/test-debug-port-numbers.js deleted file mode 100644 index 58b02ed75ae..00000000000 --- a/test/parallel/test-debug-port-numbers.js +++ /dev/null @@ -1,65 +0,0 @@ -'use strict'; - -const common = require('../common'); -const assert = require('assert'); -const path = require('path'); -const spawn = require('child_process').spawn; - -// FIXME(bnoordhuis) On UNIX platforms, the debugger doesn't reliably kill -// the inferior when killed by a signal. Work around that by spawning -// the debugger in its own process group and killing the process group -// instead of just the debugger process. -const detached = !common.isWindows; - -if (common.isChakraEngine) { - console.log('1..0 # Skipped: This test is disabled for chakra engine ' + - 'because debugger support is not implemented yet.'); - return; -} - -const children = []; -for (let i = 0; i < 4; i += 1) { - const port = common.PORT + i; - const args = [`--debug-port=${port}`, '--interactive', 'debug', __filename]; - const child = spawn(process.execPath, args, { detached, stdio: 'pipe' }); - child.test = { port: port, stdout: '' }; - child.stdout.setEncoding('utf8'); - child.stdout.on('data', function(s) { child.test.stdout += s; update(); }); - child.stdout.pipe(process.stdout); - child.stderr.pipe(process.stderr); - children.push(child); -} - -function update() { - // Debugger prints relative paths except on Windows. - const filename = path.basename(__filename); - - let ready = 0; - for (const child of children) - ready += RegExp(`break in .*?${filename}:1`).test(child.test.stdout); - - if (ready === children.length) - for (const child of children) - kill(child); -} - -function kill(child) { - if (!detached) - return child.kill(); - - try { - process.kill(-child.pid); // Kill process group. - } catch (e) { - // Generally ESRCH is returned when the process group is already gone. On - // some platforms such as OS X it may be EPERM though. - assert.ok((e.code === 'EPERM') || (e.code === 'ESRCH')); - } -} - -process.on('exit', function() { - for (const child of children) { - const { port, stdout } = child.test; - assert(stdout.includes(`Debugger listening on 127.0.0.1:${port}`)); - assert(stdout.includes(`connecting to 127.0.0.1:${port}`)); - } -}); diff --git a/test/parallel/test-debug-signal-cluster.js b/test/parallel/test-debug-signal-cluster.js deleted file mode 100644 index f1677cbce3a..00000000000 --- a/test/parallel/test-debug-signal-cluster.js +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// Permission is hereby granted, free of charge, to any person obtaining a -// copy of this software and associated documentation files (the -// "Software"), to deal in the Software without restriction, including -// without limitation the rights to use, copy, modify, merge, publish, -// distribute, sublicense, and/or sell copies of the Software, and to permit -// persons to whom the Software is furnished to do so, subject to the -// following conditions: -// -// The above copyright notice and this permission notice shall be included -// in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN -// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, -// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR -// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE -// USE OR OTHER DEALINGS IN THE SOFTWARE. - -'use strict'; - -const common = require('../common'); -const assert = require('assert'); -const spawn = require('child_process').spawn; -const os = require('os'); -const path = require('path'); -if (common.isChakraEngine) { - console.log('1..0 # Skipped: This test is disabled for chakra engine ' + - 'because debugger support is not implemented yet.'); - return; -} - -const port = common.PORT; -const serverPath = path.join(common.fixturesDir, 'clustered-server', 'app.js'); -// cannot use 'Flags: --no-deprecation' since it doesn't effect child -const args = [`--debug-port=${port}`, '--no-deprecation', serverPath]; -const options = { stdio: ['inherit', 'inherit', 'pipe', 'ipc'] }; -const child = spawn(process.execPath, args, options); - -let expectedContent = [ - 'Starting debugger agent.', - 'Debugger listening on 127.0.0.1:' + (port + 0), - 'Starting debugger agent.', - 'Debugger listening on 127.0.0.1:' + (port + 1), - 'Starting debugger agent.', - 'Debugger listening on 127.0.0.1:' + (port + 2), -].join(os.EOL); -expectedContent += os.EOL; // the last line also contains an EOL character - -let debuggerAgentsOutput = ''; -let debuggerAgentsStarted = false; - -let pids; - -child.stderr.on('data', function(data) { - const childStderrOutputString = data.toString(); - const lines = childStderrOutputString.replace(/\r/g, '').trim().split('\n'); - - lines.forEach(function(line) { - console.log('> ' + line); - - if (line === 'all workers are running') { - child.on('message', function(msg) { - if (msg.type !== 'pids') - return; - - pids = msg.pids; - console.error('got pids %j', pids); - - process._debugProcess(child.pid); - debuggerAgentsStarted = true; - }); - - child.send({ - type: 'getpids' - }); - } - }); - - if (debuggerAgentsStarted) { - debuggerAgentsOutput += childStderrOutputString; - if (debuggerAgentsOutput.length === expectedContent.length) { - onNoMoreDebuggerAgentsOutput(); - } - } -}); - -function onNoMoreDebuggerAgentsOutput() { - assertDebuggerAgentsOutput(); - process.exit(); -} - -process.on('exit', function onExit() { - // Kill processes in reverse order to avoid timing problems on Windows where - // the parent process is killed before the children. - pids.reverse().forEach(function(pid) { - process.kill(pid); - }); -}); - -function assertDebuggerAgentsOutput() { - // Workers can take different amout of time to start up, and child processes' - // output may be interleaved arbitrarily. Moreover, child processes' output - // may be written using an arbitrary number of system calls, and no assumption - // on buffering or atomicity of output should be made. Thus, we process the - // output of all child processes' debugger agents character by character, and - // remove each character from the set of expected characters. Once all the - // output from all debugger agents has been processed, we consider that we got - // the content we expected if there's no character left in the initial - // expected content. - debuggerAgentsOutput.split('').forEach(function gotChar(char) { - expectedContent = expectedContent.replace(char, ''); - }); - - assert.strictEqual(expectedContent, ''); -} diff --git a/test/parallel/test-debugger-util-regression.js b/test/parallel/test-debugger-util-regression.js deleted file mode 100644 index c44dd7a4334..00000000000 --- a/test/parallel/test-debugger-util-regression.js +++ /dev/null @@ -1,65 +0,0 @@ -'use strict'; -const common = require('../common'); -const path = require('path'); -const spawn = require('child_process').spawn; -const assert = require('assert'); - -if (common.isChakraEngine) { - console.log('1..0 # Skipped: This test is disabled for chakra engine ' + - 'because debugger support is not implemented yet.'); - return; -} - -const DELAY = common.platformTimeout(200); - -const fixture = path.join( - common.fixturesDir, - 'debugger-util-regression-fixture.js' -); - -const args = [ - 'debug', - `--port=${common.PORT}`, - fixture -]; - -const proc = spawn(process.execPath, args, { stdio: 'pipe' }); -proc.stdout.setEncoding('utf8'); -proc.stderr.setEncoding('utf8'); - -let stdout = ''; -let stderr = ''; -proc.stdout.on('data', (data) => stdout += data); -proc.stderr.on('data', (data) => stderr += data); - -let nextCount = 0; -let exit = false; - -// We look at output periodically. We don't do this in the on('data') as we -// may end up processing partial output. Processing periodically ensures that -// the debugger is in a stable state before we take the next step. -const timer = setInterval(() => { - if (stdout.includes('> 1') && nextCount < 1 || - stdout.includes('> 2') && nextCount < 2 || - stdout.includes('> 3') && nextCount < 3 || - stdout.includes('> 4') && nextCount < 4) { - nextCount++; - proc.stdin.write('n\n'); - } else if (!exit && (stdout.includes('< { a: \'b\' }'))) { - exit = true; - proc.stdin.write('.exit\n'); - // We can cancel the timer and terminate normally. - clearInterval(timer); - } else if (stdout.includes('program terminated')) { - // Catch edge case present in v4.x - // process will terminate after call to util.inspect - common.fail('the program should not terminate'); - } -}, DELAY); - -process.on('exit', (code) => { - 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'); -}); diff --git a/test/parallel/test-repl.js b/test/parallel/test-repl.js index 45b46f201f5..e68a4279404 100644 --- a/test/parallel/test-repl.js +++ b/test/parallel/test-repl.js @@ -39,6 +39,7 @@ const prompt_npm = 'npm should be run outside of the ' + const expect_npm = prompt_npm + prompt_unix; let server_tcp, server_unix, client_tcp, client_unix, replServer; + // absolute path to test/fixtures/a.js const moduleFilename = require('path').join(common.fixturesDir, 'a'); @@ -225,19 +226,22 @@ function error_test() { v8: /\bSyntaxError: Octal literals are not allowed in strict mode/, chakracore: cc_re4}) }, - { client: client_unix, + { + client: client_unix, send: '(function(a, a, b) { "use strict"; return a + b + c; })()', expect: common.engineSpecificMessage({ v8: v8_re1, chakracore: cc_re1}) }, - { client: client_unix, + { + client: client_unix, send: '(function() { "use strict"; with (this) {} })()', expect: common.engineSpecificMessage({ v8: /\bSyntaxError: Strict mode code may not include a with statement/, chakracore: cc_re2}) }, - { client: client_unix, + { + client: client_unix, send: '(function() { "use strict"; var x; delete x; })()', expect: common.engineSpecificMessage({ v8: /\bSyntaxError: Delete of an unqualified identifier in strict mode/, @@ -249,7 +253,8 @@ function error_test() { v8: /\bSyntaxError: Unexpected eval or arguments in strict mode/, chakracore: /^SyntaxError: Invalid usage of 'eval' in strict mode/}) }, - { client: client_unix, + { + client: client_unix, send: '(function() { "use strict"; if (true) function f() { } })()', expect: common.engineSpecificMessage({ v8: /\bSyntaxError: In strict mode code, functions can only be declared at top level or inside a block\./, // eslint-disable-line max-len @@ -413,8 +418,7 @@ function error_test() { expect: 'undefined\n' + prompt_unix }, // Illegal token is not recoverable outside string literal, RegExp literal, // or block comment. https://github.com/nodejs/node/issues/3611 - { - client: client_unix, send: 'a = 3.5e', + { client: client_unix, send: 'a = 3.5e', expect: /\bSyntaxError: Invalid or unexpected token/ }, // Mitigate https://github.com/nodejs/node/issues/548 { client: client_unix, send: 'function name(){ return "node"; };name()', @@ -446,14 +450,17 @@ function error_test() { 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 }, + // Newline within template string maintains whitespace. { client: client_unix, send: '`foo \n`', expect: prompt_multiline + '\'foo \\n\'\n' + prompt_unix }, diff --git a/test/parallel/test-util-inspect.js b/test/parallel/test-util-inspect.js index 87f93be3ffe..88b0823cf37 100644 --- a/test/parallel/test-util-inspect.js +++ b/test/parallel/test-util-inspect.js @@ -194,7 +194,6 @@ for (const showHidden of [true, false]) { ` [byteLength]: ${byteLength},\n` + ' [byteOffset]: 0,\n' + ` [buffer]: ArrayBuffer { byteLength: ${byteLength} } ]`); - assert.strictEqual( util.inspect(array, false), `${constructor.name} [ 65, 97 ]` @@ -229,7 +228,6 @@ for (const showHidden of [true, false]) { ` [byteLength]: ${byteLength},\n` + ' [byteOffset]: 0,\n' + ` [buffer]: ArrayBuffer { byteLength: ${byteLength} } ]`); - assert.strictEqual( util.inspect(array, false), `${constructor.name} [ 65, 97 ]` @@ -302,7 +300,7 @@ assert.strictEqual( // Function with properties { - const value = function() { }; + const value = function() {}; value.aprop = 42; assert.strictEqual(util.inspect(value), common.engineSpecificMessage({ v8: '{ [Function: value] aprop: 42 }', @@ -367,6 +365,7 @@ assert.strictEqual(util.inspect(-0), '-0'); // Skip for chakra engine as debugger support not yet present if (!common.isChakraEngine) { + // test for Array constructor in different context { const Debug = vm.runInDebugContext('Debug'); const map = new Map(); diff --git a/test/parallel/test-util-log.js b/test/parallel/test-util-log.js index 99050545b8a..a70d8dff30a 100644 --- a/test/parallel/test-util-log.js +++ b/test/parallel/test-util-log.js @@ -55,7 +55,6 @@ tests.forEach(function(test) { const result = strings.shift().trim(); const re = (/[0-9]{1,2} [A-Z][a-z]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} - (.+)$/); const match = re.exec(result); - assert.ok(match); assert.strictEqual(match[1], test.output); }); diff --git a/test/sequential/test-debug-host-port.js b/test/sequential/test-debug-host-port.js deleted file mode 100644 index 9349272a384..00000000000 --- a/test/sequential/test-debug-host-port.js +++ /dev/null @@ -1,52 +0,0 @@ -'use strict'; - -const common = require('../common'); -const assert = require('assert'); -const spawn = require('child_process').spawn; - -let run = common.noop; - -if (common.isChakraEngine) { - console.log('1..0 # Skipped: This test is disabled for chakra engine ' + - 'because debugger support is not implemented yet.'); - return; -} - -function test(args, needle) { - const next = run; - run = () => { - const options = {encoding: 'utf8'}; - const proc = spawn(process.execPath, args.concat(['-e', '0']), options); - let stderr = ''; - proc.stderr.setEncoding('utf8'); - proc.stderr.on('data', (data) => { - stderr += data; - if (stderr.includes(needle)) proc.kill(); - }); - proc.on('exit', common.mustCall(() => { - assert(stderr.includes(needle)); - next(); - })); - }; -} - -test(['--debug-brk'], 'Debugger listening on 127.0.0.1:5858'); -test(['--debug-brk=1234'], 'Debugger listening on 127.0.0.1:1234'); -test(['--debug-brk=0.0.0.0'], 'Debugger listening on 0.0.0.0:5858'); -test(['--debug-brk=0.0.0.0:1234'], 'Debugger listening on 0.0.0.0:1234'); -test(['--debug-brk=localhost'], 'Debugger listening on 127.0.0.1:5858'); -test(['--debug-brk=localhost:1234'], 'Debugger listening on 127.0.0.1:1234'); - -if (common.hasIPv6) { - test(['--debug-brk=::'], 'Debug port must be in range 1024 to 65535'); - test(['--debug-brk=::0'], 'Debug port must be in range 1024 to 65535'); - test(['--debug-brk=::1'], 'Debug port must be in range 1024 to 65535'); - test(['--debug-brk=[::]'], 'Debugger listening on [::]:5858'); - test(['--debug-brk=[::0]'], 'Debugger listening on [::]:5858'); - test(['--debug-brk=[::]:1234'], 'Debugger listening on [::]:1234'); - test(['--debug-brk=[::0]:1234'], 'Debugger listening on [::]:1234'); - test(['--debug-brk=[::ffff:127.0.0.1]:1234'], - 'Debugger listening on [::ffff:127.0.0.1]:1234'); -} - -run(); // Runs tests in reverse order. diff --git a/test/sequential/test-debugger-debug-brk.js b/test/sequential/test-debugger-debug-brk.js deleted file mode 100644 index 83e8b542c5c..00000000000 --- a/test/sequential/test-debugger-debug-brk.js +++ /dev/null @@ -1,37 +0,0 @@ -'use strict'; -const common = require('../common'); -common.skipIfInspectorDisabled(); -const assert = require('assert'); -const spawn = require('child_process').spawn; - -const script = common.fixturesDir + '/empty.js'; - -if (common.isChakraEngine) { - console.log('1..0 # Skipped: This test is disabled for chakra engine ' + - 'because debugger support is not implemented yet.'); - return; -} - -function fail() { - assert(0); // `node --debug-brk script.js` should not quit -} - -function test(arg) { - const child = spawn(process.execPath, [arg, script]); - child.on('exit', fail); - - // give node time to start up the debugger - setTimeout(function() { - child.removeListener('exit', fail); - child.kill(); - }, 2000); - - process.on('exit', function() { - assert(child.killed); - }); -} - -test('--debug-brk'); -test('--debug-brk=5959'); -test('--inspect-brk'); -test('--inspect-brk=9230');