process.env.TZ = 'UTC'; module.exports = { preset: 'ts-jest', testEnvironment: 'jsdom', setupFilesAfterEnv: ['./jest.setup.js'], watchman: false, // tell Jest to handle `*.vue` files moduleFileExtensions: ['js', 'json', 'vue', 'ts'], // Paths // NOTE: Docs configuration does not work for our environment // https://kulshekhar.github.io/ts-jest/docs/27.1/getting-started/paths-mapping#jest-config-with-helper modulePaths: [''], moduleNameMapper: { '^~/(.*)$': '/$1', '^~~/(.*)$': '/$1', '^@/(.*)$': '/$1', '@shell/(.*)': '/shell/$1', '@pkg/(.*)': '/pkg/$1', '@components/(.*)': '/pkg/rancher-components/src/components/$1', '\\.(jpe?g|png|gif|webp|svg|mp4|webm|ogg|mp3|wav|flac|aac|woff2?|eot|ttf|otf)$': '/svgTransform.js', }, modulePathIgnorePatterns: [ '/cypress/', '/scripts/', '/docusaurus/', '/stories/', '/shell/scripts/', '/drone', ], testPathIgnorePatterns: [ '/node_modules/', '(/.*)*/__tests__/utils/', ], // Babel transform: { '^.+\\.js$': '/node_modules/babel-jest', // process js with `babel-jest` '.*\\.(vue)$': '/node_modules/@vue/vue3-jest', // process `*.vue` files with `vue-jest` '^.+\\.vue$': './vue3JestRegisterTs.js', // point to a different transformer than vue-jest and call registerTs before exporting vue-jest '^.+\\.tsx?$': 'ts-jest', // process `*.ts` files with `ts-jest` '^.+\\.svg$': '/svgTransform.js' // to mock `*.svg` files }, snapshotSerializers: ['/node_modules/jest-serializer-vue'], // Coverage coverageProvider: 'v8', coverageDirectory: '/coverage/unit', coverageReporters: ['json', 'text-summary', 'html'], collectCoverage: false, collectCoverageFrom: [ '/shell/**/*.{vue,ts,js}', '/pkg/rancher-components/src/components/**/*.{vue,ts,js}', '!/shell/scripts/', ], coveragePathIgnorePatterns: [ '\\.d\\.ts' ], // Globals globals: { 'ts-jest': { isolatedModules: true } }, };