@@ -28,6 +28,7 @@ Commands:
2828 fmt format code, fail if bad
2929 test run unit tests (no Godot needed)
3030 itest run integration tests (from within Godot)
31+ testweb run unit tests on web environment (requires node.js and emcc)
3132 clippy validate clippy lints
3233 klippy validate + fix clippy
3334 doc generate docs for 'godot' crate
@@ -179,6 +180,21 @@ function cmd_itest() {
179180 run " $godotBin " $GODOT_ARGS --path itest/godot --headless -- " [${extraArgs[@]} ]"
180181}
181182
183+ function cmd_testweb() {
184+ # For the flag: https://github.com/rust-lang/cargo/issues/7471
185+ CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node RUSTFLAGS=" -C link-args=-pthread \
186+ -C link-args=-g \
187+ -C link-args=-sPTHREAD_POOL_SIZE=4 \
188+ -C link-args=-sASSERTIONS=2 \
189+ -C link-args=-sINITIAL_MEMORY=268435456 \
190+ -C panic=unwind \
191+ -C target-feature=+atomics \
192+ -Zlink-native-libraries=no \
193+ -Cllvm-args=-enable-emscripten-cxx-exceptions=0" EM_CACHE=$( mktemp -d) run cargo +nightly test \
194+ --features godot/experimental-wasm,godot/lazy-function-tables \
195+ -Zbuild-std --target wasm32-unknown-emscripten -- --nocapture
196+ }
197+
182198function cmd_doc() {
183199 run cargo doc --lib -p godot --no-deps " ${extraCargoArgs[@]} "
184200}
@@ -211,7 +227,7 @@ while [[ $# -gt 0 ]]; do
211227 --double)
212228 extraCargoArgs+=(" --features" " godot/double-precision" )
213229 ;;
214- fmt | test | itest | clippy | klippy | doc | dok)
230+ fmt | test | itest | testweb | clippy | klippy | doc | dok)
215231 cmds+=(" $arg " )
216232 ;;
217233 -f | --filter)
0 commit comments