Closed replete closed 3 months ago
Fixed by adding check to jest.setup.js for GTM error
I wanted to fix the build process by preventing errors not raised by locally hosted scripts from propogating, but this wasn't so straightforward so for now I'm leaving it as-is and will come back to it in the future.
The tests pass locally
Not quite sure how to fix this, seems jest-puppeteer
related.
I've opened a question on SO: https://stackoverflow.com/questions/78844702/jest-puppeteer-how-can-i-prevent-javascript-errors-from-third-party-scripts-fro
EDIT: Deleted it as it spent more time being pointlessly edited by internet point chasers
It's passing now, presumably GTM.js has been updated by Google, but to prevent this in the future we'll need to somehow ignore page errors except for self-hosted ones. I've attempted this with a few methods and not got anywhere, javascript errors are baked in as test failures so it's hard to avoid this, even with replacing window.onerror.
gov UK design system repo uses request interception to mock response to avoid these kind of issues, which might be what we need to do: https://github.com/alphagov/govuk-design-system/blob/main/__tests__/helpers/google-tag-manager.js
v0.3.18 CI tests fail due to:
This is a bug in Google Tag Manager's gtm.js: https://support.google.com/tagmanager/thread/288419928/error-failed-to-execute-getvalue-on-cookiedeprecationlabel?hl=en
Will remove once builds sort themselves out when they presumably push out a fix as it only started happening a few days ago. GTM.js is only used in the sandbox, but we use the sandbox for integration tests.