Fix example commands in docs broken by PR #851

master
Frederic Kettelhoit 4 years ago
parent 260d79ac89
commit b242938066
  1. 10
      docs/src/commands/build.md
  2. 12
      docs/src/commands/test.md
  3. 2
      docs/src/tutorials/npm-browser-packages/template-deep-dive/wee_alloc.md

@ -127,13 +127,13 @@ wasm-pack build examples/js-hello-world --mode no-install
## Extra options ## Extra options
The `build` command can pass extra options straight to `cargo build` even if they are not The `build` command can pass extra options straight to `cargo build` even if
supported in wasm-pack. To use them you should add standalone `--` argument at the very they are not supported in wasm-pack. To use them simply add the extra arguments
end of your command, and all the arguments you want to pass to cargo should go after. at the very end of your command, just as you would for `cargo build`. For
For example, to build the previous example using cargo's offline feature: example, to build the previous example using cargo's offline feature:
``` ```
wasm-pack build examples/js-hello-world --mode no-install -- --offline wasm-pack build examples/js-hello-world --mode no-install --offline
``` ```
<hr style="font-size: 1.5em; margin-top: 2.5em"/> <hr style="font-size: 1.5em; margin-top: 2.5em"/>

@ -44,8 +44,8 @@ wasm-pack test --node --firefox --chrome --safari --headless
The `test` command can pass extra options straight to `cargo test` even if they are not The `test` command can pass extra options straight to `cargo test` even if they are not
supported in wasm-pack. supported in wasm-pack.
To use them you should add standalone `--` argument at the very To use them simply add the extra arguments at the very end of your command, just
end of your command, and all the arguments you want to pass to cargo should go after. as you would for `cargo test`.
`cargo test -h` for a list of all options that you can pass through. `cargo test -h` for a list of all options that you can pass through.
@ -72,16 +72,16 @@ $ tree crates/foo
``` ```
# Run all tests in tests/diff_patch.rs in Firefox # Run all tests in tests/diff_patch.rs in Firefox
wasm-pack test crates/foo --firefox --headless -- --test diff_patch wasm-pack test crates/foo --firefox --headless --test diff_patch
# Run all tests in tests/diff_patch.rs that contain the word "replace" # Run all tests in tests/diff_patch.rs that contain the word "replace"
wasm-pack test crates/foo --firefox --headless -- --test diff_patch replace wasm-pack test crates/foo --firefox --headless --test diff_patch replace
# Run all tests inside of a `tests` module inside of src/lib/diff.rs # Run all tests inside of a `tests` module inside of src/lib/diff.rs
wasm-pack test crates/foo --firefox --headless -- --lib diff::tests wasm-pack test crates/foo --firefox --headless --lib diff::tests
# Same as the above, but only if they contain the word replace # Same as the above, but only if they contain the word replace
wasm-pack test crates/foo --firefox --headless -- --lib diff::tests::replace wasm-pack test crates/foo --firefox --headless --lib diff::tests::replace
``` ```
Note that you can also filter tests by location in which they're supposed to Note that you can also filter tests by location in which they're supposed to

@ -40,7 +40,7 @@ allocator, but only if the `wee_alloc` feature is enabled at compile time. The
feature can be enabled by passing extra options while building: feature can be enabled by passing extra options while building:
``` ```
$ wasm-pack build -- --features wee_alloc $ wasm-pack build --features wee_alloc
``` ```
or alternatively you could turn it on by default in `Cargo.toml`: or alternatively you could turn it on by default in `Cargo.toml`:

Loading…
Cancel
Save