rustwasm / wasm-pack

📦✨ your favorite rust -> wasm workflow tool!
https://rustwasm.github.io/wasm-pack/
Apache License 2.0
6.32k stars 409 forks source link

wasm-pack --test does not accept the --tests cargo test option #1427

Open stephanemagnenat opened 2 months ago

stephanemagnenat commented 2 months ago

🐛 Bug description

wasm-pack --test documentation says that it takes a PATH_AND_EXTRA_OPTIONS. So if I want my cargo test to run only the tests, I naturally would write (following cargo test documentation):

wasm-pack test --node --tests

But this generates the error:

error: the argument '--tests' cannot be used multiple times

However, if I run either of these:

wasm-pack test --node --lib
wasm-pack test --node --test MY_TEST_FILE

It behaves as advertised.

I understand that the underlying problem is how cargo is called, but yet ideally it would still work, or at least the limitations would be documented.

🤔 Expected Behavior

Only the tests of my project are run.

Note that I need to to this, because I do not want to run my examples that have dependencies that are not available under wasm32.

👟 Steps to reproduce

Just try to run wasm-pack test --node --tests in any wasm project

🌍 Your environment

Include the relevant details of your environment. wasm-pack version: 0.13.0 rustc version: 1.80.1 (3f5fd8dd4 2024-08-06)