Skip to content

Commit

Permalink
test: refactor spawnSync() cwd test
Browse files Browse the repository at this point in the history
This commit refactors test-child-process-spawnsync.js to use
the reusable common.spawnSyncPwd().

PR-URL: #6939
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
cjihrig authored and Myles Borins committed Jul 14, 2016
1 parent 6daebb0 commit 830675e
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions test/parallel/test-child-process-spawnsync.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,13 @@ assert.strictEqual(ret_err.syscall, 'spawnSync command_does_not_exist');
assert.strictEqual(ret_err.path, 'command_does_not_exist');
assert.deepEqual(ret_err.spawnargs, ['bar']);

// Verify that the cwd option works - GH #7824
(function() {
var response;
var cwd;

if (common.isWindows) {
cwd = 'c:\\';
response = spawnSync('cmd.exe', ['/c', 'cd'], {cwd: cwd});
} else {
cwd = '/';
response = spawnSync('pwd', [], {cwd: cwd});
}
{
// Test the cwd option
const cwd = common.isWindows ? 'c:\\' : '/';
const response = common.spawnSyncPwd({cwd});

assert.strictEqual(response.stdout.toString().trim(), cwd);
})();
}

{
// Test the encoding option
Expand Down

0 comments on commit 830675e

Please sign in to comment.