Skip to content

Commit

Permalink
chore(webpack-test): make tests more future proof (#4758)
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen authored and JSerFeng committed Nov 30, 2023
1 parent fa70f90 commit cea76c8
Show file tree
Hide file tree
Showing 4 changed files with 10 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
14 changes: 9 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,12 @@ 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(() => {
options = prepareOptions(
require(path.join(testDirectory, "webpack.config.js")),
{ testPath: outputDirectory }
);
}).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 cea76c8

Please sign in to comment.