diff --git a/projects/js-packages/critical-css-gen/tests/config/jetst-global-setup.js b/projects/js-packages/critical-css-gen/tests/config/jetst-global-setup.js new file mode 100644 index 0000000000000..62dcc1e22a5d4 --- /dev/null +++ b/projects/js-packages/critical-css-gen/tests/config/jetst-global-setup.js @@ -0,0 +1,15 @@ +import { execSync } from 'child_process'; +import { setup as setupPuppeteer } from 'jest-environment-puppeteer'; + +/** + * Global setup function for Jest tests. + * + * @param {import('jest').GlobalConfig} globalConfig - Jest's global configuration object + */ +export default async function globalSetup( globalConfig ) { + // Install Chrome for Puppeteer + execSync( 'npx puppeteer browsers install chrome', { stdio: 'inherit' } ); + + // Run the original setup from jest-environment-puppeteer + await setupPuppeteer( globalConfig ); +}