rust-webpack-template icon indicating copy to clipboard operation
rust-webpack-template copied to clipboard

Update to todays wasm-pack

Open dns2utf8 opened this issue 6 years ago • 6 comments

dns2utf8 avatar Aug 04 '19 18:08 dns2utf8

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.

Pauan avatar Aug 04 '19 21:08 Pauan

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.

Pauan avatar Aug 04 '19 21:08 Pauan

Well that might be true, however they decided to change the flag from --headless to --node for some reason unknown to me.

dns2utf8 avatar Aug 05 '19 13:08 dns2utf8

@dns2utf8 Where did you hear that?

Pauan avatar Aug 05 '19 15:08 Pauan

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 avatar Aug 07 '19 22:08 dns2utf8

@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.

Pauan avatar Aug 08 '19 04:08 Pauan