From 6bad85c4fd8fbc26b8b7e4cf282678e035dd8847 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Mon, 23 May 2016 17:25:41 -0400 Subject: [PATCH] test: refactor spawnSync() cwd test This commit refactors test-child-process-spawnsync.js to use the reusable common.spawnSyncPwd(). PR-URL: https://github.com/nodejs/node/pull/6939 Reviewed-By: Anna Henningsen Reviewed-By: Ben Noordhuis --- test/parallel/test-child-process-spawnsync.js | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/test/parallel/test-child-process-spawnsync.js b/test/parallel/test-child-process-spawnsync.js index 9640bbb85c03d0..d45cc1e0dcea7a 100644 --- a/test/parallel/test-child-process-spawnsync.js +++ b/test/parallel/test-child-process-spawnsync.js @@ -18,21 +18,13 @@ assert.strictEqual(ret_err.syscall, 'spawnSync command_does_not_exist'); assert.strictEqual(ret_err.path, 'command_does_not_exist'); assert.deepStrictEqual(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