This is the unpublished documentation of wasm-pack, the published documentation is available on the main Rust and WebAssembly documentation site . Features documented here may not be available in released versions of wasm-pack.

Testing your project

Now after writing and building code, let's actually execute it! You can execute tests with:

$ wasm-pack test --firefox
[INFO]: Checking for the Wasm target...
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
     Running target/wasm32-unknown-unknown/debug/deps/web-9e7d380f8600b08e.wasm
Interactive browsers tests are now available at

Note that interactive mode is enabled because `NO_HEADLESS`
is specified in the environment of this process. Once you're
done with testing you'll need to kill this server with

The console won't finish just yet, but as indicated you can visit in your web browser to see the test output:

running 1 test

test web::pass ... ok

test result: ok. 1 passed; 0 failed; 0 ignored

and we've now executed our first tests in a web browser!

If you'd like to execute tests in a headless web browser (you don't need to manually visit a page) you can do:

$ wasm-pack test --headless --firefox

and similarly if you're developing a project for Node.js you can also execute wasm-pack test --nodejs to run tests in Node.

Be sure to see the testing reference documentation for other supported features as well!