diff --git a/__tests__/accessiblity_audit.test.js b/__tests__/accessiblity_audit.test.js index 3b934979c2..a7d3233718 100644 --- a/__tests__/accessiblity_audit.test.js +++ b/__tests__/accessiblity_audit.test.js @@ -15,6 +15,12 @@ const thingsToExclude = [ beforeAll(async (done) => { browser = global.browser page = await browser.newPage() + + // Capture JavaScript errors. + page.on('pageerror', error => { + throw error + }) + done() }) diff --git a/__tests__/back-to-top.test.js b/__tests__/back-to-top.test.js index 522ead43c6..20b4d1cbc5 100644 --- a/__tests__/back-to-top.test.js +++ b/__tests__/back-to-top.test.js @@ -12,6 +12,12 @@ beforeAll(async (done) => { await page.evaluateOnNewDocument(() => { window.__TESTS_RUNNING = true }) + + // Capture JavaScript errors. + page.on('pageerror', error => { + throw error + }) + done() }) diff --git a/__tests__/component-options.test.js b/__tests__/component-options.test.js index d3c58e78a9..615541c580 100644 --- a/__tests__/component-options.test.js +++ b/__tests__/component-options.test.js @@ -9,6 +9,12 @@ let baseUrl = 'http://localhost:' + PORT beforeAll(async (done) => { browser = global.browser page = await browser.newPage() + + // Capture JavaScript errors. + page.on('pageerror', error => { + throw error + }) + done() }) diff --git a/__tests__/example.test.js b/__tests__/example.test.js index 2f5029d666..81c3533d9a 100644 --- a/__tests__/example.test.js +++ b/__tests__/example.test.js @@ -12,6 +12,12 @@ beforeAll(async (done) => { await page.evaluateOnNewDocument(() => { window.__TESTS_RUNNING = true }) + + // Capture JavaScript errors. + page.on('pageerror', error => { + throw error + }) + done() }) diff --git a/__tests__/mobile-navigation.test.js b/__tests__/mobile-navigation.test.js index c319bb0be1..98eec61b36 100644 --- a/__tests__/mobile-navigation.test.js +++ b/__tests__/mobile-navigation.test.js @@ -15,6 +15,12 @@ beforeAll(async (done) => { window.__TESTS_RUNNING = true }) await page.emulate(iPhone) + + // Capture JavaScript errors. + page.on('pageerror', error => { + throw error + }) + done() }) diff --git a/__tests__/search.test.js b/__tests__/search.test.js index 0fc01b05a7..fbdf8a0c7e 100644 --- a/__tests__/search.test.js +++ b/__tests__/search.test.js @@ -15,6 +15,12 @@ beforeEach(async (done) => { await page.evaluateOnNewDocument(() => { window.__TESTS_RUNNING = true }) + + // Capture JavaScript errors. + page.on('pageerror', error => { + throw error + }) + done() }) diff --git a/__tests__/tabs.test.js b/__tests__/tabs.test.js index 7899c53125..053d726346 100644 --- a/__tests__/tabs.test.js +++ b/__tests__/tabs.test.js @@ -12,6 +12,12 @@ beforeAll(async (done) => { await page.evaluateOnNewDocument(() => { window.__TESTS_RUNNING = true }) + + // Capture JavaScript errors. + page.on('pageerror', error => { + throw error + }) + done() })