From 76f80a3f74a87e6e6303646106de084f696ebdd5 Mon Sep 17 00:00:00 2001 From: Wyatt Preul Date: Fri, 30 Sep 2016 12:34:30 -0500 Subject: [PATCH] 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(+) diff --git a/test/parallel/test-child-process-uid-gid.js b/test/parallel/test-child-process-uid-gid.js index 220cae633e112f..1ab514566cd93d 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(() => {