-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The current format that prints the process PID before the actual message. Adapt the test so it also passes on Windows, that emits a different message from the rest of platforms. Move the test to parallel. PR-URL: #6584 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Rich Trott <[email protected]>
- Loading branch information
1 parent
d740624
commit 577e132
Showing
2 changed files
with
54 additions
and
32 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
'use strict'; | ||
const common = require('../common'); | ||
const assert = require('assert'); | ||
const spawn = require('child_process').spawn; | ||
|
||
var buffer = ''; | ||
|
||
// connect to debug agent | ||
var interfacer = spawn(process.execPath, ['debug', '-p', '655555']); | ||
|
||
console.error(process.execPath, 'debug', '-p', '655555'); | ||
interfacer.stdout.setEncoding('utf-8'); | ||
interfacer.stderr.setEncoding('utf-8'); | ||
var onData = function(data) { | ||
data = (buffer + data).split('\n'); | ||
buffer = data.pop(); | ||
data.forEach(function(line) { | ||
interfacer.emit('line', line); | ||
}); | ||
}; | ||
interfacer.stdout.on('data', onData); | ||
interfacer.stderr.on('data', onData); | ||
|
||
var lineCount = 0; | ||
interfacer.on('line', function(line) { | ||
var expected; | ||
const pid = interfacer.pid; | ||
if (common.isWindows) { | ||
switch (++lineCount) { | ||
case 1: | ||
line = line.replace(/^(debug> *)+/, ''); | ||
var msg = 'There was an internal error in Node\'s debugger. ' + | ||
'Please report this bug.'; | ||
expected = `(node:${pid}) ${msg}`; | ||
break; | ||
|
||
case 2: | ||
expected = 'The parameter is incorrect.'; | ||
break; | ||
|
||
default: | ||
return; | ||
} | ||
} else { | ||
line = line.replace(/^(debug> *)+/, ''); | ||
expected = `(node:${pid}) Target process: 655555 doesn\'t exist.`; | ||
} | ||
|
||
assert.strictEqual(expected, line); | ||
}); | ||
|
||
interfacer.on('exit', function(code, signal) { | ||
assert.ok(code == 1, 'Got unexpected code: ' + code); | ||
}); |