Open yuroitaki opened 3 months ago
Since initThreadPool should be called from within the WebWorker, I'd expect this to work
wasm_bindgen_test_configure!(run_in_dedicated_worker);`
#[wasm_bindgen_test]
async fn test() {
spawn_local(JsFuture::from(init_thread_pool(8)).map(|_| ()));
...
}
But even with the above change, my test hang. I worked around it by modifying the JS code produces by wasm-bindgen-test:
await initThreadPool(navigator.hardwareConcurrency);
right after the wasm was initialized. i.e. to this line https://github.com/rustwasm/wasm-bindgen/blob/c108c7520a13fa124038b28db6fb759b35576dd4/crates/cli/src/bin/wasm-bindgen-test-runner/server.rs#L108initThreadPool,
to the imports in that filewasm-bindgen-test-runner
instead of the system's default one
Related to https://github.com/GoogleChromeLabs/wasm-bindgen-rayon/issues/30, I tried to initalise thread pool in my wasm bindgen test with the following:
and run the test with the following
but the webworkers don't seem to have been set up correctly (picture below) and my test just hang halfway — if i disable rayon in my code, the test will work