I am working on a Rust crate and I would like to disable all tests for one specific target architecture (wasm32
). I know you can disable specific source items using a cfg
annotation:
#[cfg(not(target_arch="wasm32"))]
#[test]
fn only_compile_on_not_wasm32() {
...
}
But as I want to disable all tests, I would like a quicker way, preferably as a configuration in the Cargo.toml
file. The crate looks like this:
├── Cargo.toml
├── src
│ ├── ...
│ └── lib.rs
└── tests
├── ...
└── mod.rs
i.e. the tests I want to disable are stored in the tests
directory.
If you don't have many test files, then you may disable entire modules applying it to the containing element:
#![cfg(not(target_arch="wasm32"))]