Skip to content

Commit 1043eaf

Browse files
Add wasm-pack tests for net to CI (#486)
* add wasm-pack test for net to ci * remove commented line * fix path to net crate * enable query tests * cfg gate for browser tests * revert cargo.lock * add browser-test feature
1 parent 40c6daa commit 1043eaf

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

.github/workflows/tests.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ jobs:
250250
SSE_ECHO_SERVER_URL: 'http://localhost:8081/.sse'
251251
run: |
252252
cd crates/net
253-
wasm-pack test --chrome --firefox --headless --all-features
253+
wasm-pack test --chrome --firefox --headless --features=default,io-util,browser-test
254254
255255
- uses: dtolnay/rust-toolchain@master
256256
with:
@@ -262,4 +262,11 @@ jobs:
262262
HTTPBIN_URL: 'http://localhost:8080'
263263
WS_ECHO_SERVER_URL: 'ws://localhost:8081'
264264
SSE_ECHO_SERVER_URL: 'http://localhost:8081/.sse'
265-
run: cargo test -p gloo-net --all-features
265+
run: cargo test -p gloo-net --features=default,io-util
266+
267+
- name: Run node tests
268+
env:
269+
HTTPBIN_URL: 'http://localhost:8080'
270+
WS_ECHO_SERVER_URL: 'ws://localhost:8081'
271+
SSE_ECHO_SERVER_URL: 'http://localhost:8081/.sse'
272+
run: wasm-pack test --node crates/net --features=default,io-util

crates/net/Cargo.toml

+2
Original file line numberDiff line numberDiff line change
@@ -100,3 +100,5 @@ eventsource = [
100100
]
101101
# As of now, only implements `AsyncRead` and `AsyncWrite` on `WebSocket`
102102
io-util = ["futures-io"]
103+
# For test runner only. Enables browser tests.
104+
browser-test = []

crates/net/tests/http.rs

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ use once_cell::sync::Lazy;
33
use serde::{Deserialize, Serialize};
44
use wasm_bindgen_test::*;
55

6+
#[cfg(feature = "browser_test")]
67
wasm_bindgen_test_configure!(run_in_browser);
78

89
static HTTPBIN_URL: Lazy<&'static str> =

crates/net/tests/query.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use gloo_net::http::QueryParams;
22
use wasm_bindgen_test::*;
33

4+
#[cfg(feature = "browser_test")]
45
wasm_bindgen_test_configure!(run_in_browser);
56

67
#[wasm_bindgen_test]

0 commit comments

Comments
 (0)