1 | 'use strict';
|
2 |
|
3 | Object.defineProperty(exports, '__esModule', {
|
4 | value: true
|
5 | });
|
6 | exports.default = void 0;
|
7 |
|
8 | function _jestRegexUtil() {
|
9 | const data = require('jest-regex-util');
|
10 |
|
11 | _jestRegexUtil = function () {
|
12 | return data;
|
13 | };
|
14 |
|
15 | return data;
|
16 | }
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 | var _default = (globalConfig, options = {}) => {
|
25 | const newConfig = {...globalConfig};
|
26 |
|
27 | if (options.mode === 'watch') {
|
28 | newConfig.watch = true;
|
29 | newConfig.watchAll = false;
|
30 | } else if (options.mode === 'watchAll') {
|
31 | newConfig.watch = false;
|
32 | newConfig.watchAll = true;
|
33 | }
|
34 |
|
35 | if (options.testNamePattern !== undefined) {
|
36 | newConfig.testNamePattern = options.testNamePattern || '';
|
37 | }
|
38 |
|
39 | if (options.testPathPattern !== undefined) {
|
40 | newConfig.testPathPattern =
|
41 | (0, _jestRegexUtil().replacePathSepForRegex)(options.testPathPattern) ||
|
42 | '';
|
43 | }
|
44 |
|
45 | newConfig.onlyChanged =
|
46 | !newConfig.watchAll &&
|
47 | !newConfig.testNamePattern &&
|
48 | !newConfig.testPathPattern;
|
49 |
|
50 | if (typeof options.bail === 'boolean') {
|
51 | newConfig.bail = options.bail ? 1 : 0;
|
52 | } else if (options.bail !== undefined) {
|
53 | newConfig.bail = options.bail;
|
54 | }
|
55 |
|
56 | if (options.changedSince !== undefined) {
|
57 | newConfig.changedSince = options.changedSince;
|
58 | }
|
59 |
|
60 | if (options.collectCoverage !== undefined) {
|
61 | newConfig.collectCoverage = options.collectCoverage || false;
|
62 | }
|
63 |
|
64 | if (options.collectCoverageFrom !== undefined) {
|
65 | newConfig.collectCoverageFrom = options.collectCoverageFrom;
|
66 | }
|
67 |
|
68 | if (options.collectCoverageOnlyFrom !== undefined) {
|
69 | newConfig.collectCoverageOnlyFrom = options.collectCoverageOnlyFrom;
|
70 | }
|
71 |
|
72 | if (options.coverageDirectory !== undefined) {
|
73 | newConfig.coverageDirectory = options.coverageDirectory;
|
74 | }
|
75 |
|
76 | if (options.coverageReporters !== undefined) {
|
77 | newConfig.coverageReporters = options.coverageReporters;
|
78 | }
|
79 |
|
80 | if (options.findRelatedTests !== undefined) {
|
81 | newConfig.findRelatedTests = options.findRelatedTests;
|
82 | }
|
83 |
|
84 | if (options.nonFlagArgs !== undefined) {
|
85 | newConfig.nonFlagArgs = options.nonFlagArgs;
|
86 | }
|
87 |
|
88 | if (options.noSCM) {
|
89 | newConfig.noSCM = true;
|
90 | }
|
91 |
|
92 | if (options.notify !== undefined) {
|
93 | newConfig.notify = options.notify || false;
|
94 | }
|
95 |
|
96 | if (options.notifyMode !== undefined) {
|
97 | newConfig.notifyMode = options.notifyMode;
|
98 | }
|
99 |
|
100 | if (options.onlyFailures !== undefined) {
|
101 | newConfig.onlyFailures = options.onlyFailures || false;
|
102 | }
|
103 |
|
104 | if (options.passWithNoTests !== undefined) {
|
105 | newConfig.passWithNoTests = true;
|
106 | }
|
107 |
|
108 | if (options.reporters !== undefined) {
|
109 | newConfig.reporters = options.reporters;
|
110 | }
|
111 |
|
112 | if (options.updateSnapshot !== undefined) {
|
113 | newConfig.updateSnapshot = options.updateSnapshot;
|
114 | }
|
115 |
|
116 | if (options.verbose !== undefined) {
|
117 | newConfig.verbose = options.verbose || false;
|
118 | }
|
119 |
|
120 | return Object.freeze(newConfig);
|
121 | };
|
122 |
|
123 | exports.default = _default;
|