diff --git a/lib/plugin.lazy.js b/lib/plugin.lazy.js index 701f3603..16887dec 100644 --- a/lib/plugin.lazy.js +++ b/lib/plugin.lazy.js @@ -126,7 +126,7 @@ async function loadSentry (ctx, inject) { const runtimeConfigKey = <%= serialize(options.runtimeConfigKey) %> if (ctx.$config && runtimeConfigKey && ctx.$config[runtimeConfigKey]) { - const merge = await import(/* <%= magicComments.join(', ') %> */ 'lodash.merge') + const { default: merge } = await import(/* <%= magicComments.join(', ') %> */ 'lodash.merge') merge(config, ctx.$config[runtimeConfigKey].config, ctx.$config[runtimeConfigKey].clientConfig) } diff --git a/test/default.test.js b/test/default.test.js index fcec14a4..b531e222 100644 --- a/test/default.test.js +++ b/test/default.test.js @@ -21,8 +21,15 @@ describe('Smoke test (default)', () => { test('builds and runs', async () => { const page = await browser.newPage() + /** @type {string[]} */ + const errors = [] + page.on('pageerror', (error) => { + errors.push(error.message) + }) await page.goto(url('/')) + expect(await $$('#server-side', page)).toBe('Works!') expect(await $$('#client-side', page)).toBe('Works!') + expect(errors).toEqual([]) }) }) diff --git a/test/fixture/lazy/nuxt.config.js b/test/fixture/lazy/nuxt.config.js index 698b3f2f..cc32a59a 100644 --- a/test/fixture/lazy/nuxt.config.js +++ b/test/fixture/lazy/nuxt.config.js @@ -20,6 +20,13 @@ const config = { // Integration from @Sentry/browser package. TryCatch: { eventTarget: false } } + }, + publicRuntimeConfig: { + sentry: { + config: { + environment: 'production' + } + } } } diff --git a/test/lazy.test.js b/test/lazy.test.js index 45a81c36..cc5db6f0 100644 --- a/test/lazy.test.js +++ b/test/lazy.test.js @@ -19,10 +19,18 @@ describe('Smoke test (lazy)', () => { await nuxt.close() }) - test('builds and runs', async () => { + test('builds, runs and there are no errors', async () => { const page = await browser.newPage() + + /** @type {string[]} */ + const errors = [] + page.on('pageerror', (error) => { + errors.push(error.message) + }) await page.goto(url('/')) + expect(await $$('#server-side', page)).toBe('Works!') expect(await $$('#client-side', page)).toBe('Works and is ready!') + expect(errors).toEqual([]) }) }) diff --git a/test/with-lazy-config.test.js b/test/with-lazy-config.test.js index 17197341..cba8e7c8 100644 --- a/test/with-lazy-config.test.js +++ b/test/with-lazy-config.test.js @@ -26,6 +26,11 @@ describe('Smoke test (lazy config)', () => { page.on('console', (msg) => { messages.push(msg.text()) }) + /** @type {string[]} */ + const errors = [] + page.on('pageerror', (error) => { + errors.push(error.message) + }) await page.goto(url('/')) expect(messages).toEqual(expect.arrayContaining(['Caught expected error on $sentry.captureEvent'])) @@ -35,5 +40,6 @@ describe('Smoke test (lazy config)', () => { await page.waitForTimeout(1100) expect(await $$('#client-side', page)).toBe('Works and is ready!') expect(messages).toEqual(expect.arrayContaining(['Sentry is ready'])) + expect(errors).toEqual([]) }) })