2015-12-17 12:13:11 +01:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const common = require('../common');
|
|
|
|
const assert = require('assert');
|
|
|
|
const spawn = require('child_process').spawn;
|
|
|
|
|
2016-02-15 16:46:58 +01:00
|
|
|
const args = ['--debug', `--debug-port=${common.PORT}`, '--interactive'];
|
2016-02-17 04:59:56 +01:00
|
|
|
const proc = spawn(process.execPath, args);
|
2015-12-17 12:13:11 +01:00
|
|
|
proc.stdin.write(`
|
|
|
|
util.inspect(Promise.resolve(42));
|
|
|
|
util.inspect(Promise.resolve(1337));
|
|
|
|
.exit
|
|
|
|
`);
|
|
|
|
proc.on('exit', common.mustCall((exitCode, signalCode) => {
|
2016-02-17 04:59:56 +01:00
|
|
|
// 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);
|
2015-12-17 12:13:11 +01:00
|
|
|
assert.strictEqual(signalCode, null);
|
|
|
|
}));
|
|
|
|
let stdout = '';
|
|
|
|
proc.stdout.setEncoding('utf8');
|
2016-01-28 16:21:57 +01:00
|
|
|
proc.stdout.on('data', (data) => stdout += data);
|
2015-12-17 12:13:11 +01:00
|
|
|
process.on('exit', () => {
|
|
|
|
assert(stdout.includes('Promise { 42 }'));
|
|
|
|
assert(stdout.includes('Promise { 1337 }'));
|
|
|
|
});
|