| 1 | import path from "path"; |
| 2 | import { fileURLToPath } from "url"; |
| 3 | |
| 4 | export default { |
| 5 | transform: { |
| 6 | "^.+\\.(ts|js)$": [ |
| 7 | "ts-jest", |
| 8 | { |
| 9 | useESM: true, |
| 10 | isolatedModules: true, |
| 11 | tsconfig: { |
| 12 | experimentalDecorators: true, |
| 13 | emitDecoratorMetadata: true, |
| 14 | }, |
| 15 | }, |
| 16 | ], |
| 17 | }, |
| 18 | moduleNameMapper: { |
| 19 | "^(\\.{1,2}/.*)\\.js$": "$1", |
| 20 | "^uuid$": "uuid", // https://stackoverflow.com/a/73626360 |
| 21 | "^@azure/(.*)$": "<rootDir>/node_modules/@azure/$1", |
| 22 | "^mssql$": "<rootDir>/node_modules/mssql", |
| 23 | }, |
| 24 | extensionsToTreatAsEsm: [".ts"], |
| 25 | preset: "ts-jest/presets/default-esm", |
| 26 | testTimeout: 10000, |
| 27 | testEnvironment: "node", |
| 28 | globals: { |
| 29 | __dirname: path.dirname(fileURLToPath(import.meta.url)), |
| 30 | __filename: path.resolve(fileURLToPath(import.meta.url)), |
| 31 | }, |
| 32 | // collectCoverage: true, |
| 33 | collectCoverageFrom: [ |
| 34 | "**/*.{js,ts}", // Adjust this pattern to match files you want coverage for |
| 35 | "!**/node_modules/**", // Exclude node_modules |
| 36 | "!**/vendor/**", |
| 37 | // "!**/autocomplete/context/root-path-context/test/files/**", |
| 38 | ], |
| 39 | globalSetup: "<rootDir>/test/jest.global-setup.ts", |
| 40 | setupFilesAfterEnv: ["<rootDir>/test/jest.setup-after-env.js"], |
| 41 | maxWorkers: 1, // equivalent to CLI --runInBand |
| 42 | testMatch: ["**/*.test.ts"], |
| 43 | }; |