Skip to content

Commit

Permalink
add browser-test feature
Browse files Browse the repository at this point in the history
  • Loading branch information
littlebenlittle committed Jul 19, 2024
1 parent 65dd70e commit 1e9e002
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -262,11 +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 --all-features
run: wasm-pack test --node crates/net --features=default,io-util
2 changes: 2 additions & 0 deletions crates/net/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []
2 changes: 1 addition & 1 deletion crates/net/tests/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize};
use wasm_bindgen_test::*;

#[cfg(target_arch = "wasm32-unknown-unknown")]
#[cfg(feature = "browser_test")]
wasm_bindgen_test_configure!(run_in_browser);

static HTTPBIN_URL: Lazy<&'static str> =
Expand Down
2 changes: 1 addition & 1 deletion crates/net/tests/query.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use gloo_net::http::QueryParams;
use wasm_bindgen_test::*;

#[cfg(target_arch = "wasm32")]
#[cfg(feature = "browser_test")]
wasm_bindgen_test_configure!(run_in_browser);

#[wasm_bindgen_test]
Expand Down

0 comments on commit 1e9e002

Please sign in to comment.