-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Running tests through wasm-pack
doesn't work if JS snippets are used
#1458
Comments
Thanks for the report! This is actually sort of an extension of #822 and is a relic of how the testing situation still has an unresolve question here between wasm-pack and wasm-bindgen that we haven't gotten around to fixing. What's happening here under the hood is that each test binary (the wasm file) is either configured to automatically run in node.js or in a browser. This configuration is done in code currently with the The problem here is that the default for all tests is to execute in Node.js. The test above is actually configured to run in Node.js because nothing else was mentioned. As a result, @fitzgen IIRC you were working on this way back when |
I never started work on resolving this impedance mismatch. As a strawperson proposal for an end state resolution:
How does this sound? |
While |
This is intended to handle rustwasm#1458 and rustwasm#822. These issues stem from behavior where: wasm-pack test --node will actually run both Node.js and browser tests! Two new env vars are read here, `WASM_BINDGEN_TEST_ONLY_{NODE,WEB}`, which control which tests are executed by `wasm-bindgen-test-runner`. The intention is that these will be set by `wasm-pack` to configure which tests are run, and if test suites are skipped due to the env vars we'll print an informational message indicating how they can be run. Closes rustwasm#822 Closes rustwasm#1458
This is intended to handle rustwasm#1458 and rustwasm#822. These issues stem from behavior where: wasm-pack test --node will actually run both Node.js and browser tests! Two new env vars are read here, `WASM_BINDGEN_TEST_ONLY_{NODE,WEB}`, which control which tests are executed by `wasm-bindgen-test-runner`. The intention is that these will be set by `wasm-pack` to configure which tests are run, and if test suites are skipped due to the env vars we'll print an informational message indicating how they can be run. Closes rustwasm#822 Closes rustwasm#1458
Describe the Bug
Using JS snippets prevents
wasm-pack
from being able to run tests.Steps to Reproduce
Cargo.toml
:src/lib.rs
:Actual Behavior
Expected Behavior
I expect the tests to run.
Additional Context
I need this to be able to run
stdweb
's test suite. I could probably hack around it by having a custom test runner, but I'd rather not do that and just use standard tooling.Also, it seems somewhat counterintuitive that even though I want to run the tests under headless Chrome they're being built for Node.js by
wasm-pack
? Is this expected?The text was updated successfully, but these errors were encountered: