Skip to content

Commit 0d99333

Browse files
lobsterkatieAbhiPrasad
authored andcommitted
fix(wasm): Ensure wasm bundle exists before running wasm tests (#4916)
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.
1 parent ccc83be commit 0d99333

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

packages/wasm/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
"lint": "run-s lint:prettier lint:eslint",
5454
"lint:eslint": "eslint . --cache --cache-location '../../eslintcache/' --format stylish",
5555
"lint:prettier": "prettier --check \"{src,test,scripts}/**/*.ts\"",
56-
"test": "node test/scripts/ensure-browser-bundle.js && cross-env PORT=1337 jest",
56+
"test": "node test/scripts/ensure-bundles.js && cross-env PORT=1337 jest",
5757
"test:watch": "jest --watch"
5858
},
5959
"volta": {

packages/wasm/test/scripts/ensure-browser-bundle.js renamed to packages/wasm/test/scripts/ensure-bundles.js

+9
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,13 @@ function ensureBrowserBundle() {
1111
}
1212
}
1313

14+
function ensureWasmBundle() {
15+
if (!fs.existsSync('build/bundles/wasm.js')) {
16+
// eslint-disable-next-line no-console
17+
console.warn('\nWARNING: Missing wasm bundle. Bundle will be created before running wasm integration tests.');
18+
execSync('yarn build:bundle');
19+
}
20+
}
21+
1422
ensureBrowserBundle();
23+
ensureWasmBundle();

0 commit comments

Comments
 (0)