-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Support crate
attribute in proc-macro wasm_bindgen_test
#3588
Labels
Comments
I have done this for the |
FirelightFlagboy
added a commit
to FirelightFlagboy/wasm-bindgen
that referenced
this issue
Sep 4, 2023
This attribute allow to specify a path where `wasm-bindgen-test` can be accessed. Closes rustwasm#3588
I've create a PR (#3593) |
FirelightFlagboy
added a commit
to FirelightFlagboy/wasm-bindgen
that referenced
this issue
Sep 4, 2023
This attribute allow to specify a path where `wasm-bindgen-test` can be accessed. Closes rustwasm#3588
FirelightFlagboy
added a commit
to FirelightFlagboy/wasm-bindgen
that referenced
this issue
Sep 4, 2023
This attribute allow to specify a path where `wasm-bindgen-test` can be accessed. Closes rustwasm#3588
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Motivation
We have multiple crates that we would like to test using
wasm-bindgen-test
.For the ease-of-use on our side we create a proc-macro that wrap multiple other proc-macro (
rstest
,tokio::test
, custom testbed) for testing.To use that proc-macro the developer would have to import (add as a dependency) a single crate that provide the proc-macro + re-export
rstest
,tokio::test
and testbed.But to support
wasm-bindgen-test
we're required to alongside the test crate to also importwasm-bindgen-test
and we would like to have it re-exported in the test crate instead.Currently
wasm-bindgen-test
proc macro use a fixed path to the cratewasm_bindgen_test
(cf the generated function by the proc-macrowasm_bindgen_test
Proposed Solution
A solution would be to do something like
tokio::test
handle renaming the crate with thecrate
attribute provided to the proc-macro.A clear and concise description of the feature you would like to add, and how it solves the motivating problem.
Alternatives
An alternative would have to add
wasm-bindgen-test
to each of our crates that will be tested with it.For the easy-of-use we would have preferred to import a single crate that re-expose those utility crates.
Additional Context
This feature will required to:
Handle a new token here:
wasm-bindgen/crates/test-macro/src/lib.rs
Lines 23 to 31 in 86fd961
Tweak the generated function at
wasm-bindgen/crates/test-macro/src/lib.rs
Line 99 in 86fd961
The text was updated successfully, but these errors were encountered: