diff --git a/test/common/index.js b/test/common/index.js index 7489b8faef088a..81e76be0f31b1a 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -40,7 +40,16 @@ const noop = () => {}; // gets tools to ignore it by default or by simple rules, especially eslint. let tmpDirName = '.tmp'; -exports.PORT = +process.env.NODE_COMMON_PORT || 12346; +Object.defineProperty(exports, 'PORT', { + get: () => { + if (+process.env.TEST_PARALLEL) { + throw new Error('common.PORT cannot be used in a parallelized test'); + } + return +process.env.NODE_COMMON_PORT || 12346; + }, + enumerable: true +}); + exports.isWindows = process.platform === 'win32'; exports.isWOW64 = exports.isWindows && diff --git a/tools/test.py b/tools/test.py index ccc25f2a883c15..230774b25619da 100755 --- a/tools/test.py +++ b/tools/test.py @@ -532,7 +532,8 @@ def Run(self): try: result = self.RunCommand(self.GetCommand(), { - "TEST_THREAD_ID": "%d" % self.thread_id + "TEST_THREAD_ID": "%d" % self.thread_id, + "TEST_PARALLEL" : "%d" % self.parallel }) finally: # Tests can leave the tty in non-blocking mode. If the test runner