0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/test/parallel/test-debugger-repeat-last.js
Rich Trott ece3e37cfa
test: use consistent block spacing
In preparation for enabling an ESLint rule, use consistent block
spacing. This changes only six files in the code base as block spacing
is consistent throughout the rest of the code base.

Before:  function(c) {data += c;}

After: function(c) { data += c; }

PR-URL: https://github.com/nodejs/node/pull/10377
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Julian Duque <julianduquej@gmail.com>
2016-12-21 11:21:44 -05:00

46 lines
1.0 KiB
JavaScript

'use strict';
const common = require('../common');
const path = require('path');
const spawn = require('child_process').spawn;
const assert = require('assert');
const fixture = path.join(
common.fixturesDir,
'debugger-repeat-last.js'
);
const args = [
'debug',
`--port=${common.PORT}`,
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);
});