guide: refactor and update testing instructions for contributing

This commit is contained in:
Nick Fitzgerald
2018-08-08 15:33:56 -07:00
parent 5ab3059a45
commit 2fcc74e226
4 changed files with 53 additions and 32 deletions

View File

@ -5,17 +5,11 @@ You can test the `web-sys` crate by running `cargo test` within the
```sh
cd wasm-bindgen/crates/web-sys
cargo test
cargo test --target wasm32-unknown-unknown
```
These tests all use a headless browser. See the [*Headless Browser
Tests* section for details on setup and
configuration.](../contributing.html#headless-browser-tests)
## Grouping Tests
Because headless tests can have significant setup and tear down overheads, try
and group tests together. Instead of having a different `#[test]` for every
method on some interface, have a single `#[test]` for the interface and all of
its methods. This will keep the test suite running fast, resulting in better
developer ergonomics and CI turn around times. Thanks!
The Wasm tests all run within a headless browser. See [the `wasm-bindgen-test`
crate's
`README.md`](https://github.com/rustwasm/wasm-bindgen/blob/master/crates/test/README.md)
for details and configuring which headless browser is used.