Skip to content

Commit e38e25e

Browse files
test(javascript): spell the parse suite's import apart from loadSources
V8 hands back the function first compiled from the same text, bound to the Jest environment that compiled it, so the suite failed whenever it ran after syntax-printer.unittest.js in one worker.
1 parent 5c3a9dd commit e38e25e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎test/unitCases/syntax-printer-parse.unittest.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@ const ACORN_CORPUS = require("../fixtures/acorn-corpus.json");
1414
* @returns {Promise<{ ast: EXPECTED_ANY, parse: EXPECTED_ANY }>} the modules
1515
*/
1616
const loadTerser = async () => {
17+
// Spelled apart from `loadSources`: V8 hands back the function first compiled
18+
// from the same text, bound to a Jest environment that may already be gone.
1719
// eslint-disable-next-line no-new-func
18-
const importModule = new Function("specifier", "return import(specifier)");
20+
const importModule = new Function("file", "return import(file)");
1921
const directory = path.dirname(require.resolve("terser/package.json"));
2022
/**
2123
* @param {string} file a file in terser's `lib`

0 commit comments

Comments
 (0)