From c327a491d3f020c5978069f504be19840e8e29d3 Mon Sep 17 00:00:00 2001 From: Yann Braga Date: Fri, 29 Nov 2024 11:57:29 +0100 Subject: [PATCH] Build: Fix portable stories tests by moving from jsdom to happy-dom --- .../nextjs/jest.config.js | 2 +- .../nextjs/package.json | 4 ++-- .../portable-stories.test.tsx.snap | 24 +++++++++---------- .../svelte/package.json | 4 ++-- .../svelte/vite.config.ts | 5 ++-- 5 files changed, 19 insertions(+), 20 deletions(-) diff --git a/test-storybooks/portable-stories-kitchen-sink/nextjs/jest.config.js b/test-storybooks/portable-stories-kitchen-sink/nextjs/jest.config.js index 3867a50e7bc7..f427b4763dd6 100644 --- a/test-storybooks/portable-stories-kitchen-sink/nextjs/jest.config.js +++ b/test-storybooks/portable-stories-kitchen-sink/nextjs/jest.config.js @@ -9,7 +9,7 @@ const createJestConfig = nextJest({ /** @type {import('jest').Config} */ const customJestConfig = { coverageProvider: 'v8', - testEnvironment: 'jsdom', + testEnvironment: '@happy-dom/jest-environment', // Add more setup options before each test is run setupFilesAfterEnv: ['./jest.setup.ts'], moduleNameMapper: { diff --git a/test-storybooks/portable-stories-kitchen-sink/nextjs/package.json b/test-storybooks/portable-stories-kitchen-sink/nextjs/package.json index 9e9b8e0285f8..69722cabd5db 100644 --- a/test-storybooks/portable-stories-kitchen-sink/nextjs/package.json +++ b/test-storybooks/portable-stories-kitchen-sink/nextjs/package.json @@ -84,6 +84,7 @@ "react-dom": "^18.2.0" }, "devDependencies": { + "@happy-dom/jest-environment": "^15.11.7", "@jest/globals": "^29.7.0", "@storybook/addon-actions": "^8.0.0", "@storybook/addon-essentials": "^8.0.0", @@ -101,11 +102,10 @@ "eslint": "^8.56.0", "eslint-plugin-storybook": "^0.6.15", "jest": "^29.7.0", - "jest-environment-jsdom": "^29.7.0", "storybook": "^8.0.0", "typescript": "^5.2.2" }, "maintainer_please_read_this": { "_": "we use file protocol to make this setup close to real life scenarios as well as avoid issues with duplicated React instances. When you recompile the SB packages, you need to rerun install." } -} \ No newline at end of file +} diff --git a/test-storybooks/portable-stories-kitchen-sink/nextjs/stories/__snapshots__/portable-stories.test.tsx.snap b/test-storybooks/portable-stories-kitchen-sink/nextjs/stories/__snapshots__/portable-stories.test.tsx.snap index e65b31476609..677e011bb38c 100644 --- a/test-storybooks/portable-stories-kitchen-sink/nextjs/stories/__snapshots__/portable-stories.test.tsx.snap +++ b/test-storybooks/portable-stories-kitchen-sink/nextjs/stories/__snapshots__/portable-stories.test.tsx.snap @@ -158,16 +158,16 @@ exports[`renders imageLegacyStories stories renders BlurredAbsolutePlaceholder 1 Global Decorator