Skip to content

Testing React-Capacitor App with Jest getting me wasm file error #406

Discussion options

You must be logged in to vote

Hello, sorry for the late answer.

Yes I did find an answer. The solution that worked was spinning up a server before running the test. So we added the following scripts to our package.json:

  "scripts": {
    "serve": "cp node_modules/sql.js/dist/sql-wasm.wasm build/assets && serve -l 80 build/",
    "test": "{Your test script here}",
    "test:serve": "npm-run-all --parallel -r serve test", 
  },

Then we ran npm run test:serve when running the test. The test:serve script serves a local host that jeepSqlite is trying to reach out to in order to retrieve the sql-wasm.wasm file.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@jepiqueau
Comment options

@Brandi-Youreka
Comment options

Answer selected by Brandi-Youreka
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants