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
Currently I've the following sample test that I would like to make it work using rstest and wasm_bindgen_test to be able to run in using wasm-pack test.
use wasm_bindgen_test::wasm_bindgen_test
use rstest::rstest;use gloo_timers::future::sleep;use std::time::Duration;#[rstest]#[case(200)]#[case(100)]#[wasm_bingen_test]asyncfntest_sleep(#[case]duration:u32){sleep(Duration::from_millis(duration).await}
The problem
The test could not compile because it try to use async_std in this context which would not work with wasm-pack.
error[E0433]: failed to resolve: use of undeclared crate or module `async_std`
--> [redacted]/tests/foo.rs:7:1
|
7 | #[rstest]
| ^^^^^^^^^ use of undeclared crate or module `async_std`
|
= note: this error originates in the attribute macro `rstest` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0433`.
Additional information
I've added the macro expansion using cargo-expand below (we can see the use of async_std):
Just the attributes that ends with test (last path segment) can be injected: in this case the #[actix_rt::test] attribute will replace the standard #[test] attribute.
Currently I've the following sample test that I would like to make it work using
rstest
andwasm_bindgen_test
to be able to run in usingwasm-pack test
.The problem
The test could not compile because it try to use
async_std
in this context which would not work withwasm-pack
.Additional information
I've added the macro expansion using
cargo-expand
below (we can see the use ofasync_std
):cargo expand --test foo --target wasm32-unknown-unknown
The text was updated successfully, but these errors were encountered: