2017-07-16 14:49:37 +03:00
|
|
|
"use strict";
|
|
|
|
|
2018-12-18 03:16:32 +03:00
|
|
|
const ENABLE_TEST_RESULTS = !!process.env.ENABLE_TEST_RESULTS;
|
|
|
|
const ENABLE_CODE_COVERAGE = !!process.env.ENABLE_CODE_COVERAGE;
|
2017-07-16 14:49:37 +03:00
|
|
|
|
2018-05-27 14:36:12 +03:00
|
|
|
const requiresPrettierInternals = [
|
|
|
|
"tests_integration/__tests__/util-shared.js",
|
|
|
|
"tests_integration/__tests__/help-options.js"
|
|
|
|
];
|
|
|
|
|
|
|
|
const semver = require("semver");
|
|
|
|
const isOldNode = semver.parse(process.version).major <= 4;
|
|
|
|
|
2017-07-16 14:49:37 +03:00
|
|
|
module.exports = {
|
|
|
|
setupFiles: ["<rootDir>/tests_config/run_spec.js"],
|
2018-08-09 05:21:00 +03:00
|
|
|
snapshotSerializers: [
|
2018-09-01 07:11:19 +03:00
|
|
|
"jest-snapshot-serializer-raw",
|
|
|
|
"jest-snapshot-serializer-ansi"
|
2018-08-09 05:21:00 +03:00
|
|
|
],
|
2017-07-16 14:49:37 +03:00
|
|
|
testRegex: "jsfmt\\.spec\\.js$|__tests__/.*\\.js$",
|
2018-12-08 13:28:29 +03:00
|
|
|
testPathIgnorePatterns: ["tests/new_react", "tests/more_react"].concat(
|
|
|
|
isOldNode ? requiresPrettierInternals : []
|
|
|
|
),
|
2018-12-18 03:16:32 +03:00
|
|
|
collectCoverage: ENABLE_CODE_COVERAGE,
|
2017-07-17 14:32:33 +03:00
|
|
|
collectCoverageFrom: ["src/**/*.js", "index.js", "!<rootDir>/node_modules/"],
|
2017-07-16 14:49:37 +03:00
|
|
|
coveragePathIgnorePatterns: [
|
2018-05-24 21:30:45 +03:00
|
|
|
"<rootDir>/standalone.js",
|
2018-04-25 19:29:35 +03:00
|
|
|
"<rootDir>/src/doc/doc-debug.js",
|
|
|
|
"<rootDir>/src/main/massage-ast.js"
|
2017-10-02 18:58:55 +03:00
|
|
|
],
|
2018-12-18 03:16:32 +03:00
|
|
|
coverageReporters: ["text", "html", "cobertura"],
|
2018-01-05 13:09:51 +03:00
|
|
|
moduleNameMapper: {
|
|
|
|
// Jest wires `fs` to `graceful-fs`, which causes a memory leak when
|
|
|
|
// `graceful-fs` does `require('fs')`.
|
|
|
|
// Ref: https://github.com/facebook/jest/issues/2179#issuecomment-355231418
|
2018-05-24 21:30:45 +03:00
|
|
|
// If this is removed, see also scripts/build/build.js.
|
2018-05-27 14:36:12 +03:00
|
|
|
"graceful-fs": "<rootDir>/tests_config/fs.js",
|
|
|
|
|
2018-06-12 21:05:40 +03:00
|
|
|
"prettier/local": "<rootDir>/tests_config/require_prettier.js",
|
|
|
|
"prettier/standalone": "<rootDir>/tests_config/require_standalone.js"
|
2018-01-05 13:09:51 +03:00
|
|
|
},
|
2018-07-03 09:06:29 +03:00
|
|
|
testEnvironment: "node",
|
2018-07-04 22:54:39 +03:00
|
|
|
transform: {},
|
|
|
|
watchPlugins: [
|
|
|
|
"jest-watch-typeahead/filename",
|
|
|
|
"jest-watch-typeahead/testname"
|
2018-07-07 19:11:04 +03:00
|
|
|
],
|
2018-12-18 03:16:32 +03:00
|
|
|
reporters: ["default"].concat(ENABLE_TEST_RESULTS ? "jest-junit" : [])
|
2017-07-16 14:49:37 +03:00
|
|
|
};
|