Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ecf5c1c

Browse filesBrowse files
cjihrigMyles Borins
authored andcommitted
test: refactor spawnSync() cwd test
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>
1 parent 4ee863d commit ecf5c1c
Copy full SHA for ecf5c1c

File tree

Expand file treeCollapse file tree

1 file changed

+5
-13
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-13
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-child-process-spawnsync.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-child-process-spawnsync.js
+5-13Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,13 @@ assert.strictEqual(ret_err.syscall, 'spawnSync command_does_not_exist');
1818
assert.strictEqual(ret_err.path, 'command_does_not_exist');
1919
assert.deepEqual(ret_err.spawnargs, ['bar']);
2020

21-
// Verify that the cwd option works - GH #7824
22-
(function() {
23-
var response;
24-
var cwd;
25-
26-
if (common.isWindows) {
27-
cwd = 'c:\\';
28-
response = spawnSync('cmd.exe', ['/c', 'cd'], {cwd: cwd});
29-
} else {
30-
cwd = '/';
31-
response = spawnSync('pwd', [], {cwd: cwd});
32-
}
21+
{
22+
// Test the cwd option
23+
const cwd = common.isWindows ? 'c:\\' : '/';
24+
const response = common.spawnSyncPwd({cwd});
3325

3426
assert.strictEqual(response.stdout.toString().trim(), cwd);
35-
})();
27+
}
3628

3729
{
3830
// Test the encoding option

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.