|
1 | | -/** @type {import('@jest/types').Config.InitialOptions} */ |
2 | | -module.exports = { |
| 1 | +import type { Config } from "jest"; |
| 2 | + |
| 3 | +const config: Config = { |
3 | 4 | testEnvironment: "jsdom", |
4 | 5 | transform: { |
5 | | - "^.+\\.(t|j)sx?$": ["@swc/jest"], |
| 6 | + "^.+\\.(t|j)sx?$": "@swc/jest", |
6 | 7 | }, |
| 8 | + setupFilesAfterEnv: ["<rootDir>/testSetup/init.ts"], |
7 | 9 | moduleNameMapper: { |
8 | 10 | // https://github.com/microsoft/accessibility-insights-web/pull/5421#issuecomment-1109168149 |
9 | 11 | "^nanoid": require.resolve("nanoid"), |
10 | 12 | "\\.scss$": "identity-obj-proxy", |
11 | 13 | }, |
12 | | - setupFilesAfterEnv: ["<rootDir>/testSetup/init.ts"], |
13 | | - collectCoverageFrom: [ |
14 | | - "<rootDir>/src/**/*.{ts,tsx}", |
15 | | - "!<rootDir>/src/index.ts", |
16 | | - ], |
| 14 | + |
| 15 | + testPathIgnorePatterns: ["/node_modules/", "/cypress/"], |
| 16 | + |
17 | 17 | watchPlugins: [ |
18 | 18 | "jest-watch-typeahead/filename", |
19 | 19 | "jest-watch-typeahead/testname", |
20 | 20 | ], |
21 | | - testPathIgnorePatterns: ["/node_modules/", "/cypress/"], |
| 21 | + |
| 22 | + // this is required to get the correct line coverage when using swc for some |
| 23 | + // reason. |
| 24 | + coverageProvider: "v8", |
| 25 | + |
| 26 | + collectCoverageFrom: [ |
| 27 | + "<rootDir>/src/**/*.{ts,tsx}", |
| 28 | + "!<rootDir>/src/index.ts", |
| 29 | + ], |
22 | 30 | }; |
| 31 | + |
| 32 | +export default config; |
0 commit comments