Unable to run tests with wasm32-wasip1
- Dominant language
- Rust
- Stars
- 48.2k
- Forks
- 4.8k
- Avg merge
- 3d 16h
- Merged PRs (30d)
- 171
Description
## Bevy version and features
- 0.18.1.
## What you did
I run tests for [`bevy_replicon`](https://github.com/simgine/bevy_replicon) on `wasm32-wasip1` like this:
```bash
CARGO_TARGET_WASM32_WASIP1_RUNNER=wasmtime cargo test --target wasm32-wasip1
```
## What went wrong
[Here](https://github.com/simgine/bevy_replicon/actions/runs/23553842799) is the last passed CI job in my repo (last week). But lately [it started to fail](https://github.com/simgine/bevy_replicon/actions/runs/23820632051/job/69431732185) with the following output:
```bash
Error: failed to run main module `/home/runner/work/bevy_replicon/bevy_replicon/target/wasm32-wasip1/debug/deps/bevy_replicon-579212789e479ae6.wasm`
Caused by:
0: failed to instantiate "/home/runner/work/bevy_replicon/bevy_replicon/target/wasm32-wasip1/debug/deps/bevy_replicon-579212789e479ae6.wasm"
1: unknown import: `__wbindgen_placeholder__::__wbindgen_describe` has not been defined
error: test failed, to rerun pass `--lib`
```
So the problem is that some dependency pulls JS environment. I looked at my dependencies and looks like `bevy_asset` (part of my dev-deps) causes this:
https://github.com/bevyengine/bevy/blob/36a97620df69051a54921486817936c035bee93a/crates/bevy_asset/Cargo.toml#L78-L94
But it was like this for quite a while now. I'm surprised it started to fail only now! I didn't add any new deps during this time period.
It would be really nice to run tests with wasm32-wasip1 since I don't really need JS env for my tests.
Contributor guide
Research direction
Start by reproducing the failure with CARGO_TARGET_WASM32_WASIP1_RUNNER=wasmtime cargo test --target wasm32-wasip1, then inspect the bevy_asset dependency configuration in crates/bevy_asset/Cargo.toml at the linked lines. Trace which dependency introduces the __wbindgen_placeholder__ import and verify that the relevant Bevy tests complete successfully on wasm32-wasip1 without a JavaScript environment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- build-system, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 56/100