From 93c50a3bf4a3704e5d097d0c7b4aa790b7d932f9 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Tue, 6 Jul 2021 11:28:33 +0200 Subject: [PATCH 1/8] improve CI stability --- package.json | 18 +++++++++--------- test/WatchTestCases.test.js | 5 ++++- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index b2d21607064..6b3de495118 100644 --- a/package.json +++ b/package.json @@ -131,11 +131,11 @@ ], "scripts": { "setup": "node ./setup/setup.js", - "test": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest", + "test": "node --max-old-space-size=2048 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest", "test:update-snapshots": "yarn jest -u", - "test:integration": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/test/*.test.js\"", - "test:basic": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/te{st/TestCasesNormal,st/StatsTestCases,st/ConfigTestCases}.test.js\"", - "test:unit": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/test/*.unittest.js\"", + "test:integration": "node --max-old-space-size=2048 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/test/*.test.js\"", + "test:basic": "node --max-old-space-size=2048 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/te{st/TestCasesNormal,st/StatsTestCases,st/ConfigTestCases}.test.js\"", + "test:unit": "node --max-old-space-size=2048 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/test/*.unittest.js\"", "travis:integration": "yarn cover:integration --ci $JEST", "travis:basic": "yarn cover:basic --ci $JEST", "travis:lintunit": "yarn lint && yarn cover:unit --ci $JEST", @@ -162,13 +162,13 @@ "pretty-lint": "yarn pretty-lint-base --check", "yarn-lint": "yarn-deduplicate --fail --list -s highest yarn.lock", "yarn-lint-fix": "yarn-deduplicate -s highest yarn.lock", - "benchmark": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/test/*.benchmark.js\" --runInBand", + "benchmark": "node --max-old-space-size=2048 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/test/*.benchmark.js\" --runInBand", "cover": "yarn cover:all && yarn cover:report", "cover:clean": "rimraf .nyc_output coverage", - "cover:all": "node --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --coverage", - "cover:basic": "node --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --testMatch \"/te{st/TestCasesNormal,st/StatsTestCases,st/ConfigTestCases}.test.js\" --coverage", - "cover:integration": "node --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --testMatch \"/test/*.test.js\" --coverage", - "cover:unit": "node --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --testMatch \"/test/*.unittest.js\" --coverage", + "cover:all": "node --max-old-space-size=2048 --experimental-vm-modules node_modules/jest-cli/bin/jest --coverage", + "cover:basic": "node --max-old-space-size=2048 --experimental-vm-modules node_modules/jest-cli/bin/jest --testMatch \"/te{st/TestCasesNormal,st/StatsTestCases,st/ConfigTestCases}.test.js\" --coverage", + "cover:integration": "node --max-old-space-size=2048 --experimental-vm-modules node_modules/jest-cli/bin/jest --testMatch \"/test/*.test.js\" --coverage", + "cover:unit": "node --max-old-space-size=2048 --experimental-vm-modules node_modules/jest-cli/bin/jest --testMatch \"/test/*.unittest.js\" --coverage", "cover:types": "node node_modules/tooling/type-coverage", "cover:merge": "nyc merge .nyc_output coverage/coverage-nyc.json && rimraf .nyc_output", "cover:report": "nyc report -t coverage" diff --git a/test/WatchTestCases.test.js b/test/WatchTestCases.test.js index 2e21996f02a..27159b16a09 100644 --- a/test/WatchTestCases.test.js +++ b/test/WatchTestCases.test.js @@ -386,7 +386,10 @@ describe("WatchTestCases", () => { run.it = _it; run.getNumberOfTests = getNumberOfTests; it(`${run.name} should allow to read stats`, done => { - if (run.stats) run.stats.toString({ all: true }); + if (run.stats) { + run.stats.toString({ all: true }); + run.stats = undefined; + } done(); }); } From 87846747df5de34f1a49abfe587d7a2daf9ecfea Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Tue, 6 Jul 2021 14:01:32 +0200 Subject: [PATCH 2/8] improve CI stability --- test/Compiler.test.js | 95 ++++++++++++++++++++++++++----------------- 1 file changed, 58 insertions(+), 37 deletions(-) diff --git a/test/Compiler.test.js b/test/Compiler.test.js index 9f8903cac75..ddb5a3bd36e 100644 --- a/test/Compiler.test.js +++ b/test/Compiler.test.js @@ -64,10 +64,23 @@ describe("Compiler", () => { throw stats.errors[0]; } stats.logs = logs; - callback(stats, files, compilation); + c.close(err => { + if (err) return callback(err); + callback(stats, files, compilation); + }); }); } + let compiler; + afterEach(callback => { + if (compiler) { + compiler.close(callback); + compiler = undefined; + } else { + callback(); + } + }); + it("should compile a single file to deep output", done => { compile( "./c", @@ -202,6 +215,14 @@ describe("Compiler", () => { } }); }); + afterEach(callback => { + if (compiler) { + compiler.close(callback); + compiler = undefined; + } else { + callback(); + } + }); describe("purgeInputFileSystem", () => { it("invokes purge() if inputFileSystem.purge", done => { const mockPurge = jest.fn(); @@ -264,7 +285,7 @@ describe("Compiler", () => { }); }); it("should not emit on errors", done => { - const compiler = webpack({ + compiler = webpack({ context: __dirname, mode: "production", entry: "./missing", @@ -296,9 +317,10 @@ describe("Compiler", () => { resolve(stats); } }); + return c; }); }; - const compiler = await createCompiler({ + compiler = await createCompiler({ context: __dirname, mode: "production", entry: "./missing-file", @@ -309,7 +331,6 @@ describe("Compiler", () => { bail: true }); done(); - return compiler; } catch (err) { expect(err.toString()).toMatch( "ModuleNotFoundError: Module not found: Error: Can't resolve './missing-file'" @@ -319,7 +340,7 @@ describe("Compiler", () => { }); it("should not emit compilation errors in async (watch)", async done => { try { - const createCompiler = options => { + const createStats = options => { return new Promise((resolve, reject) => { const c = webpack(options); c.outputFileSystem = createFsFromVolume(new Volume()); @@ -331,7 +352,7 @@ describe("Compiler", () => { }); }); }; - const compiler = await createCompiler({ + const stats = await createStats({ context: __dirname, mode: "production", entry: "./missing-file", @@ -340,7 +361,7 @@ describe("Compiler", () => { filename: "bundle.js" } }); - expect(compiler).toBeInstanceOf(Stats); + expect(stats).toBeInstanceOf(Stats); done(); } catch (err) { done(err); @@ -348,7 +369,7 @@ describe("Compiler", () => { }); it("should not emit on errors (watch)", done => { - const compiler = webpack({ + compiler = webpack({ context: __dirname, mode: "production", entry: "./missing", @@ -367,7 +388,7 @@ describe("Compiler", () => { }); }); it("should not be running twice at a time (run)", done => { - const compiler = webpack({ + compiler = webpack({ context: __dirname, mode: "production", entry: "./c", @@ -385,7 +406,7 @@ describe("Compiler", () => { }); }); it("should not be running twice at a time (watch)", done => { - const compiler = webpack({ + compiler = webpack({ context: __dirname, mode: "production", entry: "./c", @@ -403,7 +424,7 @@ describe("Compiler", () => { }); }); it("should not be running twice at a time (run - watch)", done => { - const compiler = webpack({ + compiler = webpack({ context: __dirname, mode: "production", entry: "./c", @@ -421,7 +442,7 @@ describe("Compiler", () => { }); }); it("should not be running twice at a time (watch - run)", done => { - const compiler = webpack({ + compiler = webpack({ context: __dirname, mode: "production", entry: "./c", @@ -439,7 +460,7 @@ describe("Compiler", () => { }); }); it("should not be running twice at a time (instance cb)", done => { - const compiler = webpack( + compiler = webpack( { context: __dirname, mode: "production", @@ -457,7 +478,7 @@ describe("Compiler", () => { }); }); it("should run again correctly after first compilation", done => { - const compiler = webpack({ + compiler = webpack({ context: __dirname, mode: "production", entry: "./c", @@ -478,7 +499,7 @@ describe("Compiler", () => { }); }); it("should watch again correctly after first compilation", done => { - const compiler = webpack({ + compiler = webpack({ context: __dirname, mode: "production", entry: "./c", @@ -491,14 +512,14 @@ describe("Compiler", () => { compiler.run((err, stats) => { if (err) return done(err); - compiler.watch({}, (err, stats) => { + const watching = compiler.watch({}, (err, stats) => { if (err) return done(err); - done(); + watching.close(done); }); }); }); it("should run again correctly after first closed watch", done => { - const compiler = webpack({ + compiler = webpack({ context: __dirname, mode: "production", entry: "./c", @@ -519,7 +540,7 @@ describe("Compiler", () => { }); }); it("should set compiler.watching correctly", function (done) { - const compiler = webpack({ + compiler = webpack({ context: __dirname, mode: "production", entry: "./c", @@ -531,12 +552,12 @@ describe("Compiler", () => { compiler.outputFileSystem = createFsFromVolume(new Volume()); const watching = compiler.watch({}, (err, stats) => { if (err) return done(err); - done(); + watching.close(done); }); expect(compiler.watching).toBe(watching); }); it("should watch again correctly after first closed watch", done => { - const compiler = webpack({ + compiler = webpack({ context: __dirname, mode: "production", entry: "./c", @@ -557,7 +578,7 @@ describe("Compiler", () => { }); }); it("should run again correctly inside afterDone hook", done => { - const compiler = webpack({ + compiler = webpack({ context: __dirname, mode: "production", entry: "./c", @@ -581,7 +602,7 @@ describe("Compiler", () => { }); }); it("should call afterDone hook after other callbacks (run)", done => { - const compiler = webpack({ + compiler = webpack({ context: __dirname, mode: "production", entry: "./c", @@ -606,7 +627,7 @@ describe("Compiler", () => { }); it("should call afterDone hook after other callbacks (instance cb)", done => { const instanceCb = jest.fn(); - const compiler = webpack( + compiler = webpack( { context: __dirname, mode: "production", @@ -631,7 +652,7 @@ describe("Compiler", () => { }); }); it("should call afterDone hook after other callbacks (watch)", done => { - const compiler = webpack({ + compiler = webpack({ context: __dirname, mode: "production", entry: "./c", @@ -652,18 +673,18 @@ describe("Compiler", () => { expect(doneHookCb).toHaveBeenCalled(); expect(watchCb).toHaveBeenCalled(); expect(invalidateCb).toHaveBeenCalled(); - done(); + watching.close(done); }); - const watch = compiler.watch({}, (err, stats) => { + const watching = compiler.watch({}, (err, stats) => { if (err) return done(err); watchCb(); }); process.nextTick(() => { - watch.invalidate(invalidateCb); + watching.invalidate(invalidateCb); }); }); it("should call afterDone hook after other callbacks (watch close)", done => { - const compiler = webpack({ + compiler = webpack({ context: __dirname, mode: "production", entry: "./c", @@ -695,7 +716,7 @@ describe("Compiler", () => { }); }); it("should flag watchMode as true in watch", done => { - const compiler = webpack({ + compiler = webpack({ context: __dirname, mode: "production", entry: "./c", @@ -717,7 +738,7 @@ describe("Compiler", () => { }); }); it("should use cache on second run call", done => { - const compiler = webpack({ + compiler = webpack({ context: __dirname, mode: "development", devtool: false, @@ -740,7 +761,7 @@ describe("Compiler", () => { }); it("should call the failed-hook on error", done => { const failedSpy = jest.fn(); - const compiler = webpack({ + compiler = webpack({ bail: true, context: __dirname, mode: "production", @@ -803,7 +824,7 @@ describe("Compiler", () => { } } it("should log to the console (verbose)", done => { - const compiler = webpack({ + compiler = webpack({ context: path.join(__dirname, "fixtures"), entry: "./a", output: { @@ -833,7 +854,7 @@ describe("Compiler", () => { }); }); it("should log to the console (debug mode)", done => { - const compiler = webpack({ + compiler = webpack({ context: path.join(__dirname, "fixtures"), entry: "./a", output: { @@ -865,7 +886,7 @@ describe("Compiler", () => { }); }); it("should log to the console (none)", done => { - const compiler = webpack({ + compiler = webpack({ context: path.join(__dirname, "fixtures"), entry: "./a", output: { @@ -884,7 +905,7 @@ describe("Compiler", () => { }); }); it("should log to the console with colors (verbose)", done => { - const compiler = webpack({ + compiler = webpack({ context: path.join(__dirname, "fixtures"), entry: "./a", output: { @@ -915,7 +936,7 @@ describe("Compiler", () => { }); }); it("should log to the console with colors (debug mode)", done => { - const compiler = webpack({ + compiler = webpack({ context: path.join(__dirname, "fixtures"), entry: "./a", output: { From 92ffd07d06b10d77a500c0cbe9b398de4b0bb902 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Wed, 7 Jul 2021 09:07:08 +0200 Subject: [PATCH 3/8] remove memory leak from test suite --- test/cases/context/issue-10969/index.js | 29 +++++++++---------------- 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/test/cases/context/issue-10969/index.js b/test/cases/context/issue-10969/index.js index b0403cb8c9f..3c136e6e1f8 100644 --- a/test/cases/context/issue-10969/index.js +++ b/test/cases/context/issue-10969/index.js @@ -1,21 +1,12 @@ -expect.extend({ - toBeValidModuleId(received, moduleIdString) { - const pass = typeof received === "number" || received === moduleIdString; - if (pass) { - return { - message: () => `expected ${received} not to be a valid module id`, - pass: true - }; - } else { - return { - message: () => `expected ${received} to be a valid module id`, - pass: false - }; - } - } -}); - it("should replace ! with %21 in the module id string of the context module", function () { - const moduleId = require.context("./folder", true, /^(?!file1\.js$).*$/i, "lazy").id; - expect(moduleId).toBeValidModuleId("./context/issue-10969/folder lazy recursive ^(?%21file1\\.js$).*$/"); + const moduleId = require.context( + "./folder", + true, + /^(?!file1\.js$).*$/i, + "lazy" + ).id; + if (typeof moduleId !== "number") + expect(moduleId).toBe( + "./context/issue-10969/folder lazy recursive ^(?%21file1\\.js$).*$/" + ); }); From 7e6cb9d35aa278e4e1735192225f8dc6846a6f56 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Wed, 7 Jul 2021 10:00:07 +0200 Subject: [PATCH 4/8] cleanup globals in config test cases --- test/ConfigTestCases.template.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/ConfigTestCases.template.js b/test/ConfigTestCases.template.js index 67a2dff23e1..b15b961d195 100644 --- a/test/ConfigTestCases.template.js +++ b/test/ConfigTestCases.template.js @@ -532,6 +532,9 @@ const describeCases = config => { Promise.all(results) .then(() => { if (testConfig.afterExecute) testConfig.afterExecute(); + for (const key of Object.keys(global)) { + if (key.includes("webpack")) delete global[key]; + } if (getNumberOfTests() < filesCount) { return done(new Error("No tests exported by test case")); } From ec72e9369a5f08d2a1ad9fe18419ea6dc7d82b42 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Wed, 7 Jul 2021 10:00:20 +0200 Subject: [PATCH 5/8] cleanup assigned globals --- .../library/type-assign-properties/test.config.js | 5 +++++ test/configCases/library/type-assign/test.config.js | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 test/configCases/library/type-assign-properties/test.config.js create mode 100644 test/configCases/library/type-assign/test.config.js diff --git a/test/configCases/library/type-assign-properties/test.config.js b/test/configCases/library/type-assign-properties/test.config.js new file mode 100644 index 00000000000..0c592459f39 --- /dev/null +++ b/test/configCases/library/type-assign-properties/test.config.js @@ -0,0 +1,5 @@ +module.exports = { + afterExecute() { + delete global.MyLibraryProperties; + } +}; diff --git a/test/configCases/library/type-assign/test.config.js b/test/configCases/library/type-assign/test.config.js new file mode 100644 index 00000000000..79a079487a5 --- /dev/null +++ b/test/configCases/library/type-assign/test.config.js @@ -0,0 +1,5 @@ +module.exports = { + afterExecute() { + delete global.MyLibrary; + } +}; From cdf73dacf525bffd9e6396f86266026564ec1a02 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Wed, 7 Jul 2021 10:02:07 +0200 Subject: [PATCH 6/8] add workaround for node.js memory leak --- lib/hmr/lazyCompilationBackend.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/hmr/lazyCompilationBackend.js b/lib/hmr/lazyCompilationBackend.js index 4a170d2281a..63b87cd5697 100644 --- a/lib/hmr/lazyCompilationBackend.js +++ b/lib/hmr/lazyCompilationBackend.js @@ -20,7 +20,7 @@ module.exports = (compiler, client, callback) => { const activeModules = new Map(); const prefix = "/lazy-compilation-using-"; - const server = http.createServer((req, res) => { + const requestListener = (req, res) => { const keys = req.url.slice(prefix.length).split("@"); req.socket.on("close", () => { setTimeout(() => { @@ -51,7 +51,8 @@ module.exports = (compiler, client, callback) => { } } if (moduleActivated && compiler.watching) compiler.watching.invalidate(); - }); + }; + const server = http.createServer(requestListener); let isClosing = false; /** @type {Set} */ const sockets = new Set(); @@ -78,6 +79,8 @@ module.exports = (compiler, client, callback) => { callback(null, { dispose(callback) { isClosing = true; + // Removing the listener is a workaround for a memory leak in node.js + server.off("request", requestListener); server.close(err => { callback(err); }); From e14197ddd9816b681d349807f75b3653a7c59bc9 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Wed, 7 Jul 2021 18:46:29 +0200 Subject: [PATCH 7/8] avoid importing large package on top-level in test suite --- test/ConfigTestCases.template.js | 10 +++--- test/TestCases.template.js | 54 +++++++++++++++----------------- 2 files changed, 30 insertions(+), 34 deletions(-) diff --git a/test/ConfigTestCases.template.js b/test/ConfigTestCases.template.js index b15b961d195..c93656ac83e 100644 --- a/test/ConfigTestCases.template.js +++ b/test/ConfigTestCases.template.js @@ -5,8 +5,6 @@ const fs = require("graceful-fs"); const vm = require("vm"); const { URL, pathToFileURL, fileURLToPath } = require("url"); const rimraf = require("rimraf"); -const webpack = require(".."); -const TerserPlugin = require("terser-webpack-plugin"); const checkArrayExpectation = require("./checkArrayExpectation"); const createLazyTestEnv = require("./helpers/createLazyTestEnv"); const deprecationTracking = require("./helpers/deprecationTracking"); @@ -73,7 +71,7 @@ const describeCases = config => { options.optimization.minimize = false; if (options.optimization.minimizer === undefined) { options.optimization.minimizer = [ - new TerserPlugin({ + new (require("terser-webpack-plugin"))({ parallel: false }) ]; @@ -162,7 +160,7 @@ const describeCases = config => { rimraf.sync(outputDirectory); fs.mkdirSync(outputDirectory, { recursive: true }); const deprecationTracker = deprecationTracking.start(); - webpack(options, err => { + require("..")(options, err => { deprecationTracker(); if (err) return handleFatalError(err, done); done(); @@ -172,7 +170,7 @@ const describeCases = config => { rimraf.sync(outputDirectory); fs.mkdirSync(outputDirectory, { recursive: true }); const deprecationTracker = deprecationTracking.start(); - webpack(options, (err, stats) => { + require("..")(options, (err, stats) => { deprecationTracker(); if (err) return handleFatalError(err, done); const { modules, children, errorsCount } = stats.toJson({ @@ -211,7 +209,7 @@ const describeCases = config => { rimraf.sync(outputDirectory); fs.mkdirSync(outputDirectory, { recursive: true }); const deprecationTracker = deprecationTracking.start(); - webpack(options, (err, stats) => { + require("..")(options, (err, stats) => { const deprecations = deprecationTracker(); if (err) return handleFatalError(err, done); const statOptions = { diff --git a/test/TestCases.template.js b/test/TestCases.template.js index 8501be8955a..03d0d5718a3 100644 --- a/test/TestCases.template.js +++ b/test/TestCases.template.js @@ -5,38 +5,13 @@ const fs = require("graceful-fs"); const vm = require("vm"); const { pathToFileURL, URL } = require("url"); const rimraf = require("rimraf"); -const webpack = require(".."); -const TerserPlugin = require("terser-webpack-plugin"); const checkArrayExpectation = require("./checkArrayExpectation"); const createLazyTestEnv = require("./helpers/createLazyTestEnv"); const deprecationTracking = require("./helpers/deprecationTracking"); const captureStdio = require("./helpers/captureStdio"); const asModule = require("./helpers/asModule"); -const terserForTesting = new TerserPlugin({ - parallel: false -}); - -const DEFAULT_OPTIMIZATIONS = { - removeAvailableModules: true, - removeEmptyChunks: true, - mergeDuplicateChunks: true, - flagIncludedChunks: true, - sideEffects: true, - providedExports: true, - usedExports: true, - mangleExports: true, - emitOnErrors: true, - concatenateModules: false, - moduleIds: "size", - chunkIds: "size", - minimizer: [terserForTesting] -}; - -const NO_EMIT_ON_ERRORS_OPTIMIZATIONS = { - emitOnErrors: true, - minimizer: [terserForTesting] -}; +const webpack = require(".."); const casesPath = path.join(__dirname, "cases"); let categories = fs.readdirSync(casesPath); @@ -100,6 +75,10 @@ const describeCases = config => { if (fs.existsSync(testConfigPath)) { testConfig = require(testConfigPath); } + const TerserPlugin = require("terser-webpack-plugin"); + const terserForTesting = new TerserPlugin({ + parallel: false + }); const options = { context: casesPath, entry: "./" + category.name + "/" + testName + "/", @@ -108,11 +87,24 @@ const describeCases = config => { mode: config.mode || "none", optimization: config.mode ? { - ...NO_EMIT_ON_ERRORS_OPTIMIZATIONS, + emitOnErrors: true, + minimizer: [terserForTesting], ...config.optimization } : { - ...DEFAULT_OPTIMIZATIONS, + removeAvailableModules: true, + removeEmptyChunks: true, + mergeDuplicateChunks: true, + flagIncludedChunks: true, + sideEffects: true, + providedExports: true, + usedExports: true, + mangleExports: true, + emitOnErrors: true, + concatenateModules: false, + moduleIds: "size", + chunkIds: "size", + minimizer: [terserForTesting], ...config.optimization }, performance: { @@ -197,6 +189,10 @@ const describeCases = config => { ...(config.module ? { outputModule: true } : {}) } }; + const cleanups = []; + afterAll(() => { + for (const fn of cleanups) fn(); + }); beforeAll(done => { rimraf(cacheDirectory, done); }); @@ -340,6 +336,7 @@ const describeCases = config => { return m; } }); + cleanups.push(() => (esmContext.it = undefined)); function _require(module, esmMode) { if (module.substr(0, 2) === "./") { const p = path.join(outputDirectory, module); @@ -364,6 +361,7 @@ const describeCases = config => { return await asModule(result, module.context); } }); + cleanups.push(() => (esmContext.it = undefined)); } catch (e) { console.log(e); e.message += `\nwhile parsing ${p}`; From dadddb104283fa5f35818b3945b7fc692f5ba556 Mon Sep 17 00:00:00 2001 From: Tobias Koppers Date: Thu, 8 Jul 2021 07:25:53 +0200 Subject: [PATCH 8/8] more memory again --- package.json | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 6b3de495118..b2d21607064 100644 --- a/package.json +++ b/package.json @@ -131,11 +131,11 @@ ], "scripts": { "setup": "node ./setup/setup.js", - "test": "node --max-old-space-size=2048 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest", + "test": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest", "test:update-snapshots": "yarn jest -u", - "test:integration": "node --max-old-space-size=2048 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/test/*.test.js\"", - "test:basic": "node --max-old-space-size=2048 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/te{st/TestCasesNormal,st/StatsTestCases,st/ConfigTestCases}.test.js\"", - "test:unit": "node --max-old-space-size=2048 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/test/*.unittest.js\"", + "test:integration": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/test/*.test.js\"", + "test:basic": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/te{st/TestCasesNormal,st/StatsTestCases,st/ConfigTestCases}.test.js\"", + "test:unit": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/test/*.unittest.js\"", "travis:integration": "yarn cover:integration --ci $JEST", "travis:basic": "yarn cover:basic --ci $JEST", "travis:lintunit": "yarn lint && yarn cover:unit --ci $JEST", @@ -162,13 +162,13 @@ "pretty-lint": "yarn pretty-lint-base --check", "yarn-lint": "yarn-deduplicate --fail --list -s highest yarn.lock", "yarn-lint-fix": "yarn-deduplicate -s highest yarn.lock", - "benchmark": "node --max-old-space-size=2048 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/test/*.benchmark.js\" --runInBand", + "benchmark": "node --max-old-space-size=4096 --experimental-vm-modules --trace-deprecation node_modules/jest-cli/bin/jest --testMatch \"/test/*.benchmark.js\" --runInBand", "cover": "yarn cover:all && yarn cover:report", "cover:clean": "rimraf .nyc_output coverage", - "cover:all": "node --max-old-space-size=2048 --experimental-vm-modules node_modules/jest-cli/bin/jest --coverage", - "cover:basic": "node --max-old-space-size=2048 --experimental-vm-modules node_modules/jest-cli/bin/jest --testMatch \"/te{st/TestCasesNormal,st/StatsTestCases,st/ConfigTestCases}.test.js\" --coverage", - "cover:integration": "node --max-old-space-size=2048 --experimental-vm-modules node_modules/jest-cli/bin/jest --testMatch \"/test/*.test.js\" --coverage", - "cover:unit": "node --max-old-space-size=2048 --experimental-vm-modules node_modules/jest-cli/bin/jest --testMatch \"/test/*.unittest.js\" --coverage", + "cover:all": "node --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --coverage", + "cover:basic": "node --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --testMatch \"/te{st/TestCasesNormal,st/StatsTestCases,st/ConfigTestCases}.test.js\" --coverage", + "cover:integration": "node --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --testMatch \"/test/*.test.js\" --coverage", + "cover:unit": "node --max-old-space-size=4096 --experimental-vm-modules node_modules/jest-cli/bin/jest --testMatch \"/test/*.unittest.js\" --coverage", "cover:types": "node node_modules/tooling/type-coverage", "cover:merge": "nyc merge .nyc_output coverage/coverage-nyc.json && rimraf .nyc_output", "cover:report": "nyc report -t coverage"