Skip to content

What does wasm-bindgen-test test? #3744

Answered by daxpedda
daidoji asked this question in Q&A
Discussion options

You must be logged in to vote

Question 1.
If wasm-bindgen is taking (Rust) -> (wasm) which can then be called from a js library. Why then when I write a wasm-bindgen-test I'm testing the Rust interface that wasm-bindgen is using to generate the wasm? Wouldn't it be better to test the wasm artifact itself?

wasm-bindgen-cli is just a Wasm post-processor. The Rust compiler is the one converting Rust to Wasm. wasm-bindgen-test + wasm-bindgen-test-runner executes your tests when targeting wasm32-unknown-unknown on a platform that supports Wasm (e.g. a browser), so it does indeed test how your code runs as Wasm.

Question 2.
Then in a matter of logistics if I have a Crate C, a wasm-wrapper for that crate W, and a javascri…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@daidoji
Comment options

@daxpedda
Comment options

Answer selected by daidoji
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants