From c3df8c55e32b6cf6f6f5faf449bde404348ab70d Mon Sep 17 00:00:00 2001 From: Jonathan Kelley Date: Wed, 6 Mar 2024 19:59:47 -0800 Subject: [PATCH] fix windows, enable tokio for examples on wasm --- Cargo.toml | 1 + packages/desktop/headless_tests/utils.rs | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index c07bd33d4..f770e0017 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -155,6 +155,7 @@ form_urlencoded = "1.2.0" [target.'cfg(target_arch = "wasm32")'.dev-dependencies] getrandom = { version = "0.2.12", features = ["js"] } +tokio = { version = "1.16.1", no-default-features = true, features = ["sync", "macros", "io-util", "rt", "time"] } [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] tokio = { version = "1.16.1", features = ["full"] } diff --git a/packages/desktop/headless_tests/utils.rs b/packages/desktop/headless_tests/utils.rs index 419f5c8cd..a497d3586 100644 --- a/packages/desktop/headless_tests/utils.rs +++ b/packages/desktop/headless_tests/utils.rs @@ -36,7 +36,10 @@ pub fn mock_event_with_extra(id: &'static str, value: &'static str, extra: &'sta EXPECTED_EVENTS.with_mut(|x| *x += 1); spawn(async move { - tokio::time::sleep(std::time::Duration::from_millis(500)).await; + // We need to wait for edits to be applied before we can send the event + // Sometimes (windows...) this takes a while + // we should really be running this check when mounted + tokio::time::sleep(std::time::Duration::from_millis(10000)).await; let js = format!( r#"