Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

chore: adding test guideline #25

Merged
merged 2 commits into from
Oct 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/testing/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,25 @@ We currently have two sets of test suites, one for Rust and one for Node.js.
- `UPDATE=1 cargo test` will automatically update the failed snapshot

## Node Testing
We are maintaining two test suites for Node Testing in Rspack, Rspack Testing and Webpack Testing
### Webpack Testing

We copy the whole webpack test suites into [webpack-test](https://github.com/web-infra-dev/rspack/tree/main/webpack-test#progressively-migrate-webpack-test) folder to check the compatibility with webpack. If you add features or fix bugs we recommend you check whether this feature or bug is covered in webpack test suites first. If it's covered and testable in Webpack Testing, you can enable specific test case by setting return value to true in [`test.filter.js`](https://github.com/web-infra-dev/rspack/blob/80e97477483fcb912473ae339c37d5a5e247f7b1/webpack-test/cases/compile/error-hide-stack/test.filter.js#L2C33-L2C84) in this case folder to enable this case. See more details in https://github.com/web-infra-dev/rspack/blob/main/webpack-test/README.md, Please note that don't modify original test code in Webpack Testing, if you find difficulties in running test suites without modifying original code, you can copy this test code in the following [Rspack Testing](#Rspack Testing).
#### Run Tests

```sh
# In root path
./x build -a # build binding and js part
./x test webpack # run webpack test suites
```

### Rspack Testing
We maintain test suites in Rspack Testing which is not coverable or need to be modified in Webpack Testing. The test suites lies in [rspack-test](https://github.com/web-infra-dev/rspack/tree/main/packages/rspack/tests). This folder structure is similar with Webpack Testing.
#### Run Tests
```sh
# In root path
pnpm --filter "./packages/**" run build && pnpm --filter "./packages/**" run test
./x build -a
./x test js
```

Or only test the package that you made the changes:
Expand Down