From d5ab92bcc1f0ddf7ea87a8322824a688dfd43bf5 Mon Sep 17 00:00:00 2001 From: Sakthipriyan Vairamani Date: Wed, 29 Jul 2015 17:18:04 +0530 Subject: [PATCH] test: use common.isWindows consistently In the tests, we use "process.platform === 'win32'" in some places. This patch replaces them with the "common.isWindows" for consistency. PR-URL: https://github.com/nodejs/io.js/pull/2269 Reviewed-By: Colin Ihrig Reviewed-By: Ben Noordhuis Reviewed-By: Jeremiah Senkpiel --- test/common.js | 16 ++++++++-------- test/parallel/test-c-ares.js | 2 +- test/parallel/test-child-process-cwd.js | 2 +- .../test-child-process-default-options.js | 4 +--- test/parallel/test-child-process-double-pipe.js | 4 +--- test/parallel/test-child-process-env.js | 4 +--- test/parallel/test-child-process-exec-cwd.js | 4 ++-- test/parallel/test-child-process-exec-env.js | 2 +- test/parallel/test-child-process-exec-error.js | 2 +- test/parallel/test-child-process-fork-dgram.js | 2 +- test/parallel/test-child-process-kill.js | 4 +--- .../test-child-process-spawn-typeerror.js | 2 +- test/parallel/test-child-process-spawnsync.js | 2 +- test/parallel/test-child-process-stdin.js | 7 +++---- .../test-cluster-bind-privileged-port.js | 2 +- test/parallel/test-cluster-dgram-1.js | 2 +- test/parallel/test-cluster-dgram-2.js | 2 +- .../test-cluster-disconnect-unshared-udp.js | 5 ++++- test/parallel/test-cluster-http-pipe.js | 13 +++++++------ ...cluster-shared-handle-bind-privileged-port.js | 2 +- test/parallel/test-cwd-enoent-repl.js | 2 +- test/parallel/test-cwd-enoent.js | 2 +- .../test-dgram-exclusive-implicit-bind.js | 8 +++----- test/parallel/test-fs-access.js | 2 +- test/parallel/test-fs-append-file-sync.js | 2 +- test/parallel/test-fs-append-file.js | 2 +- test/parallel/test-fs-chmod.js | 11 +++++------ test/parallel/test-fs-readfile-pipe-large.js | 2 +- test/parallel/test-fs-readfile-pipe.js | 2 +- test/parallel/test-fs-readfilesync-pipe-large.js | 2 +- test/parallel/test-fs-realpath.js | 7 +++---- test/parallel/test-fs-symlink.js | 4 +--- test/parallel/test-fs-utimes.js | 4 +--- test/parallel/test-fs-write-file-sync.js | 3 +-- test/parallel/test-fs-write-file.js | 2 +- test/parallel/test-https-foafssl.js | 2 +- test/parallel/test-listen-fd-cluster.js | 2 +- test/parallel/test-listen-fd-detached-inherit.js | 2 +- test/parallel/test-listen-fd-detached.js | 2 +- test/parallel/test-listen-fd-server.js | 2 +- .../parallel/test-module-globalpaths-nodepath.js | 4 +--- test/parallel/test-module-nodemodulepaths.js | 4 +--- test/parallel/test-net-pipe-connect-errors.js | 6 +++--- test/parallel/test-path-makelong.js | 2 +- test/parallel/test-path.js | 16 +++++++--------- .../test-process-remove-all-signal-listeners.js | 9 ++++++--- test/parallel/test-signal-handler.js | 9 +++++---- test/parallel/test-stdio-closed.js | 2 +- test/parallel/test-tls-alert.js | 2 +- test/parallel/test-tls-dhe.js | 2 +- test/parallel/test-tls-ecdh-disable.js | 2 +- test/parallel/test-tls-ecdh.js | 2 +- test/parallel/test-tls-no-sslv3.js | 2 +- test/parallel/test-tls-securepair-server.js | 2 +- test/parallel/test-tls-server-verify.js | 2 +- test/parallel/test-tls-session-cache.js | 2 +- test/parallel/test-tls-set-ciphers.js | 2 +- test/parallel/test-umask.js | 2 +- test/pummel/test-abort-fatal-error.js | 2 +- test/pummel/test-child-process-spawn-loop.js | 4 +--- test/pummel/test-exec.js | 2 +- test/pummel/test-keep-alive.js | 2 +- test/sequential/test-child-process-emfile.js | 2 +- test/sequential/test-child-process-execsync.js | 2 +- test/sequential/test-fs-watch.js | 2 +- test/sequential/test-regress-GH-3542.js | 10 +++++----- 66 files changed, 114 insertions(+), 132 deletions(-) diff --git a/test/common.js b/test/common.js index 1a56449917..1ad66cff0b 100644 --- a/test/common.js +++ b/test/common.js @@ -119,7 +119,7 @@ Object.defineProperty(exports, 'opensslCli', {get: function() { opensslCli = path.join(path.dirname(process.execPath), 'openssl-cli'); } - if (process.platform === 'win32') opensslCli += '.exe'; + if (exports.isWindows) opensslCli += '.exe'; var openssl_cmd = child_process.spawnSync(opensslCli, ['version']); if (openssl_cmd.status !== 0 || openssl_cmd.error !== undefined) { @@ -133,7 +133,7 @@ Object.defineProperty(exports, 'hasCrypto', {get: function() { return process.versions.openssl ? true : false; }}); -if (process.platform === 'win32') { +if (exports.isWindows) { exports.PIPE = '\\\\.\\pipe\\libuv-test'; } else { exports.PIPE = exports.tmpDir + '/test.sock'; @@ -150,7 +150,7 @@ if (process.env.NODE_COMMON_PIPE) { } } -if (process.platform === 'win32') { +if (exports.isWindows) { exports.faketimeCli = false; } else { exports.faketimeCli = path.join(__dirname, '..', 'tools', 'faketime', 'src', @@ -183,7 +183,7 @@ exports.indirectInstanceOf = function(obj, cls) { exports.ddCommand = function(filename, kilobytes) { - if (process.platform === 'win32') { + if (exports.isWindows) { var p = path.resolve(exports.fixturesDir, 'create-file.js'); return '"' + process.argv[0] + '" "' + p + '" "' + filename + '" ' + (kilobytes * 1024); @@ -196,7 +196,7 @@ exports.ddCommand = function(filename, kilobytes) { exports.spawnCat = function(options) { var spawn = require('child_process').spawn; - if (process.platform === 'win32') { + if (exports.isWindows) { return spawn('more', [], options); } else { return spawn('cat', [], options); @@ -207,7 +207,7 @@ exports.spawnCat = function(options) { exports.spawnSyncCat = function(options) { var spawnSync = require('child_process').spawnSync; - if (process.platform === 'win32') { + if (exports.isWindows) { return spawnSync('more', [], options); } else { return spawnSync('cat', [], options); @@ -218,7 +218,7 @@ exports.spawnSyncCat = function(options) { exports.spawnPwd = function(options) { var spawn = require('child_process').spawn; - if (process.platform === 'win32') { + if (exports.isWindows) { return spawn('cmd.exe', ['/c', 'cd'], options); } else { return spawn('pwd', [], options); @@ -374,7 +374,7 @@ exports.checkSpawnSyncRet = function(ret) { }; var etcServicesFileName = path.join('/etc', 'services'); -if (process.platform === 'win32') { +if (exports.isWindows) { etcServicesFileName = path.join(process.env.SystemRoot, 'System32', 'drivers', 'etc', 'services'); } diff --git a/test/parallel/test-c-ares.js b/test/parallel/test-c-ares.js index 739c3256fb..b7802881f8 100644 --- a/test/parallel/test-c-ares.js +++ b/test/parallel/test-c-ares.js @@ -30,7 +30,7 @@ assert.throws(function() { // Windows doesn't usually have an entry for localhost 127.0.0.1 in // C:\Windows\System32\drivers\etc\hosts // so we disable this test on Windows. -if (process.platform != 'win32') { +if (!common.isWindows) { dns.resolve('127.0.0.1', 'PTR', function(error, domains) { if (error) throw error; assert.ok(Array.isArray(domains)); diff --git a/test/parallel/test-child-process-cwd.js b/test/parallel/test-child-process-cwd.js index 5d3f0d9496..e0e83b6007 100644 --- a/test/parallel/test-child-process-cwd.js +++ b/test/parallel/test-child-process-cwd.js @@ -38,7 +38,7 @@ function testCwd(options, forCode, forData) { } // Assume these exist, and 'pwd' gives us the right directory back -if (process.platform == 'win32') { +if (common.isWindows) { testCwd({cwd: process.env.windir}, 0, process.env.windir); testCwd({cwd: 'c:\\'}, 0, 'c:\\'); } else { diff --git a/test/parallel/test-child-process-default-options.js b/test/parallel/test-child-process-default-options.js index 93165ded6d..f11a2678f6 100644 --- a/test/parallel/test-child-process-default-options.js +++ b/test/parallel/test-child-process-default-options.js @@ -4,11 +4,9 @@ var assert = require('assert'); var spawn = require('child_process').spawn; -var isWindows = process.platform === 'win32'; - process.env.HELLO = 'WORLD'; -if (isWindows) { +if (common.isWindows) { var child = spawn('cmd.exe', ['/c', 'set'], {}); } else { var child = spawn('/usr/bin/env', [], {}); diff --git a/test/parallel/test-child-process-double-pipe.js b/test/parallel/test-child-process-double-pipe.js index 41f49bb7a8..b791d4164d 100644 --- a/test/parallel/test-child-process-double-pipe.js +++ b/test/parallel/test-child-process-double-pipe.js @@ -1,6 +1,4 @@ 'use strict'; -var is_windows = process.platform === 'win32'; - var common = require('../common'); var assert = require('assert'), os = require('os'), @@ -12,7 +10,7 @@ var assert = require('assert'), var grep, sed, echo; -if (is_windows) { +if (common.isWindows) { grep = spawn('grep', ['--binary', 'o']), sed = spawn('sed', ['--binary', 's/o/O/']), echo = spawn('cmd.exe', diff --git a/test/parallel/test-child-process-env.js b/test/parallel/test-child-process-env.js index 6f2051f128..1374c2332c 100644 --- a/test/parallel/test-child-process-env.js +++ b/test/parallel/test-child-process-env.js @@ -4,8 +4,6 @@ var assert = require('assert'); var spawn = require('child_process').spawn; -var isWindows = process.platform === 'win32'; - var env = { 'HELLO': 'WORLD' }; @@ -13,7 +11,7 @@ env.__proto__ = { 'FOO': 'BAR' }; -if (isWindows) { +if (common.isWindows) { var child = spawn('cmd.exe', ['/c', 'set'], {env: env}); } else { var child = spawn('/usr/bin/env', [], {env: env}); diff --git a/test/parallel/test-child-process-exec-cwd.js b/test/parallel/test-child-process-exec-cwd.js index 9e7039990e..e253399b96 100644 --- a/test/parallel/test-child-process-exec-cwd.js +++ b/test/parallel/test-child-process-exec-cwd.js @@ -1,5 +1,5 @@ 'use strict'; -require('../common'); +const common = require('../common'); var assert = require('assert'); var exec = require('child_process').exec; @@ -8,7 +8,7 @@ var error_count = 0; var pwdcommand, dir; -if (process.platform == 'win32') { +if (common.isWindows) { pwdcommand = 'echo %cd%'; dir = 'c:\\windows'; } else { diff --git a/test/parallel/test-child-process-exec-env.js b/test/parallel/test-child-process-exec-env.js index eb554b459c..e80531e87e 100644 --- a/test/parallel/test-child-process-exec-env.js +++ b/test/parallel/test-child-process-exec-env.js @@ -20,7 +20,7 @@ function after(err, stdout, stderr) { } } -if (process.platform !== 'win32') { +if (!common.isWindows) { child = exec('/usr/bin/env', { env: { 'HELLO': 'WORLD' } }, after); } else { child = exec('set', { env: { 'HELLO': 'WORLD' } }, after); diff --git a/test/parallel/test-child-process-exec-error.js b/test/parallel/test-child-process-exec-error.js index b141fc3f2c..416eb16514 100644 --- a/test/parallel/test-child-process-exec-error.js +++ b/test/parallel/test-child-process-exec-error.js @@ -17,7 +17,7 @@ function test(fun, code) { }); } -if (process.platform === 'win32') { +if (common.isWindows) { test(child_process.exec, 1); // exit code of cmd.exe } else { test(child_process.exec, 127); // exit code of /bin/sh diff --git a/test/parallel/test-child-process-fork-dgram.js b/test/parallel/test-child-process-fork-dgram.js index 8858966fde..8676481a17 100644 --- a/test/parallel/test-child-process-fork-dgram.js +++ b/test/parallel/test-child-process-fork-dgram.js @@ -18,7 +18,7 @@ var fork = require('child_process').fork; var assert = require('assert'); var common = require('../common'); -if (process.platform === 'win32') { +if (common.isWindows) { console.error('Sending dgram sockets to child processes not supported'); process.exit(0); } diff --git a/test/parallel/test-child-process-kill.js b/test/parallel/test-child-process-kill.js index 948348add4..745816bb68 100644 --- a/test/parallel/test-child-process-kill.js +++ b/test/parallel/test-child-process-kill.js @@ -4,14 +4,12 @@ var assert = require('assert'); var spawn = require('child_process').spawn; -var is_windows = process.platform === 'win32'; - var exitCode; var termSignal; var gotStdoutEOF = false; var gotStderrEOF = false; -var cat = spawn(is_windows ? 'cmd' : 'cat'); +var cat = spawn(common.isWindows ? 'cmd' : 'cat'); cat.stdout.on('end', function() { diff --git a/test/parallel/test-child-process-spawn-typeerror.js b/test/parallel/test-child-process-spawn-typeerror.js index 35c190353b..348ab2491d 100644 --- a/test/parallel/test-child-process-spawn-typeerror.js +++ b/test/parallel/test-child-process-spawn-typeerror.js @@ -2,7 +2,7 @@ var assert = require('assert'); var child_process = require('child_process'); var spawn = child_process.spawn; -var cmd = (process.platform === 'win32') ? 'rundll32' : 'ls'; +var cmd = require('../common').isWindows ? 'rundll32' : 'ls'; var invalidArgsMsg = /Incorrect value of args option/; var invalidOptionsMsg = /options argument must be an object/; diff --git a/test/parallel/test-child-process-spawnsync.js b/test/parallel/test-child-process-spawnsync.js index b6f4d31b5c..619cfb7a9d 100644 --- a/test/parallel/test-child-process-spawnsync.js +++ b/test/parallel/test-child-process-spawnsync.js @@ -38,7 +38,7 @@ assert.deepEqual(ret_err.spawnargs, ['bar']); var response; var cwd; - if (process.platform === 'win32') { + if (common.isWindows) { cwd = 'c:\\'; response = spawnSync('cmd.exe', ['/c', 'cd'], {cwd: cwd}); } else { diff --git a/test/parallel/test-child-process-stdin.js b/test/parallel/test-child-process-stdin.js index ba3ef0e0c1..c12b245793 100644 --- a/test/parallel/test-child-process-stdin.js +++ b/test/parallel/test-child-process-stdin.js @@ -3,9 +3,8 @@ var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; -var is_windows = process.platform === 'win32'; -var cat = spawn(is_windows ? 'more' : 'cat'); +var cat = spawn(common.isWindows ? 'more' : 'cat'); cat.stdin.write('hello'); cat.stdin.write(' '); cat.stdin.write('world'); @@ -51,7 +50,7 @@ cat.on('exit', function(status) { cat.on('close', function() { closed = true; - if (is_windows) { + if (common.isWindows) { assert.equal('hello world\r\n', response); } else { assert.equal('hello world', response); @@ -61,7 +60,7 @@ cat.on('close', function() { process.on('exit', function() { assert.equal(0, exitStatus); assert(closed); - if (is_windows) { + if (common.isWindows) { assert.equal('hello world\r\n', response); } else { assert.equal('hello world', response); diff --git a/test/parallel/test-cluster-bind-privileged-port.js b/test/parallel/test-cluster-bind-privileged-port.js index 6bb83efe5c..0e1e7e244c 100644 --- a/test/parallel/test-cluster-bind-privileged-port.js +++ b/test/parallel/test-cluster-bind-privileged-port.js @@ -4,7 +4,7 @@ var assert = require('assert'); var cluster = require('cluster'); var net = require('net'); -if (process.platform === 'win32') { +if (common.isWindows) { console.log('1..0 # Skipped: not reliable on Windows.'); return; } diff --git a/test/parallel/test-cluster-dgram-1.js b/test/parallel/test-cluster-dgram-1.js index bccc39637b..b0db72b129 100644 --- a/test/parallel/test-cluster-dgram-1.js +++ b/test/parallel/test-cluster-dgram-1.js @@ -8,7 +8,7 @@ var common = require('../common'); var dgram = require('dgram'); -if (process.platform === 'win32') { +if (common.isWindows) { console.warn('dgram clustering is currently not supported on windows.'); process.exit(0); } diff --git a/test/parallel/test-cluster-dgram-2.js b/test/parallel/test-cluster-dgram-2.js index db4f986f2d..016a836227 100644 --- a/test/parallel/test-cluster-dgram-2.js +++ b/test/parallel/test-cluster-dgram-2.js @@ -8,7 +8,7 @@ var common = require('../common'); var dgram = require('dgram'); -if (process.platform === 'win32') { +if (common.isWindows) { console.warn('dgram clustering is currently not supported on windows.'); process.exit(0); } diff --git a/test/parallel/test-cluster-disconnect-unshared-udp.js b/test/parallel/test-cluster-disconnect-unshared-udp.js index 0d3eb2a5ad..2547ffae1f 100644 --- a/test/parallel/test-cluster-disconnect-unshared-udp.js +++ b/test/parallel/test-cluster-disconnect-unshared-udp.js @@ -1,5 +1,8 @@ 'use strict'; -if (process.platform === 'win32') { + +const common = require('../common'); + +if (common.isWindows) { console.log('1..0 # Skipped: on windows, because clustered dgram is ENOTSUP'); return; } diff --git a/test/parallel/test-cluster-http-pipe.js b/test/parallel/test-cluster-http-pipe.js index 5ae3b138cc..2a968f5645 100644 --- a/test/parallel/test-cluster-http-pipe.js +++ b/test/parallel/test-cluster-http-pipe.js @@ -1,14 +1,15 @@ 'use strict'; + +const common = require('../common'); +const assert = require('assert'); +const cluster = require('cluster'); +const http = require('http'); + // It is not possible to send pipe handles over the IPC pipe on Windows. -if (process.platform === 'win32') { +if (common.isWindows) { process.exit(0); } -var common = require('../common'); -var assert = require('assert'); -var cluster = require('cluster'); -var http = require('http'); - if (cluster.isMaster) { common.refreshTmpDir(); var ok = false; diff --git a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js index 188f6fb208..f524d6bda9 100644 --- a/test/parallel/test-cluster-shared-handle-bind-privileged-port.js +++ b/test/parallel/test-cluster-shared-handle-bind-privileged-port.js @@ -4,7 +4,7 @@ var assert = require('assert'); var cluster = require('cluster'); var net = require('net'); -if (process.platform === 'win32') { +if (common.isWindows) { console.log('1..0 # Skipped: not reliable on Windows'); return; } diff --git a/test/parallel/test-cwd-enoent-repl.js b/test/parallel/test-cwd-enoent-repl.js index da96c1094d..e902dd6e64 100644 --- a/test/parallel/test-cwd-enoent-repl.js +++ b/test/parallel/test-cwd-enoent-repl.js @@ -5,7 +5,7 @@ var fs = require('fs'); var spawn = require('child_process').spawn; // Fails with EINVAL on SmartOS, EBUSY on Windows. -if (process.platform === 'sunos' || process.platform === 'win32') { +if (process.platform === 'sunos' || common.isWindows) { console.log('1..0 # Skipped: cannot rmdir current working directory'); return; } diff --git a/test/parallel/test-cwd-enoent.js b/test/parallel/test-cwd-enoent.js index edc64e8665..ebb62c1768 100644 --- a/test/parallel/test-cwd-enoent.js +++ b/test/parallel/test-cwd-enoent.js @@ -5,7 +5,7 @@ var fs = require('fs'); var spawn = require('child_process').spawn; // Fails with EINVAL on SmartOS, EBUSY on Windows. -if (process.platform === 'sunos' || process.platform === 'win32') { +if (process.platform === 'sunos' || common.isWindows) { console.log('1..0 # Skipped: cannot rmdir current working directory'); return; } diff --git a/test/parallel/test-dgram-exclusive-implicit-bind.js b/test/parallel/test-dgram-exclusive-implicit-bind.js index 077e1812b9..cebb162042 100644 --- a/test/parallel/test-dgram-exclusive-implicit-bind.js +++ b/test/parallel/test-dgram-exclusive-implicit-bind.js @@ -39,8 +39,6 @@ var dgram = require('dgram'); // supported while using cluster, though servers still cause the master to error // with ENOTSUP. -var windows = process.platform === 'win32'; - if (cluster.isMaster) { var pass; var messages = 0; @@ -56,12 +54,12 @@ if (cluster.isMaster) { messages++; ports[rinfo.port] = true; - if (windows && messages === 2) { + if (common.isWindows && messages === 2) { assert.equal(Object.keys(ports).length, 2); done(); } - if (!windows && messages === 4) { + if (!common.isWindows && messages === 4) { assert.equal(Object.keys(ports).length, 3); done(); } @@ -76,7 +74,7 @@ if (cluster.isMaster) { target.on('listening', function() { cluster.fork(); cluster.fork(); - if (!windows) { + if (!common.isWindows) { cluster.fork({BOUND: 'y'}); cluster.fork({BOUND: 'y'}); } diff --git a/test/parallel/test-fs-access.js b/test/parallel/test-fs-access.js index 9c586692b8..e25701b0b3 100644 --- a/test/parallel/test-fs-access.js +++ b/test/parallel/test-fs-access.js @@ -49,7 +49,7 @@ createFileWithPerms(readWriteFile, 0o666); * continuous integration platform to take care of that. */ var hasWriteAccessForReadonlyFile = false; -if (process.platform !== 'win32' && process.getuid() === 0) { +if (!common.isWindows && process.getuid() === 0) { hasWriteAccessForReadonlyFile = true; try { process.setuid('nobody'); diff --git a/test/parallel/test-fs-append-file-sync.js b/test/parallel/test-fs-append-file-sync.js index bb9d243472..b3789ad911 100644 --- a/test/parallel/test-fs-append-file-sync.js +++ b/test/parallel/test-fs-append-file-sync.js @@ -62,7 +62,7 @@ var m = 0o600; fs.appendFileSync(filename4, num, { mode: m }); // windows permissions aren't unix -if (process.platform !== 'win32') { +if (!common.isWindows) { var st = fs.statSync(filename4); assert.equal(st.mode & 0o700, m); } diff --git a/test/parallel/test-fs-append-file.js b/test/parallel/test-fs-append-file.js index aa96f86b2b..4951fa85b4 100644 --- a/test/parallel/test-fs-append-file.js +++ b/test/parallel/test-fs-append-file.js @@ -91,7 +91,7 @@ fs.appendFile(filename4, n, { mode: m }, function(e) { common.error('appended to file4'); // windows permissions aren't unix - if (process.platform !== 'win32') { + if (!common.isWindows) { var st = fs.statSync(filename4); assert.equal(st.mode & 0o700, m); } diff --git a/test/parallel/test-fs-chmod.js b/test/parallel/test-fs-chmod.js index 5d4a8a2b9c..11c8bb6168 100644 --- a/test/parallel/test-fs-chmod.js +++ b/test/parallel/test-fs-chmod.js @@ -7,7 +7,6 @@ var got_error = false; var success_count = 0; var mode_async; var mode_sync; -var is_windows = process.platform === 'win32'; // Need to hijack fs.open/close to make sure that things // get closed once they're opened. @@ -44,7 +43,7 @@ function closeSync() { // On Windows chmod is only able to manipulate read-only bit -if (is_windows) { +if (common.isWindows) { mode_async = 0o400; // read-only mode_sync = 0o600; // read-write } else { @@ -61,14 +60,14 @@ fs.chmod(file1, mode_async.toString(8), function(err) { } else { console.log(fs.statSync(file1).mode); - if (is_windows) { + if (common.isWindows) { assert.ok((fs.statSync(file1).mode & 0o777) & mode_async); } else { assert.equal(mode_async, fs.statSync(file1).mode & 0o777); } fs.chmodSync(file1, mode_sync); - if (is_windows) { + if (common.isWindows) { assert.ok((fs.statSync(file1).mode & 0o777) & mode_sync); } else { assert.equal(mode_sync, fs.statSync(file1).mode & 0o777); @@ -89,14 +88,14 @@ fs.open(file2, 'a', function(err, fd) { } else { console.log(fs.fstatSync(fd).mode); - if (is_windows) { + if (common.isWindows) { assert.ok((fs.fstatSync(fd).mode & 0o777) & mode_async); } else { assert.equal(mode_async, fs.fstatSync(fd).mode & 0o777); } fs.fchmodSync(fd, mode_sync); - if (is_windows) { + if (common.isWindows) { assert.ok((fs.fstatSync(fd).mode & 0o777) & mode_sync); } else { assert.equal(mode_sync, fs.fstatSync(fd).mode & 0o777); diff --git a/test/parallel/test-fs-readfile-pipe-large.js b/test/parallel/test-fs-readfile-pipe-large.js index 99e4bfada8..b24c06dcc0 100644 --- a/test/parallel/test-fs-readfile-pipe-large.js +++ b/test/parallel/test-fs-readfile-pipe-large.js @@ -5,7 +5,7 @@ var path = require('path'); // simulate `cat readfile.js | node readfile.js` -if (process.platform === 'win32') { +if (common.isWindows) { console.log('1..0 # Skipped: No /dev/stdin on windows.'); return; } diff --git a/test/parallel/test-fs-readfile-pipe.js b/test/parallel/test-fs-readfile-pipe.js index 2ac547e5c7..1078f02e58 100644 --- a/test/parallel/test-fs-readfile-pipe.js +++ b/test/parallel/test-fs-readfile-pipe.js @@ -4,7 +4,7 @@ var assert = require('assert'); // simulate `cat readfile.js | node readfile.js` -if (process.platform === 'win32') { +if (common.isWindows) { console.log('1..0 # Skipped: No /dev/stdin on windows.'); return; } diff --git a/test/parallel/test-fs-readfilesync-pipe-large.js b/test/parallel/test-fs-readfilesync-pipe-large.js index 9b0b6b4299..ad2e613c0a 100644 --- a/test/parallel/test-fs-readfilesync-pipe-large.js +++ b/test/parallel/test-fs-readfilesync-pipe-large.js @@ -5,7 +5,7 @@ var path = require('path'); // simulate `cat readfile.js | node readfile.js` -if (process.platform === 'win32') { +if (common.isWindows) { console.log('1..0 # Skipped: No /dev/stdin on windows.'); return; } diff --git a/test/parallel/test-fs-realpath.js b/test/parallel/test-fs-realpath.js index a87ef2428d..9082e1d65f 100644 --- a/test/parallel/test-fs-realpath.js +++ b/test/parallel/test-fs-realpath.js @@ -5,13 +5,12 @@ var fs = require('fs'); var path = require('path'); var exec = require('child_process').exec; var async_completed = 0, async_expected = 0, unlink = []; -var isWindows = process.platform === 'win32'; var skipSymlinks = false; common.refreshTmpDir(); var root = '/'; -if (isWindows) { +if (common.isWindows) { // something like "C:\\" root = process.cwd().substr(0, 3); @@ -292,7 +291,7 @@ function test_relative_input_cwd(callback) { function test_deep_symlink_mix(callback) { console.log('test_deep_symlink_mix'); - if (isWindows) { + if (common.isWindows) { // This one is a mix of files and directories, and it's quite tricky // to get the file/dir links sorted out correctly. console.log('1..0 # Skipped: symlink test (no privs)'); @@ -503,7 +502,7 @@ function test_lying_cache_liar(cb) { '/a/b' : '/a/b', '/a/b/c' : '/a/b', '/a/b/d' : '/a/b/d' }; - if (isWindows) { + if (common.isWindows) { var wc = {}; Object.keys(cache).forEach(function(k) { wc[ path.resolve(k) ] = path.resolve(cache[k]); diff --git a/test/parallel/test-fs-symlink.js b/test/parallel/test-fs-symlink.js index 0315fec549..199add4a1b 100644 --- a/test/parallel/test-fs-symlink.js +++ b/test/parallel/test-fs-symlink.js @@ -9,8 +9,6 @@ var expected_async = 4; var linkTime; var fileTime; -var is_windows = process.platform === 'win32'; - common.refreshTmpDir(); var runtest = function(skip_symlinks) { @@ -57,7 +55,7 @@ var runtest = function(skip_symlinks) { }); }; -if (is_windows) { +if (common.isWindows) { // On Windows, creating symlinks requires admin privileges. // We'll only try to run symlink test if we have enough privileges. exec('whoami /priv', function(err, o) { diff --git a/test/parallel/test-fs-utimes.js b/test/parallel/test-fs-utimes.js index 863d66d89e..292636b1b6 100644 --- a/test/parallel/test-fs-utimes.js +++ b/test/parallel/test-fs-utimes.js @@ -4,8 +4,6 @@ var assert = require('assert'); var util = require('util'); var fs = require('fs'); -var is_windows = process.platform === 'win32'; - var tests_ok = 0; var tests_run = 0; @@ -99,7 +97,7 @@ function runTest(atime, mtime, callback) { expect_errno('utimes', 'foobarbaz', err, 'ENOENT'); // don't close this fd - if (is_windows) { + if (common.isWindows) { fd = fs.openSync(__filename, 'r+'); } else { fd = fs.openSync(__filename, 'r'); diff --git a/test/parallel/test-fs-write-file-sync.js b/test/parallel/test-fs-write-file-sync.js index ea54db1945..37373404da 100644 --- a/test/parallel/test-fs-write-file-sync.js +++ b/test/parallel/test-fs-write-file-sync.js @@ -3,7 +3,6 @@ var common = require('../common'); var assert = require('assert'); var path = require('path'); var fs = require('fs'); -var isWindows = process.platform === 'win32'; var openCount = 0; var mode; var content; @@ -20,7 +19,7 @@ var mask = process.umask(0o000); // On Windows chmod is only able to manipulate read-only bit. Test if creating // the file in read-only mode works. -if (isWindows) { +if (common.isWindows) { mode = 0o444; } else { mode = 0o755; diff --git a/test/parallel/test-fs-write-file.js b/test/parallel/test-fs-write-file.js index eafa7fdabd..6ac7f175f5 100644 --- a/test/parallel/test-fs-write-file.js +++ b/test/parallel/test-fs-write-file.js @@ -63,7 +63,7 @@ fs.writeFile(filename3, n, { mode: m }, function(e) { if (e) throw e; // windows permissions aren't unix - if (process.platform !== 'win32') { + if (!common.isWindows) { var st = fs.statSync(filename3); assert.equal(st.mode & 0o700, m); } diff --git a/test/parallel/test-https-foafssl.js b/test/parallel/test-https-foafssl.js index 5b1d04dd41..d6df518989 100644 --- a/test/parallel/test-https-foafssl.js +++ b/test/parallel/test-https-foafssl.js @@ -54,7 +54,7 @@ server.listen(common.PORT, function() { '-key', join(common.fixturesDir, 'foafssl.key')]; // for the performance and stability issue in s_client on Windows - if (process.platform === 'win32') + if (common.isWindows) args.push('-no_rand_screen'); var client = spawn(common.opensslCli, args); diff --git a/test/parallel/test-listen-fd-cluster.js b/test/parallel/test-listen-fd-cluster.js index b10edd33e0..e895a29447 100644 --- a/test/parallel/test-listen-fd-cluster.js +++ b/test/parallel/test-listen-fd-cluster.js @@ -9,7 +9,7 @@ var cluster = require('cluster'); console.error('Cluster listen fd test', process.argv.slice(2)); -if (process.platform === 'win32') { +if (common.isWindows) { console.log('1..0 # Skipped: This test is disabled on windows.'); return; } diff --git a/test/parallel/test-listen-fd-detached-inherit.js b/test/parallel/test-listen-fd-detached-inherit.js index 3660766293..7d4df0c1ae 100644 --- a/test/parallel/test-listen-fd-detached-inherit.js +++ b/test/parallel/test-listen-fd-detached-inherit.js @@ -6,7 +6,7 @@ var net = require('net'); var PORT = common.PORT; var spawn = require('child_process').spawn; -if (process.platform === 'win32') { +if (common.isWindows) { console.log('1..0 # Skipped: This test is disabled on windows.'); return; } diff --git a/test/parallel/test-listen-fd-detached.js b/test/parallel/test-listen-fd-detached.js index b7af1a6a49..12c8c3ddc4 100644 --- a/test/parallel/test-listen-fd-detached.js +++ b/test/parallel/test-listen-fd-detached.js @@ -6,7 +6,7 @@ var net = require('net'); var PORT = common.PORT; var spawn = require('child_process').spawn; -if (process.platform === 'win32') { +if (common.isWindows) { console.log('1..0 # Skipped: This test is disabled on windows.'); return; } diff --git a/test/parallel/test-listen-fd-server.js b/test/parallel/test-listen-fd-server.js index 8451a79c9e..d4d11e5a8d 100644 --- a/test/parallel/test-listen-fd-server.js +++ b/test/parallel/test-listen-fd-server.js @@ -6,7 +6,7 @@ var net = require('net'); var PORT = common.PORT; var spawn = require('child_process').spawn; -if (process.platform === 'win32') { +if (common.isWindows) { console.log('1..0 # Skipped: This test is disabled on windows.'); return; } diff --git a/test/parallel/test-module-globalpaths-nodepath.js b/test/parallel/test-module-globalpaths-nodepath.js index d81f5994f2..3369df0676 100644 --- a/test/parallel/test-module-globalpaths-nodepath.js +++ b/test/parallel/test-module-globalpaths-nodepath.js @@ -4,12 +4,10 @@ var assert = require('assert'); var module = require('module'); -var isWindows = process.platform === 'win32'; - var partA, partB; var partC = ''; -if (isWindows) { +if (common.isWindows) { partA = 'C:\\Users\\Rocko Artischocko\\AppData\\Roaming\\npm'; partB = 'C:\\Program Files (x86)\\nodejs\\'; process.env['NODE_PATH'] = partA + ';' + partB + ';' + partC; diff --git a/test/parallel/test-module-nodemodulepaths.js b/test/parallel/test-module-nodemodulepaths.js index a1a70309b5..0c70de9f28 100644 --- a/test/parallel/test-module-nodemodulepaths.js +++ b/test/parallel/test-module-nodemodulepaths.js @@ -4,11 +4,9 @@ var assert = require('assert'); var module = require('module'); -var isWindows = process.platform === 'win32'; - var file, delimiter, paths; -if (isWindows) { +if (common.isWindows) { file = 'C:\\Users\\Rocko Artischocko\\node_stuff\\foo'; delimiter = '\\'; } else { diff --git a/test/parallel/test-net-pipe-connect-errors.js b/test/parallel/test-net-pipe-connect-errors.js index a831b10712..e2ec1debf1 100644 --- a/test/parallel/test-net-pipe-connect-errors.js +++ b/test/parallel/test-net-pipe-connect-errors.js @@ -14,7 +14,7 @@ var accessErrorFired = false; var emptyTxt; -if (process.platform === 'win32') { +if (common.isWindows) { // on Win, common.PIPE will be a named pipe, so we use an existing empty // file instead emptyTxt = path.join(common.fixturesDir, 'empty.txt'); @@ -58,7 +58,7 @@ noEntSocketClient.on('error', function(err) { // On Windows or when running as root, a chmod has no effect on named pipes -if (process.platform !== 'win32' && process.getuid() !== 0) { +if (!common.isWindows && process.getuid() !== 0) { // Trying to connect to a socket one has no access to should result in EACCES var accessServer = net.createServer(function() { assert.ok(false); @@ -83,7 +83,7 @@ if (process.platform !== 'win32' && process.getuid() !== 0) { process.on('exit', function() { assert.ok(notSocketErrorFired); assert.ok(noEntErrorFired); - if (process.platform !== 'win32' && process.getuid() !== 0) { + if (!common.isWindows && process.getuid() !== 0) { assert.ok(accessErrorFired); } }); diff --git a/test/parallel/test-path-makelong.js b/test/parallel/test-path-makelong.js index b9cc116a5e..2de630189c 100644 --- a/test/parallel/test-path-makelong.js +++ b/test/parallel/test-path-makelong.js @@ -3,7 +3,7 @@ var assert = require('assert'); var path = require('path'); var common = require('../common'); -if (process.platform === 'win32') { +if (common.isWindows) { var file = path.join(common.fixturesDir, 'a.js'); var resolvedFile = path.resolve(file); diff --git a/test/parallel/test-path.js b/test/parallel/test-path.js index b1209d762a..c13b8d4efd 100644 --- a/test/parallel/test-path.js +++ b/test/parallel/test-path.js @@ -4,8 +4,6 @@ var assert = require('assert'); var path = require('path'); -var isWindows = process.platform === 'win32'; - var f = __filename; assert.equal(path.basename(f), 'test-path.js'); @@ -33,7 +31,7 @@ assert.equal(path.posix.basename('basename.ext\\\\'), 'basename.ext\\\\'); // POSIX filenames may include control characters // c.f. http://www.dwheeler.com/essays/fixing-unix-linux-filenames.html -if (!isWindows) { +if (!common.isWindows) { var controlCharFilename = 'Icon' + String.fromCharCode(13); assert.equal(path.basename('/a/b/' + controlCharFilename), controlCharFilename); @@ -42,7 +40,7 @@ if (!isWindows) { assert.equal(path.extname(f), '.js'); assert.equal(path.dirname(f).substr(-13), - isWindows ? 'test\\parallel' : 'test/parallel'); + common.isWindows ? 'test\\parallel' : 'test/parallel'); assert.equal(path.dirname('/a/b/'), '/a'); assert.equal(path.dirname('/a/b'), '/a'); assert.equal(path.dirname('/a'), '/'); @@ -194,7 +192,7 @@ var joinTests = ]; // Windows-specific join tests -if (isWindows) { +if (common.isWindows) { joinTests = joinTests.concat( [// UNC path expected [['//foo/bar'], '//foo/bar/'], @@ -246,7 +244,7 @@ if (isWindows) { // Run the join tests. joinTests.forEach(function(test) { var actual = path.join.apply(path, test[0]); - var expected = isWindows ? test[1].replace(/\//g, '\\') : test[1]; + var expected = common.isWindows ? test[1].replace(/\//g, '\\') : test[1]; var message = 'path.join(' + test[0].map(JSON.stringify).join(',') + ')' + '\n expect=' + JSON.stringify(expected) + '\n actual=' + JSON.stringify(actual); @@ -306,7 +304,7 @@ assert.equal(path.posix.normalize('a//b//./c'), 'a/b/c'); assert.equal(path.posix.normalize('a//b//.'), 'a/b'); // path.resolve tests -if (isWindows) { +if (common.isWindows) { // windows var resolveTests = // arguments result @@ -360,7 +358,7 @@ assert.equal(path.posix.isAbsolute('bar/'), false); assert.equal(path.posix.isAbsolute('./baz'), false); // path.relative tests -if (isWindows) { +if (common.isWindows) { // windows var relativeTests = // arguments result @@ -409,7 +407,7 @@ assert.equal(path.win32.delimiter, ';'); assert.equal(path.posix.delimiter, ':'); -if (isWindows) +if (common.isWindows) assert.deepEqual(path, path.win32, 'should be win32 path module'); else assert.deepEqual(path, path.posix, 'should be posix path module'); diff --git a/test/parallel/test-process-remove-all-signal-listeners.js b/test/parallel/test-process-remove-all-signal-listeners.js index 408f6596c4..460f8f0365 100644 --- a/test/parallel/test-process-remove-all-signal-listeners.js +++ b/test/parallel/test-process-remove-all-signal-listeners.js @@ -1,12 +1,15 @@ 'use strict'; -if (process.platform === 'win32') { + +const assert = require('assert'); +const spawn = require('child_process').spawn; +const common = require('../common'); + +if (common.isWindows) { // Win32 doesn't have signals, just a kindof emulation, insufficient // for this test to apply. return; } -var assert = require('assert'); -var spawn = require('child_process').spawn; var ok; if (process.argv[2] !== '--do-test') { diff --git a/test/parallel/test-signal-handler.js b/test/parallel/test-signal-handler.js index f186287b0c..a6e9adab3f 100644 --- a/test/parallel/test-signal-handler.js +++ b/test/parallel/test-signal-handler.js @@ -1,12 +1,13 @@ 'use strict'; + +const common = require('../common'); +const assert = require('assert'); + // SIGUSR1 and SIGHUP are not supported on Windows -if (process.platform === 'win32') { +if (common.isWindows) { process.exit(0); } -var common = require('../common'); -var assert = require('assert'); - console.log('process.pid: ' + process.pid); var first = 0, diff --git a/test/parallel/test-stdio-closed.js b/test/parallel/test-stdio-closed.js index afa8de9632..9249ea797b 100644 --- a/test/parallel/test-stdio-closed.js +++ b/test/parallel/test-stdio-closed.js @@ -3,7 +3,7 @@ var common = require('../common'); var assert = require('assert'); var spawn = require('child_process').spawn; -if (process.platform === 'win32') { +if (common.isWindows) { console.log('1..0 # Skipped: platform not supported.'); return; } diff --git a/test/parallel/test-tls-alert.js b/test/parallel/test-tls-alert.js index 2f2e62c564..4eedeaa785 100644 --- a/test/parallel/test-tls-alert.js +++ b/test/parallel/test-tls-alert.js @@ -35,7 +35,7 @@ var server = tls.Server({ '-connect', '127.0.0.1:' + common.PORT]; // for the performance and stability issue in s_client on Windows - if (process.platform === 'win32') + if (common.isWindows) args.push('-no_rand_screen'); var client = spawn(common.opensslCli, args); diff --git a/test/parallel/test-tls-dhe.js b/test/parallel/test-tls-dhe.js index f6a2f1649b..ffcf52947f 100644 --- a/test/parallel/test-tls-dhe.js +++ b/test/parallel/test-tls-dhe.js @@ -45,7 +45,7 @@ function test(keylen, expectedCipher, cb) { '-cipher', ciphers]; // for the performance and stability issue in s_client on Windows - if (process.platform === 'win32') + if (common.isWindows) args.push('-no_rand_screen'); var client = spawn(common.opensslCli, args); diff --git a/test/parallel/test-tls-ecdh-disable.js b/test/parallel/test-tls-ecdh-disable.js index 0dea4cac9f..9bfb5f871a 100644 --- a/test/parallel/test-tls-ecdh-disable.js +++ b/test/parallel/test-tls-ecdh-disable.js @@ -34,7 +34,7 @@ server.listen(common.PORT, '127.0.0.1', function() { ' -connect 127.0.0.1:' + common.PORT; // for the performance and stability issue in s_client on Windows - if (process.platform === 'win32') + if (common.isWindows) cmd += ' -no_rand_screen'; exec(cmd, function(err, stdout, stderr) { diff --git a/test/parallel/test-tls-ecdh.js b/test/parallel/test-tls-ecdh.js index d728de63ee..ce9af395c5 100644 --- a/test/parallel/test-tls-ecdh.js +++ b/test/parallel/test-tls-ecdh.js @@ -37,7 +37,7 @@ server.listen(common.PORT, '127.0.0.1', function() { ' -connect 127.0.0.1:' + common.PORT; // for the performance and stability issue in s_client on Windows - if (process.platform === 'win32') + if (common.isWindows) cmd += ' -no_rand_screen'; exec(cmd, function(err, stdout, stderr) { diff --git a/test/parallel/test-tls-no-sslv3.js b/test/parallel/test-tls-no-sslv3.js index e4a4df1481..9777397758 100644 --- a/test/parallel/test-tls-no-sslv3.js +++ b/test/parallel/test-tls-no-sslv3.js @@ -31,7 +31,7 @@ server.listen(common.PORT, '127.0.0.1', function() { '-connect', address]; // for the performance and stability issue in s_client on Windows - if (process.platform === 'win32') + if (common.isWindows) args.push('-no_rand_screen'); var client = spawn(common.opensslCli, args, { stdio: 'inherit' }); diff --git a/test/parallel/test-tls-securepair-server.js b/test/parallel/test-tls-securepair-server.js index 56feb54e01..ef182f3b5d 100644 --- a/test/parallel/test-tls-securepair-server.js +++ b/test/parallel/test-tls-securepair-server.js @@ -97,7 +97,7 @@ server.listen(common.PORT, function() { var args = ['s_client', '-connect', '127.0.0.1:' + common.PORT]; // for the performance and stability issue in s_client on Windows - if (process.platform === 'win32') + if (common.isWindows) args.push('-no_rand_screen'); var client = spawn(common.opensslCli, args); diff --git a/test/parallel/test-tls-server-verify.js b/test/parallel/test-tls-server-verify.js index cbdf376c7f..fed77357da 100644 --- a/test/parallel/test-tls-server-verify.js +++ b/test/parallel/test-tls-server-verify.js @@ -135,7 +135,7 @@ function runClient(prefix, port, options, cb) { var args = ['s_client', '-connect', '127.0.0.1:' + port]; // for the performance issue in s_client on Windows - if (process.platform === 'win32') + if (common.isWindows) args.push('-no_rand_screen'); console.log(prefix + ' connecting with', options.name); diff --git a/test/parallel/test-tls-session-cache.js b/test/parallel/test-tls-session-cache.js index d1715d6d7d..ddceb973f5 100644 --- a/test/parallel/test-tls-session-cache.js +++ b/test/parallel/test-tls-session-cache.js @@ -82,7 +82,7 @@ function doTest(testOptions, callback) { ].concat(testOptions.tickets ? [] : '-no_ticket'); // for the performance and stability issue in s_client on Windows - if (process.platform === 'win32') + if (common.isWindows) args.push('-no_rand_screen'); server.listen(common.PORT, function() { diff --git a/test/parallel/test-tls-set-ciphers.js b/test/parallel/test-tls-set-ciphers.js index 7be1db0bc4..a303f6fb27 100644 --- a/test/parallel/test-tls-set-ciphers.js +++ b/test/parallel/test-tls-set-ciphers.js @@ -41,7 +41,7 @@ server.listen(common.PORT, '127.0.0.1', function() { ' -connect 127.0.0.1:' + common.PORT; // for the performance and stability issue in s_client on Windows - if (process.platform === 'win32') + if (common.isWindows) cmd += ' -no_rand_screen'; exec(cmd, function(err, stdout, stderr) { diff --git a/test/parallel/test-umask.js b/test/parallel/test-umask.js index 94d3a1d06f..62f9d82b33 100644 --- a/test/parallel/test-umask.js +++ b/test/parallel/test-umask.js @@ -4,7 +4,7 @@ var assert = require('assert'); // Note in Windows one can only set the "user" bits. var mask; -if (process.platform == 'win32') { +if (common.isWindows) { mask = '0600'; } else { mask = '0664'; diff --git a/test/pummel/test-abort-fatal-error.js b/test/pummel/test-abort-fatal-error.js index 0d31267a64..20d5c137d5 100644 --- a/test/pummel/test-abort-fatal-error.js +++ b/test/pummel/test-abort-fatal-error.js @@ -2,7 +2,7 @@ var assert = require('assert'); var common = require('../common'); -if (process.platform === 'win32') { +if (common.isWindows) { console.log('1..0 # Skipped: no RLIMIT_NOFILE on Windows'); return; } diff --git a/test/pummel/test-child-process-spawn-loop.js b/test/pummel/test-child-process-spawn-loop.js index defed7d5f6..7e686cada2 100644 --- a/test/pummel/test-child-process-spawn-loop.js +++ b/test/pummel/test-child-process-spawn-loop.js @@ -4,8 +4,6 @@ var assert = require('assert'); var spawn = require('child_process').spawn; -var is_windows = process.platform === 'win32'; - var SIZE = 1000 * 1024; var N = 40; var finished = false; @@ -25,7 +23,7 @@ function doSpawn(i) { child.on('close', function() { // + 1 for \n or + 2 for \r\n on Windows - assert.equal(SIZE + (is_windows ? 2 : 1), count); + assert.equal(SIZE + (common.isWindows ? 2 : 1), count); if (i < N) { doSpawn(i + 1); } else { diff --git a/test/pummel/test-exec.js b/test/pummel/test-exec.js index 4013e2107b..0ff1e2a7cf 100644 --- a/test/pummel/test-exec.js +++ b/test/pummel/test-exec.js @@ -3,7 +3,7 @@ var common = require('../common'); var assert = require('assert'); var exec = require('child_process').exec; -if (process.platform !== 'win32') { +if (!common.isWindows) { // Unix. var SLEEP3_COMMAND = 'sleep 3'; } else { diff --git a/test/pummel/test-keep-alive.js b/test/pummel/test-keep-alive.js index 4d3fbe0731..d396042fde 100644 --- a/test/pummel/test-keep-alive.js +++ b/test/pummel/test-keep-alive.js @@ -1,5 +1,5 @@ 'use strict'; -if (process.platform === 'win32') { +if (common.isWindows) { console.log('1..0 # Skipped: no `wrk` on windows'); return; } diff --git a/test/sequential/test-child-process-emfile.js b/test/sequential/test-child-process-emfile.js index ad67411e9e..08a34a05f2 100644 --- a/test/sequential/test-child-process-emfile.js +++ b/test/sequential/test-child-process-emfile.js @@ -4,7 +4,7 @@ var assert = require('assert'); var spawn = require('child_process').spawn; var fs = require('fs'); -if (process.platform === 'win32') { +if (common.isWindows) { console.log('1..0 # Skipped: no RLIMIT_NOFILE on Windows'); return; } diff --git a/test/sequential/test-child-process-execsync.js b/test/sequential/test-child-process-execsync.js index 13982e00a6..07b6ba4c34 100644 --- a/test/sequential/test-child-process-execsync.js +++ b/test/sequential/test-child-process-execsync.js @@ -67,7 +67,7 @@ assert.strictEqual(ret, msg + '\n', var response; var cwd; - if (process.platform === 'win32') { + if (common.isWindows) { cwd = 'c:\\'; response = execSync('echo %cd%', {cwd: cwd}); } else { diff --git a/test/sequential/test-fs-watch.js b/test/sequential/test-fs-watch.js index 70788c5853..10f4baf591 100644 --- a/test/sequential/test-fs-watch.js +++ b/test/sequential/test-fs-watch.js @@ -4,7 +4,7 @@ var assert = require('assert'); var path = require('path'); var fs = require('fs'); -var expectFilePath = process.platform === 'win32' || +var expectFilePath = common.isWindows || process.platform === 'linux' || process.platform === 'darwin'; diff --git a/test/sequential/test-regress-GH-3542.js b/test/sequential/test-regress-GH-3542.js index 16981da469..dee24c79fb 100644 --- a/test/sequential/test-regress-GH-3542.js +++ b/test/sequential/test-regress-GH-3542.js @@ -1,15 +1,15 @@ 'use strict'; -// This test is only relevant on Windows. -if (process.platform !== 'win32') { - return process.exit(0); -} - var common = require('../common'), assert = require('assert'), fs = require('fs'), path = require('path'), succeeded = 0; +// This test is only relevant on Windows. +if (!common.isWindows) { + return process.exit(0); +} + function test(p) { var result = fs.realpathSync(p); assert.strictEqual(result, path.resolve(p));