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

Macro, like `tokio::test`?

Open phated opened this issue 1 year ago • 1 comments

This project is 🔥!

I've done some experiments with wasm-mt-test and it's working great. However, I need to adjust my test code to run in a worker thread. It would be super cool if I could include a macro, like use wasm_mt_test::test and then my tests would automatically run in a worker.

Unless I'm mistaken, I believe it'd just generate a wrapper containing:

let pkg_js_uri = wasm_mt_test::get_pkg_js_uri();

let th = wasm_mt_test::create_mt(&pkg_js_uri).await.thread().and_init().await.unwrap();

exec!(th, async move || test_fn().await).await

phated avatar May 16 '23 23:05 phated