Skip to content

Commit

Permalink
chore(webpack-test): make tests more future proof
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed Nov 23, 2023
1 parent cfcabf1 commit 28e877e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"license": "MIT",
"description": "A Fast Rust-based web bundler",
"private": true,
"main": "./packages/rspack/dist/index.js",
"scripts": {
"x": "zx x.mjs",
"dev": "pnpm --filter @rspack/cli run dev",
Expand Down
19 changes: 14 additions & 5 deletions webpack-test/ConfigTestCases.template.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ const describeCases = config => {
stderr = captureStdio(process.stderr, true);
});
afterEach(() => {
stderr.restore();
if (stderr) {
stderr.restore();
}
});
jest.setTimeout(TIMEOUT);

Expand Down Expand Up @@ -88,10 +90,17 @@ const describeCases = config => {
const cacheDirectory = path.join(outBaseDir, ".cache", testSubPath);
let options, optionsArr, testConfig;
beforeAll(() => {
options = prepareOptions(
require(path.join(testDirectory, "webpack.config.js")),
{ testPath: outputDirectory }
);
expect(() => {
try {
options = prepareOptions(
require(path.join(testDirectory, "webpack.config.js")),
{ testPath: outputDirectory }
);
} catch (error) {
failed = true;
throw error
}
}).not.toThrow();
optionsArr = [].concat(options);
optionsArr.forEach((options, idx) => {
if (!options.context) options.context = testDirectory;
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion webpack-test/configCases/issues/issue-7563/test.filter.js

This file was deleted.

0 comments on commit 28e877e

Please sign in to comment.