You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When supporting both wasm and other targets in a crate, I found it not obvious how to deal with tests and examples. It turned out that adding #![ cfg(not( target_arch = "wasm32" )) ] to files for integration tests that aren't wasm keeps wasm-pack test from trying to run them.
However, when you have an example in the examples folder that isn't wasm, wasm-pack test will still try to compile it, and even when putting a target based gate at the top. The result is that #![ cfg(not( target_arch = "wasm32" )) ] on top of the file will break tests because:
error[E0601]: `main` function not found in crate `localpool`
I haven't found a reasonable workaround...
🤔 Expected Behavior
Have a convenient way of supporting both wasm and non wasm targets in the same crate.
Document how to deal with tests and examples in this regard (in the book)
👟 Steps to reproduce
Create an example in examples folder that isn't meant for wasm target. Run unit tests with wasm-pack test
🐛 Bug description
When supporting both wasm and other targets in a crate, I found it not obvious how to deal with tests and examples. It turned out that adding
#![ cfg(not( target_arch = "wasm32" )) ]
to files for integration tests that aren't wasm keepswasm-pack test
from trying to run them.However, when you have an example in the examples folder that isn't wasm,
wasm-pack test
will still try to compile it, and even when putting a target based gate at the top. The result is that#![ cfg(not( target_arch = "wasm32" )) ]
on top of the file will break tests because:I haven't found a reasonable workaround...
🤔 Expected Behavior
Have a convenient way of supporting both wasm and non wasm targets in the same crate.
Document how to deal with tests and examples in this regard (in the book)
👟 Steps to reproduce
Create an example in examples folder that isn't meant for wasm target. Run unit tests with
wasm-pack test
🌍 Your environment
linux
wasm-pack version: wasm-pack 0.7.0
rustc version: rustc 1.37.0-nightly (02564de47 2019-06-10)
The text was updated successfully, but these errors were encountered: