From 10d9e19add6fdfe629019c11862a31de24b6e5b3 Mon Sep 17 00:00:00 2001 From: Colin Rotherham Date: Tue, 21 Mar 2023 16:30:40 +0000 Subject: [PATCH] Temporarily workaround Jest puppeteer environment issue See issue: https://github.com/argos-ci/jest-puppeteer/issues/546 --- config/jest/environment/puppeteer.mjs | 25 ------------------------- jest.config.mjs | 2 +- 2 files changed, 1 insertion(+), 26 deletions(-) delete mode 100644 config/jest/environment/puppeteer.mjs diff --git a/config/jest/environment/puppeteer.mjs b/config/jest/environment/puppeteer.mjs deleted file mode 100644 index 968c53e019..0000000000 --- a/config/jest/environment/puppeteer.mjs +++ /dev/null @@ -1,25 +0,0 @@ -import PuppeteerEnvironment from 'jest-environment-puppeteer' - -/** - * Automation browser environment - * Adds Puppeteer page/browser globals, shared test globals - */ -class BrowserAutomationEnvironment extends PuppeteerEnvironment { - async setup () { - await super.setup() - - // Listen for browser exceptions - this.global.page.on('pageerror', (error) => { - this.context.console.error(error) - - // Ensure error appears in in reporter summary - // as Jest suppresses errors with stack traces - delete error.stack - - // Ensure test fails - process.emit('uncaughtException', error) - }) - } -} - -export default BrowserAutomationEnvironment diff --git a/jest.config.mjs b/jest.config.mjs index 11af8c2513..6283672e7d 100644 --- a/jest.config.mjs +++ b/jest.config.mjs @@ -86,7 +86,7 @@ export default { { ...config, displayName: 'JavaScript component tests', - testEnvironment: './config/jest/environment/puppeteer.mjs', + testEnvironment: 'jest-environment-puppeteer', testMatch: [ '**/components/globals.test.mjs', '**/components/*/*.test.{js,mjs}',