Rust + Wasm Testing

⚓ rust    📅 2025-04-25    👤 surdeus    👁️ 1      

surdeus

Info

This post is auto-generated from RSS feed The Rust Programming Language Forum - Latest topics. Source: Rust + Wasm Testing

I am trying to follow the "Rust and WebAssembly" Tutorial. I am at the point where we are adding tests, Testing Life - Rust and WebAssembly. The problem is that I keep getting an error that it cannot find the wasm_game_of_life crate even through that is the crate the test is in.

tests\web.rs:
//! Test suite for the Web and headless browsers.

#![cfg(target_arch = "wasm32")]

extern crate wasm_bindgen_test;
use wasm_bindgen_test::*;

extern crate wasm_game_of_life;
use wasm_game_of_life::Universe;

wasm_bindgen_test_configure!(run_in_browser);
...

I am getting the following error when I run wasm-pack test --chrome --headless and I cannot figure out why.

PS C:\Users\<user>\Rust\wasm-game-of-life> wasm-pack test --chrome --headless
[INFO]: Checking for the Wasm target...
   Compiling wasm-game-of-life v0.1.0 (C:\Users\mrmal\Rust\wasm-game-of-life)
error[E0463]: can't find crate for `wasm_game_of_life`
 --> tests\web.rs:8:1
  |
8 | extern crate wasm_game_of_life;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ can't find crate

For more information about this error, try `rustc --explain E0463`.           
error: could not compile `wasm-game-of-life` (test "web") due to 1 previous error

2 posts - 2 participants

Read full topic

🏷️ rust_feed