Note: The
tests/webpack-test
is heavily based on webpack/test
Originally, we use this formula to calculate the compatibility passedTestCaseCount / totalTestCount
, totalTestCount = passedTestCaseCount + failedTestCount + skippedTestCount , but sometimes it maybe hard to compatible with all webpack test cases for some reasons (e.g. performance, legacy feature that we don't want to support), we need a method to skip these tests that we will not support. Thus, we adjust the original formula to (passedTestCaseCount + willNotSupportTestCount) / totalTestCount
.
Currently, we use a test.filter.js
under each failed test case directory to skip failed test case, using this method could let us migrate webpack test case progressively without affect the real compatibility (Because this method will not influence the real passedTestCaseCount
).
e.g.
When you find that we have passed some failed testcases which is skipped for now, you could change the test.filter.js
to
or delete the test.filter.js
Based on implementation differences and performance considerations, Rspack will integrate some Webpack plugins internally. The test suite for the plugins will also be copied to the tests/plugin-test
folder for testing plugin compatibility.
Therefore, in order to maintain consistency with the original repository, it is not recommended to modify these test cases, except in the following scenarios:
In scenarios other than those mentioned above, please follow the Rspack Testing guidelines for adding test cases.
You can run these test cases in the following ways:
./x test plugin
or pnpm run test:plugin
in the root directory.npm run test
in the rspack/tests/plugin-test
directory.npm run test -- -u
in the tests/plugin-test
directory.npm run test -- {args}
in the tests/plugin-test
directory.tests/plugin-test/{plugin-name}
folder and copy the test cases for that plugin into the folder.tests/plugin-test/jest.config.js
. If there are special configurations, follow the process below:
tests/plugin-test/jest.{plugin-name}.config.js
, import jest.config.js
, and modify it based on that.test:{plugin-name}
command to the scripts
property of tests/plugin-test/package.json
.global.updateSnapshot
to determine whether to update the snapshot.tests/plugin-test/{plugin-name}/README.md
file and include the License information from the source repository of the test cases.tests/plugin-test/README.md
file to include the link and credits information from the source repository of the test cases.