2017-07-16 21:49:37 +10:00
|
|
|
"use strict";
|
2020-04-18 01:24:22 +08:00
|
|
|
|
|
|
|
|
const installPrettier = require("./scripts/install-prettier");
|
|
|
|
|
|
2018-12-18 08:16:32 +08:00
|
|
|
const ENABLE_CODE_COVERAGE = !!process.env.ENABLE_CODE_COVERAGE;
|
2020-04-23 10:37:09 +08:00
|
|
|
if (process.env.NODE_ENV === "production" || process.env.INSTALL_PACKAGE) {
|
2020-04-18 01:24:22 +08:00
|
|
|
process.env.PRETTIER_DIR = installPrettier();
|
|
|
|
|
}
|
2017-07-16 21:49:37 +10:00
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
|
setupFiles: ["<rootDir>/tests_config/run_spec.js"],
|
2018-08-09 10:21:00 +08:00
|
|
|
snapshotSerializers: [
|
2018-09-01 12:11:19 +08:00
|
|
|
"jest-snapshot-serializer-raw",
|
2020-03-21 22:07:52 +02:00
|
|
|
"jest-snapshot-serializer-ansi",
|
2018-08-09 10:21:00 +08:00
|
|
|
],
|
2017-07-16 21:49:37 +10:00
|
|
|
testRegex: "jsfmt\\.spec\\.js$|__tests__/.*\\.js$",
|
2018-12-18 08:16:32 +08:00
|
|
|
collectCoverage: ENABLE_CODE_COVERAGE,
|
2017-07-17 21:32:33 +10:00
|
|
|
collectCoverageFrom: ["src/**/*.js", "index.js", "!<rootDir>/node_modules/"],
|
2017-07-16 21:49:37 +10:00
|
|
|
coveragePathIgnorePatterns: [
|
2018-05-24 15:30:45 -03:00
|
|
|
"<rootDir>/standalone.js",
|
2020-03-26 23:02:43 +08:00
|
|
|
"<rootDir>/src/document/doc-debug.js",
|
2020-03-21 22:07:52 +02:00
|
|
|
"<rootDir>/src/main/massage-ast.js",
|
2017-10-02 17:58:55 +02:00
|
|
|
],
|
2020-03-23 17:56:02 +08:00
|
|
|
coverageReporters: ["text", "lcov"],
|
2018-01-05 21:09:51 +11:00
|
|
|
moduleNameMapper: {
|
2018-06-12 15:05:40 -03:00
|
|
|
"prettier/local": "<rootDir>/tests_config/require_prettier.js",
|
2020-03-21 22:07:52 +02:00
|
|
|
"prettier/standalone": "<rootDir>/tests_config/require_standalone.js",
|
2018-01-05 21:09:51 +11:00
|
|
|
},
|
2018-07-03 08:06:29 +02:00
|
|
|
testEnvironment: "node",
|
2018-07-04 21:54:39 +02:00
|
|
|
transform: {},
|
|
|
|
|
watchPlugins: [
|
|
|
|
|
"jest-watch-typeahead/filename",
|
2020-03-21 22:07:52 +02:00
|
|
|
"jest-watch-typeahead/testname",
|
2018-07-07 12:11:04 -04:00
|
|
|
],
|
2017-07-16 21:49:37 +10:00
|
|
|
};
|