Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ process.env.TZ = 'UTC';
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
setupFilesAfterEnv: ['./jest.setup.js'],
// Jest 28+ (jest-environment-jsdom) defaults package resolution to the "browser" export
// condition, which makes packages like @vue/test-utils resolve their browser (global-Vue)
// build and throw "Vue is not defined". Pin to node conditions to restore Jest 27 behaviour.
testEnvironmentOptions: { customExportConditions: ['node', 'node-addons'] },
setupFilesAfterEnv: ['./jest.setup.js'],
watchman: false,

// tell Jest to handle `*.vue` files
Expand All @@ -20,6 +24,10 @@ module.exports = {
'@shell/(.*)': '<rootDir>/shell/$1',
'@pkg/(.*)': '<rootDir>/pkg/$1',
'@components/(.*)': '<rootDir>/pkg/rancher-components/src/components/$1',
// clipboard-polyfill's package `exports` only declares an `import` (ESM) condition, so Jest
// 28+'s exports-aware resolver can't resolve it for a CJS require. Map it to its concrete ESM
// build (transformed via transformIgnorePatterns below) to restore the Jest 27 `main` behaviour.
'^clipboard-polyfill$': '<rootDir>/node_modules/clipboard-polyfill/dist/es6/clipboard-polyfill.es6.js',
'\\.(jpe?g|png|gif|webp|svg|mp4|webm|ogg|mp3|wav|flac|aac|woff2?|eot|ttf|otf)$': '<rootDir>/svgTransform.js',
},
modulePathIgnorePatterns: [
Expand All @@ -35,7 +43,7 @@ module.exports = {
'<rootDir>(/.*)*/__tests__/utils/',
],
transformIgnorePatterns: [
'/node_modules/(?!(color|color-string|color-convert|color-name|vee-validate|@vee-validate)/)',
'/node_modules/(?!(color|color-string|color-convert|color-name|vee-validate|@vee-validate|clipboard-polyfill)/)',
],

// Babel
Expand Down
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@
"@typescript-eslint/parser": "8.62.0",
"@vue/cli-service": "5.0.8",
"@vue/test-utils": "2.4.6",
"@vue/vue3-jest": "27.0.0",
"@vue/vue3-jest": "29.2.6",
"add": "2.0.6",
"axe-core": "4.10.2",
"axe-html-reporter": "2.2.11",
"babel-core": "7.0.0-bridge.0",
"babel-jest": "27.5.1",
"babel-jest": "29.7.0",
"babel-loader": "9.1.3",
"babel-plugin-istanbul": "7.0.1",
"babel-plugin-module-resolver": "5.0.2",
Expand Down Expand Up @@ -194,7 +194,8 @@
"flush-promises": "1.0.2",
"frontmatter-markdown-loader": "3.7.0",
"globals": "17.7.0",
"jest": "27.5.1",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"jest-junit": "16.0.0",
"jest-serializer-vue": "2.0.2",
"junit-report-merger": "9.0.3",
Expand All @@ -207,7 +208,7 @@
"sinon": "8.1.1",
"start-server-and-test": "2.0.10",
"style-loader": "3.3.2",
"ts-jest": "27.1.5",
"ts-jest": "29.4.12",
"ts-node": "8.10.2",
"typescript": "5.6.3",
"typescript-eslint": "8.62.0",
Expand Down
5 changes: 3 additions & 2 deletions shell/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"@vue/cli-plugin-typescript": "~5.0.0",
"@vue/cli-service": "5.0.8",
"@vue/test-utils": "2.4.6",
"@vue/vue3-jest": "27.0.0",
"@vue/vue3-jest": "29.2.6",
"add": "2.0.6",
"ansi_up": "5.0.0",
"axios": "1.18.0",
Expand Down Expand Up @@ -90,7 +90,8 @@
"identicon.js": "2.3.3",
"intl-messageformat": "7.8.4",
"is-url": "1.2.4",
"jest": "27.5.1",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"jest-serializer-vue": "2.0.2",
"jexl": "2.3.0",
"jquery": "3.5.1",
Expand Down
Loading
Loading