| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 9304dee commit 359369e
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,19 +8,20 @@ const internalCp = require('internal/child_process'); | |||
| 8 | 8 | const cmd = process.execPath; | |
| 9 | 9 | const args = ['-p', '42']; | |
| 10 | 10 | const options = { windowsHide: true }; | |
| 11 | + const { spawnSyncAndAssert } = require('../common/child_process'); | ||
| 11 | 12 | ||
| 12 | 13 | // Since windowsHide isn't really observable, this test relies on monkey | |
| 13 | 14 | // patching spawn() and spawnSync() to verify that the flag is being passed | |
| 14 | 15 | // through correctly. | |
| 15 | 16 | ||
| 16 | 17 | test('spawnSync() passes windowsHide correctly', (t) => { | |
| 17 | 18 | const spy = t.mock.method(internalCp, 'spawnSync'); | |
| 18 | - const child = cp.spawnSync(cmd, args, options); | ||
| 19 | 19 | ||
| 20 | - assert.strictEqual(child.status, 0); | ||
| 21 | - assert.strictEqual(child.signal, null); | ||
| 22 | - assert.strictEqual(child.stdout.toString().trim(), '42'); | ||
| 23 | - assert.strictEqual(child.stderr.toString().trim(), ''); | ||
| 20 | + spawnSyncAndAssert(cmd, args, options, { | ||
| 21 | + stdout: '42', | ||
| 22 | + stderr: '', | ||
| 23 | + trim: true | ||
| 24 | + }); | ||
| 24 | 25 | assert.strictEqual(spy.mock.calls.length, 1); | |
| 25 | 26 | assert.strictEqual(spy.mock.calls[0].arguments[0].windowsHide, true); | |
| 26 | 27 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments