Replies: 1 comment
-
Okay this is my best approach so far:
This way the test is compiled when non-wasm, so the tooling (rust-analyzer, cargo check, etc) keep working, but it's ignored on non-wasm, so it won't run |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This might be a common problem but I can't for the life of me find a good solution:
Since I updated
wasm_bindgen_test
to the latest versions, I started getting dead code warnings on tests and functions that are used in wasm bindgen tests. This is reasonable since these only run on wasm, and I'm compiling on linux.So a first step is to gate these behind a
#[cfg(target_family = "wasm")]
, and this solves the warnings since these pieces are no longer compiled on linux. The main problem I got doing this is that rust-analyzer now shows these pieces of code as "configured-out", and I'd like to get LSP support for working on mywasm_bindgen_test
tests.What I've tried so far:
"rust-analyzer.cargo.allTargets": true
. This didn't seem to do anything at all"rust-analyzer.cargo.target": "wasm32-unknown-unknown"
. This actually seems to work, but it seems rather weird to set the whole compilation target just so I don't configure out these tests."rust-analyzer.check.targets": [ "wasm32-unknown-unknown", "x86_64-unknown-linux-gnu" ]
. This seems to makecargo check
to try to compile everything to WASM, so it gives a me a few thousands of errors.Anyone who fought this issue previously has any guidance to offer me?
Beta Was this translation helpful? Give feedback.
All reactions