Skip to content

Commit

Permalink
Add tests to throw if there are JavaScript errors
Browse files Browse the repository at this point in the history
  • Loading branch information
NickColley committed Mar 1, 2019
1 parent d85dee7 commit 517692c
Show file tree
Hide file tree
Showing 7 changed files with 42 additions and 0 deletions.
6 changes: 6 additions & 0 deletions __tests__/accessiblity_audit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})

Expand Down
6 changes: 6 additions & 0 deletions __tests__/back-to-top.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ beforeAll(async (done) => {
await page.evaluateOnNewDocument(() => {
window.__TESTS_RUNNING = true
})

// Capture JavaScript errors.
page.on('pageerror', error => {
throw error
})

done()
})

Expand Down
6 changes: 6 additions & 0 deletions __tests__/component-options.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})

Expand Down
6 changes: 6 additions & 0 deletions __tests__/example.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ beforeAll(async (done) => {
await page.evaluateOnNewDocument(() => {
window.__TESTS_RUNNING = true
})

// Capture JavaScript errors.
page.on('pageerror', error => {
throw error
})

done()
})

Expand Down
6 changes: 6 additions & 0 deletions __tests__/mobile-navigation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})

Expand Down
6 changes: 6 additions & 0 deletions __tests__/search.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ beforeEach(async (done) => {
await page.evaluateOnNewDocument(() => {
window.__TESTS_RUNNING = true
})

// Capture JavaScript errors.
page.on('pageerror', error => {
throw error
})

done()
})

Expand Down
6 changes: 6 additions & 0 deletions __tests__/tabs.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ beforeAll(async (done) => {
await page.evaluateOnNewDocument(() => {
window.__TESTS_RUNNING = true
})

// Capture JavaScript errors.
page.on('pageerror', error => {
throw error
})

done()
})

Expand Down

0 comments on commit 517692c

Please sign in to comment.