UNPKG

836 BJavaScriptView Raw
1"use strict";
2
3// @ts-check
4const path = require("path");
5
6const {
7 testMatch,
8 testIgnores
9} = require("./jest.patterns");
10
11const {
12 hasFile,
13 hasPkgProp
14} = require("../utils");
15
16const here = p => path.join(__dirname, p);
17
18const useBuiltInBabelConfig = !hasFile(".babelrc") && !hasPkgProp("babel");
19const 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
29if (useBuiltInBabelConfig) {
30 jestConfig.transform = {
31 "^.+\\.(j|t)s$": here("./babel-transform")
32 };
33}
34
35module.exports = jestConfig;
36//# sourceMappingURL=jest.config.js.map
\No newline at end of file