You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/en/contribute/development/testing.mdx
+6-3Lines changed: 6 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ You can run Rspack tests by running `./x test unit` or `pnpm run test:unit` at t
41
41
You can also go to the `tests/rspack-test` folder and run `npm run test` to run test cases and add some arguments:
42
42
43
43
-**When refreshing test snapshots is needed**: Add `-u`, like `npm run test -- -u`
44
-
-**When filtering test cases is needed**: Add `-t`, like `npm run test -- -t configCases/asset` to only run test cases from the `tests/rspack-test/configCases/asset` folder. Pattern matching supports regex, see [rstest](https://rstest.rs/config/test/testNamePattern) for details.
44
+
-**When filtering test cases is needed**: Add `-t`. Pattern matching supports regex, see [rstest](https://rstest.rs/config/test/testNamePattern) for details.
45
45
46
46
### Running tests
47
47
@@ -51,8 +51,11 @@ You can run these test cases in the following ways:
51
51
- Or run `npm run test` from the `tests/rspack-test` directory.
52
52
- To update snapshots, run `npm run test -- -u` from the `tests/rspack-test` directory.
53
53
- To pass specific rstest cli arguments, run `npm run test -- {args}` from the `tests/rspack-test` directory.
54
-
- To filter specific test cases, run `npm run test -- -t path-of-spec` from the `tests/rspack-test` directory.
55
-
- Like `npm run test -- -t configCases/asset` to only run test cases from the `tests/rspack-test/configCases/asset` folder (config will be automatically mapped to configCases, and other folders will work in a similar way).
54
+
- To filter specific test cases, run `npm run test -- -t ${testPath}` where `testPath` can be either an absolute or relative path.
55
+
- For example:
56
+
-`npm run test -- -t hotCases/json/error-in-json` (or `npm run test -- -t /Users/rspack/tests/rspack-test/hotCases/json/error-in-json`) will run all tests in the `error-in-json` test case.
57
+
-`npm run test -- -t hotCases/json` (or `npm run test -- -t /Users/rspack/tests/rspack-test/hotCases/json`) will run all test cases in the `json` directory.
58
+
-`npm run test -- -t hotCases` (or `npm run test -- -t /Users/rspack/tests/rspack-test/hotCases`) will run all test cases in the `hotCases` directory.
56
59
- To use Rspack Wasm for running test cases, you need to additionally configure the following environment variables:
57
60
1.`NAPI_RS_FORCE_WASI=1`: Forces the use of Rspack Wasm instead of native binding
58
61
2.`WASM=1`: Enables Wasm-specific test configurations
- 如需更新 snapshot,在 `tests/rspack-test` 目录下运行 `npm run test -- -u`。
53
53
- 如需传入特定 rstest cli 参数,在 `tests/rspack-test` 目录下运行 `npm run test -- {args}`。
54
-
- 如需过滤特定测试用例,在 `tests/rspack-test` 目录下运行 `npm run test -- -t path-of-spec`。
55
-
- 如 `npm run test -- -t configCases/asset` 即可仅运行 `tests/rspack-test/configCases/asset` 文件夹下的用例(config 会自动映射到 configCases,其他文件夹类似)。
54
+
- 如需过滤特定测试用例,运行 `npm run test -- -t ${testPath}`,其中 `${testPath}` 可以是绝对路径或相对路径。
55
+
- 例如:
56
+
-`npm run test -- -t hotCases/json/error-in-json` (或 `npm run test -- -t /Users/rspack/tests/rspack-test/hotCases/json/error-in-json`) 将运行 `error-in-json` 测试用例中的所有测试。
57
+
-`npm run test -- -t hotCases/json` (或 `npm run test -- -t /Users/rspack/tests/rspack-test/hotCases/json`) 将运行 `json` 目录下的所有测试用例。
58
+
-`npm run test -- -t hotCases` (或 `npm run test -- -t /Users/rspack/tests/rspack-test/hotCases`) 将运行 `hotCases` 目录下的所有测试用例。
0 commit comments