rust-webpack-template
rust-webpack-template copied to clipboard
Update to todays wasm-pack
I don't think this is quite correct.
A lot of apps are designed to be run in the browser, so running the tests in Node will fail.
Ideally this should be fixed in wasm-pack, so we can just run wasm-pack test and it will choose which runners to use at runtime, rather than needing to pass in flags.
Well that might be true, however they decided to change the flag from --headless to --node for some reason unknown to me.
@dns2utf8 Where did you hear that?
I got an error message when using the command:
$ wasm-pack test --headless
Error: Must specify at least one of `--node`, `--chrome`, `--firefox`, or `--safari`
@dns2utf8 Yes, that is correct, you must specify at least one of those options, like so:
wasm-pack test --headless --chrome
wasm-pack test --headless --firefox
wasm-pack test --headless --safari
Or you can combine multiple together:
wasm-pack test --headless --chrome --firefox --safari
Note that the --headless is in addition to the other options. Wasm-pack has always worked that way, nothing has changed recently.
As for this template specifically, you can use npm test -- --chrome (and similarly for the other browsers).
It was setup that way because different people will have different browsers, so that lets you choose which browsers to run the tests in.