Skip to content

Commit

Permalink
Attempt #4 to fix GTM breaking CI tests
Browse files Browse the repository at this point in the history
  • Loading branch information
replete committed Aug 7, 2024
1 parent 7a79b62 commit 557ce04
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions jest.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,17 @@ beforeAll(async () => {
headless: true
})

page.on('pageerror', (error) => {
if (error.toString && error.toString().includes('CookieDeprecationLabel')) return false // GTM bug: https://github.com/replete/biscuitman/issues/4
console.error('Page error:', error)
})

page.on('console', (msg) => {
let text = msg.text()
const text = msg.text()
const location = msg.location()
if (msg.type() === 'error') {
// Squash 404 errors
if (text.startsWith('Failed to load resource:')) return false
console.log('Console error:', msg.text())

// Raise errors if it originated from a locally-served resource
if (location && location.url && location.url.startsWith(global.__SERVERURL__)) {
console.error('Console error:', msg.text())
} else return false
}
})
})
Expand Down

0 comments on commit 557ce04

Please sign in to comment.