You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using wasm-bindgen-test via wasm-pack test, if any struct have a name beginning with Test or test and have the #[wasm-bindgen] macro the tests will fail to run.
Steps to Reproduce
wasm-bindgen = "0.2.62"
wasm-bindgen-test = "0.3.12"
Add the following to a fresth lib.rs and run wasm-pack test --node.
#[wasm_bindgen]pubstructTest;#[cfg(test)]pubmod test {use wasm_bindgen_test::*;#[wasm_bindgen_test]fnpass(){assert_eq!(1, 1);}}
Actual Behavior
These struct names work:
ConnectionTest
SocketTest
ATest
Attestation
These names fail:
Test
TestConnection
Testnet
Testify
test
testify
Removing the #[wasm-bindgen] macro causes everything to succeed. Packages can be built succesfully, imported into Node, and used normally. Only tests break
Failures produce the following error message (stack information has been trimmed):
$ wasm-pack test --node
panicked at 'exception thrown while creating a test: Error: recursive use of an object detected which would lead to unsafe aliasing in rust
The text was updated successfully, but these errors were encountered:
There was an unfortunate collision with how test symbols were named and
the various bindings functions exported by wasm-bindgen. This commit
fixes these issues by using a separate prefix for `#[wasm_bindgen_test]`
than other `#[wasm_bindgen]` functions which should avoid the name
clash.
Closesrustwasm#2121
There was an unfortunate collision with how test symbols were named and
the various bindings functions exported by wasm-bindgen. This commit
fixes these issues by using a separate prefix for `#[wasm_bindgen_test]`
than other `#[wasm_bindgen]` functions which should avoid the name
clash.
Closes#2121
Describe the Bug
When using
wasm-bindgen-test
viawasm-pack test
, if any struct have a name beginning withTest
ortest
and have the#[wasm-bindgen]
macro the tests will fail to run.Steps to Reproduce
wasm-bindgen = "0.2.62"
wasm-bindgen-test = "0.3.12"
lib.rs
and runwasm-pack test --node
.Actual Behavior
These struct names work:
ConnectionTest
SocketTest
ATest
Attestation
These names fail:
Test
TestConnection
Testnet
Testify
test
testify
Removing the
#[wasm-bindgen]
macro causes everything to succeed. Packages can be built succesfully, imported into Node, and used normally. Only tests breakFailures produce the following error message (stack information has been trimmed):
The text was updated successfully, but these errors were encountered: