diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 14e7df7e..ee0c204c 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -250,7 +250,7 @@ jobs: SSE_ECHO_SERVER_URL: 'http://localhost:8081/.sse' run: | cd crates/net - wasm-pack test --chrome --firefox --headless --all-features + wasm-pack test --chrome --firefox --headless --features=default,io-util,browser-test - uses: dtolnay/rust-toolchain@master with: @@ -262,4 +262,11 @@ jobs: HTTPBIN_URL: 'http://localhost:8080' WS_ECHO_SERVER_URL: 'ws://localhost:8081' SSE_ECHO_SERVER_URL: 'http://localhost:8081/.sse' - run: cargo test -p gloo-net --all-features + run: cargo test -p gloo-net --features=default,io-util + + - name: Run node tests + env: + HTTPBIN_URL: 'http://localhost:8080' + WS_ECHO_SERVER_URL: 'ws://localhost:8081' + SSE_ECHO_SERVER_URL: 'http://localhost:8081/.sse' + run: wasm-pack test --node crates/net --features=default,io-util diff --git a/crates/net/Cargo.toml b/crates/net/Cargo.toml index 73681ee5..a0614686 100644 --- a/crates/net/Cargo.toml +++ b/crates/net/Cargo.toml @@ -102,3 +102,5 @@ eventsource = [ ] # As of now, only implements `AsyncRead` and `AsyncWrite` on `WebSocket` io-util = ["futures-io"] +# For test runner only. Enables browser tests. +browser-test = [] diff --git a/crates/net/tests/http.rs b/crates/net/tests/http.rs index 7f956a6b..38198c79 100644 --- a/crates/net/tests/http.rs +++ b/crates/net/tests/http.rs @@ -3,6 +3,7 @@ use once_cell::sync::Lazy; use serde::{Deserialize, Serialize}; use wasm_bindgen_test::*; +#[cfg(feature = "browser_test")] wasm_bindgen_test_configure!(run_in_browser); static HTTPBIN_URL: Lazy<&'static str> = diff --git a/crates/net/tests/query.rs b/crates/net/tests/query.rs index a16e061c..4492066a 100644 --- a/crates/net/tests/query.rs +++ b/crates/net/tests/query.rs @@ -1,6 +1,7 @@ use gloo_net::http::QueryParams; use wasm_bindgen_test::*; +#[cfg(feature = "browser_test")] wasm_bindgen_test_configure!(run_in_browser); #[wasm_bindgen_test]