1 | "use strict";
|
2 |
|
3 |
|
4 | const path = require("path");
|
5 |
|
6 | const {
|
7 | testMatch,
|
8 | testIgnores
|
9 | } = require("./jest.patterns");
|
10 |
|
11 | const {
|
12 | hasFile,
|
13 | hasPkgProp
|
14 | } = require("../utils");
|
15 |
|
16 | const here = p => path.join(__dirname, p);
|
17 |
|
18 | const useBuiltInBabelConfig = !hasFile(".babelrc") && !hasPkgProp("babel");
|
19 | const jestConfig = {
|
20 | testEnvironment: "node",
|
21 | moduleFileExtensions: ["js", "json", "ts"],
|
22 | collectCoverageFrom: ["src/**/*.+(js|ts)"],
|
23 | testMatch,
|
24 | testPathIgnorePatterns: [...testIgnores],
|
25 | coveragePathIgnorePatterns: [...testIgnores, "src/(umd|cjs|esm)-entry.js$"],
|
26 | transformIgnorePatterns: ["[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"]
|
27 | };
|
28 |
|
29 | if (useBuiltInBabelConfig) {
|
30 | jestConfig.transform = {
|
31 | "^.+\\.(j|t)s$": here("./babel-transform")
|
32 | };
|
33 | }
|
34 |
|
35 | module.exports = jestConfig;
|
36 |
|
\ | No newline at end of file |