From 8dc2b422a915f7b9741b7b7d37c3bcc2e3458f54 Mon Sep 17 00:00:00 2001 From: Wyatt Preul Date: Fri, 30 Sep 2016 12:34:30 -0500 Subject: test: fix running child-process-uid-gid as root This skips the child-test-uid-gid test when run as root. Previously, the test failed if executed as root. PR-URL: https://github.com/nodejs/node/pull/8864 Reviewed-By: Colin Ihrig Reviewed-By: Anna Henningsen Reviewed-By: James M Snell Reviewed-By: Ilkka Myller --- test/parallel/test-child-process-uid-gid.js | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'test') diff --git a/test/parallel/test-child-process-uid-gid.js b/test/parallel/test-child-process-uid-gid.js index 220cae633e..1ab514566c 100644 --- a/test/parallel/test-child-process-uid-gid.js +++ b/test/parallel/test-child-process-uid-gid.js @@ -3,6 +3,11 @@ const common = require('../common'); const assert = require('assert'); const spawn = require('child_process').spawn; +if (process.getuid() === 0) { + common.skip('as this test should not be run as `root`'); + return; +} + const expectedError = common.isWindows ? /\bENOTSUP\b/ : /\bEPERM\b/; assert.throws(() => { -- cgit v1.2.3