From 8e55bc2546b2496d582300f408ed283342acf1d7 Mon Sep 17 00:00:00 2001 From: Teoh Han Hui Date: Wed, 11 May 2022 16:19:38 +0800 Subject: [PATCH] [WIP] Enable timers in Node.js environment --- Cargo.toml | 3 +++ tests/interval.rs | 17 +++++------------ 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 7a32564..b29704a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -141,3 +141,6 @@ required-features = ["skip"] [[test]] name = "take" required-features = ["take"] + +[patch.crates-io] +gloo-timers = { version = "0.2.4", git = "https://github.com/ctm/gloo", branch = "js_sys-experiment" } diff --git a/tests/interval.rs b/tests/interval.rs index 1cdf484..e712954 100644 --- a/tests/interval.rs +++ b/tests/interval.rs @@ -15,10 +15,9 @@ use { tracing_futures::Instrument, }; -#[cfg(all( - all(target_arch = "wasm32", not(target_os = "wasi")), - feature = "browser", -))] +#[cfg( + all(target_arch = "wasm32", not(target_os = "wasi")) +)] use wasm_bindgen_test::wasm_bindgen_test; #[cfg(all( all(target_arch = "wasm32", not(target_os = "wasi")), @@ -42,10 +41,7 @@ wasm_bindgen_test_configure!(run_in_browser); #[tracing::instrument] #[test_log::test(async_std::test)] #[cfg_attr( - all( - all(target_arch = "wasm32", not(target_os = "wasi")), - feature = "browser", - ), + all(target_arch = "wasm32", not(target_os = "wasi")), wasm_bindgen_test )] async fn interval_50_sends_5_times_then_we_dispose_it() { @@ -90,10 +86,7 @@ async fn interval_50_sends_5_times_then_we_dispose_it() { #[tracing::instrument] #[test_log::test(async_std::test)] #[cfg_attr( - all( - all(target_arch = "wasm32", not(target_os = "wasi")), - feature = "browser", - ), + all(target_arch = "wasm32", not(target_os = "wasi")), wasm_bindgen_test )] async fn interval_1000_can_be_disposed_before_anything_is_sent() {