-
Notifications
You must be signed in to change notification settings - Fork 0
/
jest.config.ts
48 lines (45 loc) · 1.09 KB
/
jest.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import type { Config as JestConfig } from "jest";
/**
* Test coverage options.
*/
const coverageOptions: Pick<
JestConfig,
| "collectCoverage"
| "coverageDirectory"
| "coveragePathIgnorePatterns"
| "coverageProvider"
| "coverageReporters"
| "coverageThreshold"
| "collectCoverageFrom"
| "forceCoverageMatch"
> = {
coverageProvider: "v8",
collectCoverageFrom: ["<rootDir>/src/**/*.tsx"],
};
/**
* Jest configuration.
* @see https://jestjs.io/docs/configuration
*/
const jestConfig: JestConfig = {
// throw error on deprecated API usage
errorOnDeprecated: true,
modulePaths: ["<rootDir>/src"],
transform: {
// run tests with`@swc/jest`: https://swc.rs/docs/usage/jest
"^.+\\.(mjs|ts|tsx)$": [
"@swc/jest",
{
jsc: {
transform: {
react: {
// enable support for React 17 JSX transform: https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html
runtime: "automatic",
},
},
},
},
],
},
...coverageOptions,
};
export default jestConfig;