Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions test/parallel/test-child-process-windows-hide.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ const internalCp = require('internal/child_process');
const cmd = process.execPath;
const args = ['-p', '42'];
const options = { windowsHide: true };
const { spawnSyncAndAssert } = require('../common/child_process');

// Since windowsHide isn't really observable, this test relies on monkey
// patching spawn() and spawnSync() to verify that the flag is being passed
// through correctly.

test('spawnSync() passes windowsHide correctly', (t) => {
const spy = t.mock.method(internalCp, 'spawnSync');
const child = cp.spawnSync(cmd, args, options);

assert.strictEqual(child.status, 0);
assert.strictEqual(child.signal, null);
assert.strictEqual(child.stdout.toString().trim(), '42');
assert.strictEqual(child.stderr.toString().trim(), '');
spawnSyncAndAssert(cmd, args, options, {
stdout: '42',
stderr: '',
trim: true
});
assert.strictEqual(spy.mock.calls.length, 1);
assert.strictEqual(spy.mock.calls[0].arguments[0].windowsHide, true);
});
Expand Down
Loading