-
Notifications
You must be signed in to change notification settings - Fork 3
/
jest.config.js
47 lines (44 loc) · 1.3 KB
/
jest.config.js
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
// @ts-check
/** @typedef {import("@jest/types").Config.InitialOptions} InitialOptions */
/** @type {InitialOptions} */
const config = {
fakeTimers: {
enableGlobally: true,
},
moduleNameMapper: {
// 29 major semvers and Jest still doesn't fully support ESM or nodejs's package.json
// resolution algorithm.
// This issue on module resolution is closed because a user published a broken npm module
// which doesn't work and no one complained for 30 days so it expired.
// https://github.com/facebook/jest/issues/9771
// Also being tracked here:
// https://github.com/facebook/jest/issues/9430
// https://github.com/facebook/jest/labels/ES%20Modules
// They don't support file extensions which are *required* by modern resolution algorithms
"^(\\..+)\\.js$": "$1",
},
testPathIgnorePatterns: [
"\\/__fixtures__\\/",
"\\/dist\\/",
"\\/node_modules\\/",
],
testRegex: [
"\\/__tests__\\/",
],
extensionsToTreatAsEsm: [ ".ts" ],
transform: {
"\\.m?ts$": [
"babel-jest", {
plugins: [
"babel-plugin-transform-import-meta",
"@babel/plugin-proposal-explicit-resource-management",
],
presets: [
[ "@babel/preset-env", { targets: { node: "current" } } ],
[ "@babel/preset-typescript", { allowDeclareFields: true } ],
],
},
],
},
};
export default config;