| 1 |
# Running `wasm-bindgen`'s Tests |
| 2 |
|
| 3 |
## Wasm Tests on Node and Headless Browsers |
| 4 |
|
| 5 |
These are the largest test suites, and most common to run in day to day |
| 6 |
`wasm-bindgen` development. These tests are compiled to Wasm and then run in |
| 7 |
Node.js or a headless browser via the WebDriver protocol. |
| 8 |
|
| 9 |
```bash |
| 10 |
WASM_BINDGEN_SPLIT_LINKED_MODULES=1 cargo test --target wasm32-unknown-unknown |
| 11 |
``` |
| 12 |
|
| 13 |
See [the `wasm-bindgen-test` crate's |
| 14 |
`README.md`](https://github.com/rustwasm/wasm-bindgen/blob/master/crates/test/README.md) |
| 15 |
for details and configuring which headless browser is used. |
| 16 |
|
| 17 |
## Sanity Tests for `wasm-bindgen` on the Native Host Target |
| 18 |
|
| 19 |
This small test suite just verifies that exported `wasm-bindgen` methods can |
| 20 |
still be used on the native host's target. |
| 21 |
|
| 22 |
``` |
| 23 |
cargo test |
| 24 |
``` |
| 25 |
|
| 26 |
## The Web IDL Frontend's Tests |
| 27 |
|
| 28 |
``` |
| 29 |
cargo test -p webidl-tests --target wasm32-unknown-unknown |
| 30 |
``` |
| 31 |
|
| 32 |
## The Macro UI Tests |
| 33 |
|
| 34 |
These tests assert that we have reasonable error messages that point to the |
| 35 |
right source spans when the `#[wasm_bindgen]` proc-macro is misused. |
| 36 |
|
| 37 |
You can run these tests by running `cargo test` for the `wasm-bindgen-macro` |
| 38 |
crate: |
| 39 |
|
| 40 |
``` |
| 41 |
cargo test -p wasm-bindgen-macro |
| 42 |
``` |
| 43 |
|
| 44 |
## The `js-sys` Tests |
| 45 |
|
| 46 |
See [the `js-sys` testing page](js-sys/testing.html). |
| 47 |
|
| 48 |
## The `web-sys` Tests |
| 49 |
|
| 50 |
See [the `web-sys` testing page](web-sys/testing.html). |