From 111ea284047f54f50dadb075be2fc4d367b826a0 Mon Sep 17 00:00:00 2001 From: Katie Byers Date: Tue, 19 Oct 2021 06:16:57 -0700 Subject: [PATCH] fix(wasm): Check for browser bundle existence before running tests (#4074) As of https://github.com/getsentry/sentry-javascript/pull/4048, it's more likely that one might try to run the full test suite without having built the browser bundle. Since the wasm tests rely on it, this adds a check before they run, along with an error message letting the user know why things aren't working. --- packages/wasm/test/integration.test.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/wasm/test/integration.test.js b/packages/wasm/test/integration.test.js index 2e4e7a6ffe33..b36c8a0c36d4 100644 --- a/packages/wasm/test/integration.test.js +++ b/packages/wasm/test/integration.test.js @@ -1,6 +1,15 @@ /* global page, window */ +const fs = require('fs'); +const path = require('path'); + const HOST = `http://localhost:${process.env.PORT}`; +if (!fs.existsSync(path.resolve(__dirname, '../../browser/build/bundle.js'))) { + throw new Error( + 'ERROR: No browser bundle found in `packages/browser/build/`. Please run `yarn build` in the browser package before running wasm tests.', + ); +} + describe('Wasm', () => { it('captured exception should include modified frames and debug_meta attribute', async () => { await page.goto(HOST);