Skip to content

Macro, like tokio::test? #7

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
phated opened this issue May 16, 2023 · 1 comment
Open

Macro, like tokio::test? #7

phated opened this issue May 16, 2023 · 1 comment

Comments

@phated
Copy link

phated commented May 16, 2023

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
@j-devel
Copy link
Contributor

j-devel commented May 17, 2023

Thanks for your suggestion!

So far, we have just create_test_thread() for a similar purpose. A proc_macro for your use cases sounds interesting. Currently, I don't have enough time to actively add new functionalities to this crate, however I would love to review such a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants