Skip to content

Commit cd40428

Browse files
test: Fix wasm-pack test on Node (#609)
* fix: condition on ENV wasm-bindgen/wasm-bindgen#4295 * add comments
1 parent bac94d9 commit cd40428

2 files changed

Lines changed: 8 additions & 5 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ jobs:
107107
uses: step-security/harden-runner@e3f713f2d8f53843e71c69a996d56f51aa9adfb9 # v2.14.1
108108
with:
109109
egress-policy: audit
110-
110+
- name: Conditionally set env
111+
if: matrix.browser_flags != '--node' # if browser testing
112+
run: echo "WASM_BINDGEN_USE_BROWSER=1" >> $GITHUB_ENV
111113
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
112114
with:
113115
persist-credentials: false

tests/wasm32.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,17 @@
77
//! cargo install wasm-pack
88
//!
99
//! # useful commands
10-
//! wasm-pack test --headless --chrome
11-
//! wasm-pack test --headless --firefox
10+
//! WASM_BINDGEN_USE_BROWSER=1 wasm-pack test --headless --chrome
11+
//! WASM_BINDGEN_USE_BROWSER=1 wasm-pack test --headless --firefox
1212
//! wasm-pack test --node
1313
//! ```
1414
//!
15+
//! For testing within a browser, you will need the `WASM_BINDGEN_USE_BROWSER=1` env variable
16+
//!
1517
1618
#![cfg(target_arch = "wasm32")]
1719

18-
use wasm_bindgen_test::*;
19-
wasm_bindgen_test_configure!(run_in_browser);
20+
use wasm_bindgen_test::wasm_bindgen_test;
2021

2122
mod aes_encryption;
2223

0 commit comments

Comments
 (0)