-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e8f74a2
commit f5a7516
Showing
2 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Generating Coverage Data | ||
|
||
You can ask the runner to generate coverage data from functions marked as `#[wasm_bindgen_test]` in the `.profraw` format. | ||
|
||
<div class="warning"> | ||
Coverage is still in an experimental state and may be unreliable and could experience | ||
breaking changes at any time. | ||
</div> | ||
|
||
## Enabling the feature | ||
|
||
To enable this feature, you need to enable the `"unstable-coverage"` feature in your `wasm-bindgen-test` dependency. | ||
|
||
## Generating the data | ||
|
||
### `RUSTFLAGS` that need to be present | ||
|
||
Make sure you are using `RUSTFLAGS=-Cinstrument-coverage -Zno-profiler-runtime`. | ||
|
||
### Arguments to the test runner | ||
|
||
If you are using `wasm-pack` to run the tests, refer to the `wasm-pack` documentation. | ||
|
||
Otherwise, you can use the following environment variables when [executing the test runner][1] to control the coverage output: | ||
|
||
[1]: usage.html#appendix-using-wasm-bindgen-test-without-wasm-pack | ||
|
||
- `WASM_BINDGEN_UNSTABLE_TEST_COVERAGE` to generate a single `.profraw` in your current working directory. | ||
- `WASM_BINDGEN_UNSTABLE_TEST_PROFRAW_OUT` to control the file name of the profraw or the directory in which it is placed | ||
- `WASM_BINDGEN_UNSTABLE_TEST_PROFRAW_PREFIX` to add a custom prefix to the profraw files. This can be useful if you're running the tests automatically in succession. |