From d84a6d05a175688bf2f2ba4c48d855dde8f105ed Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Sun, 21 Apr 2019 22:25:37 -0700 Subject: [PATCH] test: make test-worker-esm-missing-main more robust test-worker-esm-missing-main failed in CI recently in a way that suggests that maybe the `does-not-exist.js` file did in fact exist. Maybe that isn't what happened at all, but let's rule it out by changing the use of `does-not-exist.js` from a file expected to be missing from the current working directory to a file in the temp directory, which the test will remove and recreate at the outset. PR-URL: https://github.com/nodejs/node/pull/27340 Reviewed-By: Luigi Pinca Reviewed-By: Beth Griggs --- test/parallel/test-worker-esm-missing-main.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/parallel/test-worker-esm-missing-main.js b/test/parallel/test-worker-esm-missing-main.js index 8d2cf8f3f3e6c5..8f4cfb0fe7fa9b 100644 --- a/test/parallel/test-worker-esm-missing-main.js +++ b/test/parallel/test-worker-esm-missing-main.js @@ -1,11 +1,14 @@ 'use strict'; const common = require('../common'); const assert = require('assert'); +const path = require('path'); const { Worker } = require('worker_threads'); -const worker = new Worker('./does-not-exist.js', { - execArgv: ['--experimental-modules'], -}); +const tmpdir = require('../common/tmpdir'); +tmpdir.refresh(); +const missing = path.join(tmpdir.path, 'does-not-exist.js'); + +const worker = new Worker(missing, { execArgv: ['--experimental-modules'] }); worker.on('error', common.mustCall((err) => { // eslint-disable-next-line node-core/no-unescaped-regexp-dot