Closed mbalex99 closed 1 year ago
Yeah, that's why we disable dynamic import in component tests https://github.com/bahmutov/cypress-react-unit-test/tree/main/cypress/component/advanced/lazy-loaded but let me look at this in detail. You probably want to make a static page where you bundle and load WASM and just cy.visit('http://localhost:3000')
from the test
So the webpack settings Cypress uses disable chunking, thus the separate chunk fails to load. I will try to create an example where the bundling is done using separate webpack, and Cypress just requests that page
@mbalex99 I have made the test work in https://github.com/bahmutov/cypress-example-wasm-ts see the README there. I think for now this would be better approach than rewriting the Cypress Webpack preprocessor to handle multiple bundles and serve WASM bundle.
Wrote a blog post https://glebbahmutov.com/blog/cypress-wasm-example/
This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.
This issue has been closed due to inactivity.
I cannot seem to load wasm properly in my test code.
Current behavior
When trying to run a test that includes wasm code like so:
I get:
Or when loading synchronously:
I get this error:
I suspect this has something to do with the webpack config that cypress uses does not properly load wasm by default.
Desired behavior
No errors when loading wasm
Test code to reproduce
Reproducible repository can be found here: https://github.com/mbalex99/wasm-pack-ts-cypress Please follow the simple instructions.
Versions