diff options
-rw-r--r-- | test/common/index.js | 11 | ||||
-rwxr-xr-x | tools/test.py | 3 |
2 files changed, 12 insertions, 2 deletions
diff --git a/test/common/index.js b/test/common/index.js index 7489b8faef..81e76be0f3 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 ccc25f2a88..230774b256 100755 --- a/tools/test.py +++ b/tools/test.py @@ -532,7 +532,8 @@ class TestCase(object): 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 |