Skip to content

Commit

Permalink
fix(wasm): Ensure wasm bundle exists before running wasm tests (#4916)
Browse files Browse the repository at this point in the history
The `@sentry/wasm` test suite requires both the browser bundle and the wasm bundle. Currently, before running the tests, we check to make sure the browser bundle exists, and build it if it's missing. We don't do the same for the wasm bundle, however. This fixes that, so that both bundles are guaranteed to exist before we try to run tests.
  • Loading branch information
lobsterkatie authored and AbhiPrasad committed May 30, 2022
1 parent ccc83be commit 0d99333
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"lint": "run-s lint:prettier lint:eslint",
"lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish",
"lint:prettier": "prettier --check \"{src,test,scripts}/**/*.ts\"",
"test": "node test/scripts/ensure-browser-bundle.js && cross-env PORT=1337 jest",
"test": "node test/scripts/ensure-bundles.js && cross-env PORT=1337 jest",
"test:watch": "jest --watch"
},
"volta": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,13 @@ function ensureBrowserBundle() {
}
}

function ensureWasmBundle() {
if (!fs.existsSync('build/bundles/wasm.js')) {
// eslint-disable-next-line no-console
console.warn('\nWARNING: Missing wasm bundle. Bundle will be created before running wasm integration tests.');
execSync('yarn build:bundle');
}
}

ensureBrowserBundle();
ensureWasmBundle();

0 comments on commit 0d99333

Please sign in to comment.