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

Commit

Permalink
chore: adding test guideline (#25)
Browse files Browse the repository at this point in the history
* chore: adding test guideline

* chore: fix typo
  • Loading branch information
hardfist authored Oct 27, 2023
1 parent e22f52e commit cf993a8
Showing 1 changed file with 16 additions and 1 deletion.
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

0 comments on commit cf993a8

Please sign in to comment.