0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/sequential/test-debugger-repeat-last.js
Rich Trott 00b2219420 test: move debugger tests to sequential
The debugger tests in parallel fail with `make test` sometimes (all the
time?). This appears to be related to running in parallel, as it does
not fail with `make test-ci`, when run via `tools/test.py` or directly
from the command line with `./node
test/parallel/test-debugger-util-regression.js`.

A separate issue may be opened to find out why it is failing in
parallel, but for now, I think it's important to fix `make test`
promptly.

I suspect the issue is that the tests are relying on a default port
somewhere and so they are colliding when run in parallel. But that's
just a guess for the moment.

PR-URL: https://github.com/nodejs/node/pull/6205
Fixes: https://github.com/nodejs/node/issues/6201
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2016-04-14 19:04:09 -07:00

47 lines
1.0 KiB
JavaScript

'use strict';
const path = require('path');
const spawn = require('child_process').spawn;
const assert = require('assert');
const common = require('../common');
const fixture = path.join(
common.fixturesDir,
'debugger-repeat-last.js'
);
const args = [
'debug',
fixture
];
const proc = spawn(process.execPath, args, { stdio: 'pipe' });
proc.stdout.setEncoding('utf8');
var stdout = '';
var sentCommand = false;
var sentEmpty = false;
var sentExit = false;
proc.stdout.on('data', (data) => {
stdout += data;
if (!sentCommand && stdout.includes('> 1')) {
setImmediate(() => {proc.stdin.write('n\n');});
return sentCommand = true;
}
if (!sentEmpty && stdout.includes('> 3')) {
setImmediate(() => {proc.stdin.write('\n');});
return sentEmpty = true;
}
if (!sentExit && sentCommand && sentEmpty) {
setTimeout(() => {proc.stdin.write('\n\n\n.exit\n\n\n');}, 1);
return sentExit = true;
}
});
process.on('exit', (exitCode) => {
assert.strictEqual(exitCode, 0);
console.log(stdout);
});