[−][src]Crate cross_test
cross-test
Run Rust native and web tests with a single framework.
Platforms
- Web: web-sys
- Native: tokio
Requirements
To run the wasm-bindgen-test
s, you need to have the nightly toolchain installed (there is no need to make it default).
You will also need to manually include wasm-bindgen-test
as a dev dependency in your project because #[wasm_bindgen_test]
macro can't be re-exported to avoid this requirement because of how it was designed.
[target.'cfg(target_arch = "wasm32")'.dependencies] wasm-bindgen-test = "0.3.20"
Usage
use cross_test::prelude::*; cross_test_configure!(); #[cross_test] async fn it_works() { assert_eq!(2 + 2, 4); }
Important issue
Because #[cross_test]
gets translated to #[tokio::test]
all the tests must be async
.
A custom proc-macro will be provided to select the test executor if the async
work is present or not.
Modules
prelude | Module that re-exports all the required items to make use of |
Macros
configure |
Attribute Macros
test | Marks async function to be executed by runtime, suitable to test environment |