Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests which require timers in Node.js as well #9

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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" }
20 changes: 4 additions & 16 deletions tests/combine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,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 it_combines_1_async_finite_listenable_source() {
Expand Down Expand Up @@ -158,10 +155,7 @@ async fn it_combines_1_async_finite_listenable_source() {
#[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 it_combines_2_async_finite_listenable_sources() {
Expand Down Expand Up @@ -350,10 +344,7 @@ async fn it_combines_2_async_finite_listenable_sources() {
#[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 it_returns_a_source_that_disposes_upon_upwards_end() {
Expand Down Expand Up @@ -475,10 +466,7 @@ async fn it_returns_a_source_that_disposes_upon_upwards_end() {
#[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 it_combines_two_infinite_listenable_sources() {
Expand Down
20 changes: 4 additions & 16 deletions tests/concat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,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 it_concats_1_async_finite_listenable_source() {
Expand Down Expand Up @@ -152,10 +149,7 @@ async fn it_concats_1_async_finite_listenable_source() {
#[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 it_concats_2_async_finite_listenable_sources() {
Expand Down Expand Up @@ -530,10 +524,7 @@ fn it_concats_2_sync_finite_pullable_sources() {
#[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 it_returns_a_source_that_disposes_upon_upwards_end() {
Expand Down Expand Up @@ -655,10 +646,7 @@ async fn it_returns_a_source_that_disposes_upon_upwards_end() {
#[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 it_propagates_source_error_to_sink_and_doesnt_subscribe_to_next_source() {
Expand Down
10 changes: 2 additions & 8 deletions tests/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,7 @@ fn it_filters_a_pullable_source() {
#[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 it_filters_an_async_finite_listenable_source() {
Expand Down Expand Up @@ -300,10 +297,7 @@ async fn it_filters_an_async_finite_listenable_source() {
#[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 it_returns_a_source_that_disposes_upon_upwards_end() {
Expand Down
25 changes: 5 additions & 20 deletions tests/flatten.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,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 it_flattens_a_two_layer_async_infinite_listenable_sources() {
Expand Down Expand Up @@ -460,10 +457,7 @@ fn it_flattens_a_two_layer_finite_pullable_sources() {
#[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 it_errors_sink_and_unsubscribe_from_inner_when_outer_throws() {
Expand Down Expand Up @@ -671,10 +665,7 @@ async fn it_errors_sink_and_unsubscribe_from_inner_when_outer_throws() {
#[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 it_errors_sink_and_unsubscribe_from_outer_when_inner_throws() {
Expand Down Expand Up @@ -869,10 +860,7 @@ async fn it_errors_sink_and_unsubscribe_from_outer_when_inner_throws() {
#[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 it_should_not_try_to_unsubscribe_from_completed_source_when_waiting_for_inner_completion()
Expand Down Expand Up @@ -990,10 +978,7 @@ async fn it_should_not_try_to_unsubscribe_from_completed_source_when_waiting_for
#[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 it_should_not_try_to_unsubscribe_from_completed_source_when_for_inner_errors() {
Expand Down
5 changes: 1 addition & 4 deletions tests/for_each.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,7 @@ fn it_iterates_a_finite_pullable_source() {
#[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 it_observes_an_async_finite_listenable_source() {
Expand Down
15 changes: 3 additions & 12 deletions tests/interval.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,7 @@ 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")),
Expand All @@ -42,10 +39,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() {
Expand Down Expand Up @@ -90,10 +84,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() {
Expand Down
10 changes: 2 additions & 8 deletions tests/map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,7 @@ fn it_maps_a_pullable_source() {
#[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 it_maps_an_async_finite_source() {
Expand Down Expand Up @@ -312,10 +309,7 @@ async fn it_maps_an_async_finite_source() {
#[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 it_returns_a_source_that_disposes_upon_upwards_end() {
Expand Down
35 changes: 7 additions & 28 deletions tests/merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,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 it_merges_one_async_finite_listenable_source() {
Expand Down Expand Up @@ -156,10 +153,7 @@ async fn it_merges_one_async_finite_listenable_source() {
#[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 it_merges_two_async_finite_listenable_sources() {
Expand Down Expand Up @@ -333,10 +327,7 @@ async fn it_merges_two_async_finite_listenable_sources() {
#[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 it_returns_a_source_that_disposes_upon_upwards_end() {
Expand Down Expand Up @@ -458,10 +449,7 @@ async fn it_returns_a_source_that_disposes_upon_upwards_end() {
#[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 it_errors_when_one_of_the_sources_errors() {
Expand Down Expand Up @@ -659,10 +647,7 @@ async fn it_errors_when_one_of_the_sources_errors() {
#[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 it_greets_the_sink_as_soon_as_the_first_member_source_greets() {
Expand Down Expand Up @@ -810,10 +795,7 @@ async fn it_greets_the_sink_as_soon_as_the_first_member_source_greets() {
#[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 it_merges_sync_listenable_sources_resilient_to_greet_terminate_race_conditions_part_1() {
Expand Down Expand Up @@ -937,10 +919,7 @@ async fn it_merges_sync_listenable_sources_resilient_to_greet_terminate_race_con
#[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 it_merges_sync_listenable_sources_resilient_to_greet_terminate_race_conditions_part_2() {
Expand Down
10 changes: 2 additions & 8 deletions tests/scan.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,7 @@ fn it_scans_a_pullable_source() {
#[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 it_scans_an_async_finite_listenable_source() {
Expand Down Expand Up @@ -312,10 +309,7 @@ async fn it_scans_an_async_finite_listenable_source() {
#[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 it_returns_a_source_that_disposes_upon_upwards_end() {
Expand Down
Loading