wasm-bindgen icon indicating copy to clipboard operation
wasm-bindgen copied to clipboard

Allow tests for use Web Extension APIs

Open eugenesvk opened this issue 3 years ago • 0 comments

Motivation

If you have a web extension written in Rust and compiled to wasm, you can only run wasm-bindgen-test in a browser (with the help of wasm-bindgen-test-runner and webdriver) to test those parts of your extension code that don't use Web Extensions APIs

Proposed Solution

Add a feature to wasm-bindgen-test to run tests within a context of a Web Extension (to have access to webext APIs)

Alternatives

Maybe wasm-bindgen-test could add a feature to compile the tests, but not run them right away — instead the web extension would have to add some glue code to be able to invoke the compiled tests and run them within the context of a running web extension, so the tests would have access to all the needed APIs But that is far less convenient than being able to run tests via the cargo test --target wasm32-unknown-unknown ...

eugenesvk avatar Aug 10 '22 16:08 eugenesvk