mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
test: use spawnSyncAndAssert in windowsHide test
Signed-off-by: Junsoo Ha <junsoo2018@naver.com> PR-URL: https://github.com/nodejs/node/pull/65351 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Stefan Stojanovic <stefan.stojanovic@janeasystems.com>
This commit is contained in:
1 parent
929d5705bc
commit
421ee11715
1 file changed
+6
-5
@@ -8,6 +8,7 @@ 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
|
||||
@@ -15,12 +16,12 @@ const options = { windowsHide: true };
|
||||
|
||||
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);
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user