Skip to content

wasm-pack test <extra_options> does not work as expected #698

@alexlapa

Description

@alexlapa

🐛 Bug description

wasm-pack test does not pass <extra_options> to cargo build --tests --target wasm32-unknown-unknown.

🤔 Expected Behavior

wasm-pack test --firefox -- --features some_feature

should invoke

cargo build --tests --target wasm32-unknown-unknown --features some_feature

👟 Steps to reproduce

Running

wasm-pack test --firefox -- --features some_feature

Causes error during tested crate compilation, since some_feature is not enabled.

Last log entry:

INFO 2019-08-08T19:58:57Z: wasm_pack::child: Running "cargo" "build" "--tests" "--target" "wasm32-unknown-unknown"

However, running:

cargo test --target wasm32-unknown-unknown --features some_feature

works.

Code example: https://github.com/alexlapa/wasm-pack-698-reproduction

Possible solution

It seems to me that there is no reason to run cargo build --tests --target wasm32-unknown-unknown when running wasm-pack test.

wasm-pack test will run wasm-bindgen-test, which will run cargo test, which will run cargo build --tests correctly propagating all extra options.

i.e. you can just remove step_build_tests

🌍 Your environment

wasm-pack version: 0.8.1
rustc version: 1.36.0 (a53f9df32 2019-07-03)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions