* Make common.skip() exit. Also add common.printSkipMessage() for partial skips. * Don't make needless things before skip Backport-PR-URL: https://github.com/nodejs/node/pull/14838 PR-URL: https://github.com/nodejs/node/pull/14021 Fixes: https://github.com/nodejs/node/issues/14016 Reviewed-By: Refael Ackermann <refack@gmail.com>
24 lines
660 B
JavaScript
24 lines
660 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const assert = require('assert');
|
|
const spawn = require('child_process').spawn;
|
|
|
|
const child = spawn(process.execPath, ['debug']);
|
|
child.stderr.setEncoding('utf8');
|
|
|
|
const expectedUsageMessage = `Usage: node debug script.js
|
|
node debug <host>:<port>
|
|
node debug -p <pid>
|
|
`;
|
|
let actualUsageMessage = '';
|
|
child.stderr.on('data', function(data) {
|
|
actualUsageMessage += data.toString();
|
|
});
|
|
|
|
child.on('exit', common.mustCall(function(code) {
|
|
assert.strictEqual(code, 1);
|
|
assert.strictEqual(actualUsageMessage, expectedUsageMessage);
|
|
}));
|