I'm compiling Rust to .wasm, and neither
cargo test (with integration tests) nor
cargo run --example work as expected. I think the problem is the same in both cases:
cargo is trying to execute the
.wasm file directly, but it's not an executable as far as my operating system is concerned.
- Is there a way to change how
cargoruns binaries? There are ways to change
rustdocthrough configuration and env vars, but I don't see anything similar for the test runner.
- I suppose I could build the tests and examples with the native target, and explicitly set the target for
.wasmwhen I want that -- or vice versa (which is sort of the case now, as I have set the default target in
- Assuming I can't change the test runner, and I don't want to have to remember to set the target appropriately at some point in the process, is there a way to change the target for compiling integration test and example source files? Some invocation of the
cfg_attrattributes, for instance?