vitest 2.0.0-beta.1 → 2.0.0-beta.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +1 -1
- package/dist/browser.d.ts +22 -2
- package/dist/browser.js +5 -3
- package/dist/chunks/{integrations-globals.B5Jl0grA.js → integrations-globals.CC2ed6Py.js} +9 -9
- package/dist/chunks/{node-git.CCI8evVZ.js → node-git.ZtkbKc8u.js} +14 -15
- package/dist/chunks/{runtime-console.CUES-L8X.js → runtime-console.Ckl0vEQr.js} +76 -31
- package/dist/chunks/{runtime-runBaseTests._dXkRAZc.js → runtime-runBaseTests.BXW_BJeO.js} +40 -32
- package/dist/cli.js +3 -3
- package/dist/config.cjs +43 -20
- package/dist/config.d.ts +2 -2
- package/dist/config.js +43 -21
- package/dist/coverage.d.ts +4 -4
- package/dist/coverage.js +125 -37
- package/dist/environments.d.ts +1 -1
- package/dist/environments.js +1 -1
- package/dist/execute.d.ts +2 -2
- package/dist/execute.js +2 -2
- package/dist/index.d.ts +20 -30
- package/dist/index.js +9 -9
- package/dist/node.d.ts +22 -9
- package/dist/node.js +25 -15
- package/dist/path.js +4 -1
- package/dist/{reporters-MGvT5U9f.d.ts → reporters-fiIq_dT9.d.ts} +310 -148
- package/dist/reporters.d.ts +1 -1
- package/dist/reporters.js +8 -8
- package/dist/runners.d.ts +4 -2
- package/dist/runners.js +103 -57
- package/dist/{suite-8WAe-urM.d.ts → suite-D4aoU9rI.d.ts} +1 -1
- package/dist/suite.d.ts +2 -2
- package/dist/suite.js +2 -2
- package/dist/utils.d.ts +1 -5
- package/dist/utils.js +1 -6
- package/dist/vendor/{base.VFkIJ66g.js → base.C2DbLEfT.js} +4 -3
- package/dist/vendor/{base._gnK9Slw.js → base.CTYV4Gnz.js} +24 -17
- package/dist/vendor/{benchmark.BNLebNi5.js → benchmark.CMp8QfyL.js} +13 -14
- package/dist/vendor/{cac.DzKZaJu2.js → cac.BcJW7n2j.js} +127 -51
- package/dist/vendor/{cli-api.DTeni0Qq.js → cli-api.C8t8m4__.js} +2771 -1711
- package/dist/vendor/{constants.5SOfHUj0.js → constants.BWsVtsAj.js} +6 -22
- package/dist/vendor/{coverage.ChSqD-qS.js → coverage.BhYSDdTT.js} +27 -11
- package/dist/vendor/{date.BKM1wewY.js → date.W2xKR2qe.js} +5 -3
- package/dist/vendor/{execute.CLLNVNnK.js → execute.T3gg2ZK6.js} +177 -63
- package/dist/vendor/{index.BfoZyXD1.js → index.-dbR4KUi.js} +17 -9
- package/dist/vendor/{index.CRxYS9H3.js → index.BC5zhX9y.js} +1201 -491
- package/dist/vendor/{index.DP-km6lF.js → index.BMmMjLIQ.js} +64 -51
- package/dist/vendor/{index._7XLd8Kd.js → index.C9Thslzw.js} +2 -1
- package/dist/vendor/{index.CmILuxzC.js → index.CQJ2m700.js} +3 -3
- package/dist/vendor/{index.DeR1hhfY.js → index.D4nqnQWz.js} +71 -74
- package/dist/vendor/{rpc.DRDE9Pu1.js → rpc.BGx7q_k2.js} +30 -19
- package/dist/vendor/{run-once.DLomgGUH.js → run-once.Db8Hgq9X.js} +2 -1
- package/dist/vendor/{setup-common.XeoZAW8t.js → setup-common.uqZOEWuR.js} +30 -15
- package/dist/vendor/spy.Cf_4R5Oe.js +22 -0
- package/dist/vendor/{tasks.WC7M-K-v.js → tasks.DhVtQBtW.js} +3 -1
- package/dist/vendor/{utils.D5gGkwyH.js → utils.DSO2UK15.js} +41 -26
- package/dist/vendor/{utils.CUjzkRH7.js → utils.DkxLWvS1.js} +12 -5
- package/dist/vendor/{vi.ClD3hi7L.js → vi.BPjl8cAZ.js} +350 -166
- package/dist/vendor/{vm.Bi3bljci.js → vm.CycSoHnJ.js} +151 -86
- package/dist/worker.js +31 -15
- package/dist/workers/forks.js +4 -4
- package/dist/workers/runVmTests.js +14 -13
- package/dist/workers/threads.js +4 -4
- package/dist/workers/vmForks.js +6 -6
- package/dist/workers/vmThreads.js +6 -6
- package/dist/workers.d.ts +2 -2
- package/dist/workers.js +9 -9
- package/package.json +22 -22
- package/suppress-warnings.cjs +2 -4
|
@@ -16,8 +16,9 @@ function withSafeTimers(fn) {
|
|
|
16
16
|
globalThis.clearTimeout = clearTimeout;
|
|
17
17
|
globalThis.setImmediate = setImmediate;
|
|
18
18
|
globalThis.clearImmediate = clearImmediate;
|
|
19
|
-
if (globalThis.process)
|
|
19
|
+
if (globalThis.process) {
|
|
20
20
|
globalThis.process.nextTick = nextTick;
|
|
21
|
+
}
|
|
21
22
|
const result = fn();
|
|
22
23
|
return result;
|
|
23
24
|
} finally {
|
|
@@ -34,8 +35,9 @@ function withSafeTimers(fn) {
|
|
|
34
35
|
}
|
|
35
36
|
const promises = /* @__PURE__ */ new Set();
|
|
36
37
|
async function rpcDone() {
|
|
37
|
-
if (!promises.size)
|
|
38
|
+
if (!promises.size) {
|
|
38
39
|
return;
|
|
40
|
+
}
|
|
39
41
|
const awaitable = Array.from(promises);
|
|
40
42
|
return Promise.all(awaitable);
|
|
41
43
|
}
|
|
@@ -45,24 +47,33 @@ function createRuntimeRpc(options) {
|
|
|
45
47
|
const onCancel = new Promise((resolve) => {
|
|
46
48
|
setCancel = resolve;
|
|
47
49
|
});
|
|
48
|
-
const rpc2 = createSafeRpc(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
{
|
|
53
|
-
eventNames: ["onUserConsoleLog", "onFinished", "onCollected", "onCancel"],
|
|
54
|
-
onTimeoutError(functionName, args) {
|
|
55
|
-
var _a;
|
|
56
|
-
let message = `[vitest-worker]: Timeout calling "${functionName}"`;
|
|
57
|
-
if (functionName === "fetch" || functionName === "transform" || functionName === "resolveId")
|
|
58
|
-
message += ` with "${JSON.stringify(args)}"`;
|
|
59
|
-
if (functionName === "onUnhandledError")
|
|
60
|
-
message += ` with "${((_a = args[0]) == null ? void 0 : _a.message) || args[0]}"`;
|
|
61
|
-
throw new Error(message);
|
|
50
|
+
const rpc2 = createSafeRpc(
|
|
51
|
+
createBirpc(
|
|
52
|
+
{
|
|
53
|
+
onCancel: setCancel
|
|
62
54
|
},
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
{
|
|
56
|
+
eventNames: [
|
|
57
|
+
"onUserConsoleLog",
|
|
58
|
+
"onFinished",
|
|
59
|
+
"onCollected",
|
|
60
|
+
"onCancel"
|
|
61
|
+
],
|
|
62
|
+
onTimeoutError(functionName, args) {
|
|
63
|
+
var _a;
|
|
64
|
+
let message = `[vitest-worker]: Timeout calling "${functionName}"`;
|
|
65
|
+
if (functionName === "fetch" || functionName === "transform" || functionName === "resolveId") {
|
|
66
|
+
message += ` with "${JSON.stringify(args)}"`;
|
|
67
|
+
}
|
|
68
|
+
if (functionName === "onUnhandledError") {
|
|
69
|
+
message += ` with "${((_a = args[0]) == null ? void 0 : _a.message) || args[0]}"`;
|
|
70
|
+
}
|
|
71
|
+
throw new Error(message);
|
|
72
|
+
},
|
|
73
|
+
...options
|
|
74
|
+
}
|
|
75
|
+
)
|
|
76
|
+
);
|
|
66
77
|
return {
|
|
67
78
|
rpc: rpc2,
|
|
68
79
|
onCancel
|
|
@@ -1,51 +1,66 @@
|
|
|
1
1
|
import { setSafeTimers } from '@vitest/utils';
|
|
2
2
|
import { addSerializer } from '@vitest/snapshot';
|
|
3
|
-
import { r as resetRunOnceCounter } from './run-once.
|
|
3
|
+
import { r as resetRunOnceCounter } from './run-once.Db8Hgq9X.js';
|
|
4
4
|
|
|
5
5
|
let globalSetup = false;
|
|
6
6
|
async function setupCommonEnv(config) {
|
|
7
7
|
resetRunOnceCounter();
|
|
8
8
|
setupDefines(config.defines);
|
|
9
9
|
setupEnv(config.env);
|
|
10
|
-
if (globalSetup)
|
|
10
|
+
if (globalSetup) {
|
|
11
11
|
return;
|
|
12
|
+
}
|
|
12
13
|
globalSetup = true;
|
|
13
14
|
setSafeTimers();
|
|
14
|
-
if (config.globals)
|
|
15
|
-
(await import('../chunks/integrations-globals.
|
|
15
|
+
if (config.globals) {
|
|
16
|
+
(await import('../chunks/integrations-globals.CC2ed6Py.js')).registerApiGlobally();
|
|
17
|
+
}
|
|
16
18
|
}
|
|
17
19
|
function setupDefines(defines) {
|
|
18
|
-
for (const key in defines)
|
|
20
|
+
for (const key in defines) {
|
|
19
21
|
globalThis[key] = defines[key];
|
|
22
|
+
}
|
|
20
23
|
}
|
|
21
24
|
function setupEnv(env) {
|
|
22
|
-
if (typeof process === "undefined")
|
|
25
|
+
if (typeof process === "undefined") {
|
|
23
26
|
return;
|
|
27
|
+
}
|
|
24
28
|
const { PROD, DEV, ...restEnvs } = env;
|
|
25
29
|
process.env.PROD = PROD ? "1" : "";
|
|
26
30
|
process.env.DEV = DEV ? "1" : "";
|
|
27
|
-
for (const key in restEnvs)
|
|
31
|
+
for (const key in restEnvs) {
|
|
28
32
|
process.env[key] = env[key];
|
|
33
|
+
}
|
|
29
34
|
}
|
|
30
35
|
async function loadDiffConfig(config, executor) {
|
|
31
|
-
if (typeof config.diff !== "string")
|
|
36
|
+
if (typeof config.diff !== "string") {
|
|
32
37
|
return;
|
|
38
|
+
}
|
|
33
39
|
const diffModule = await executor.executeId(config.diff);
|
|
34
|
-
if (diffModule && typeof diffModule.default === "object" && diffModule.default != null)
|
|
40
|
+
if (diffModule && typeof diffModule.default === "object" && diffModule.default != null) {
|
|
35
41
|
return diffModule.default;
|
|
36
|
-
else
|
|
37
|
-
throw new Error(
|
|
42
|
+
} else {
|
|
43
|
+
throw new Error(
|
|
44
|
+
`invalid diff config file ${config.diff}. Must have a default export with config object`
|
|
45
|
+
);
|
|
46
|
+
}
|
|
38
47
|
}
|
|
39
48
|
async function loadSnapshotSerializers(config, executor) {
|
|
40
49
|
const files = config.snapshotSerializers;
|
|
41
50
|
const snapshotSerializers = await Promise.all(
|
|
42
51
|
files.map(async (file) => {
|
|
43
52
|
const mo = await executor.executeId(file);
|
|
44
|
-
if (!mo || typeof mo.default !== "object" || mo.default === null)
|
|
45
|
-
throw new Error(
|
|
53
|
+
if (!mo || typeof mo.default !== "object" || mo.default === null) {
|
|
54
|
+
throw new Error(
|
|
55
|
+
`invalid snapshot serializer file ${file}. Must export a default object`
|
|
56
|
+
);
|
|
57
|
+
}
|
|
46
58
|
const config2 = mo.default;
|
|
47
|
-
if (typeof config2.test !== "function" || typeof config2.serialize !== "function" && typeof config2.print !== "function")
|
|
48
|
-
throw new
|
|
59
|
+
if (typeof config2.test !== "function" || typeof config2.serialize !== "function" && typeof config2.print !== "function") {
|
|
60
|
+
throw new TypeError(
|
|
61
|
+
`invalid snapshot serializer in ${file}. Must have a 'test' method along with either a 'serialize' or 'print' method.`
|
|
62
|
+
);
|
|
63
|
+
}
|
|
49
64
|
return config2;
|
|
50
65
|
})
|
|
51
66
|
);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as spy$1 from '@vitest/spy';
|
|
2
|
+
|
|
3
|
+
function _mergeNamespaces(n, m) {
|
|
4
|
+
m.forEach(function (e) {
|
|
5
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
6
|
+
if (k !== 'default' && !(k in n)) {
|
|
7
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
8
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
9
|
+
enumerable: true,
|
|
10
|
+
get: function () { return e[k]; }
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
return Object.freeze(n);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
var spy = /*#__PURE__*/_mergeNamespaces({
|
|
19
|
+
__proto__: null
|
|
20
|
+
}, [spy$1]);
|
|
21
|
+
|
|
22
|
+
export { spy as s };
|
|
@@ -4,7 +4,9 @@ import '@vitest/utils';
|
|
|
4
4
|
function hasFailedSnapshot(suite) {
|
|
5
5
|
return getTests(suite).some((s) => {
|
|
6
6
|
var _a, _b;
|
|
7
|
-
return (_b = (_a = s.result) == null ? void 0 : _a.errors) == null ? void 0 : _b.some(
|
|
7
|
+
return (_b = (_a = s.result) == null ? void 0 : _a.errors) == null ? void 0 : _b.some(
|
|
8
|
+
(e) => typeof (e == null ? void 0 : e.message) === "string" && e.message.match(/Snapshot .* mismatched/)
|
|
9
|
+
);
|
|
8
10
|
});
|
|
9
11
|
}
|
|
10
12
|
function getFullName(task, separator = " > ") {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isAbsolute, relative, dirname, basename } from 'pathe';
|
|
2
2
|
import c from 'picocolors';
|
|
3
|
-
import { a as slash } from './base.
|
|
3
|
+
import { a as slash } from './base.CTYV4Gnz.js';
|
|
4
4
|
|
|
5
5
|
const F_RIGHT = "\u2192";
|
|
6
6
|
const F_DOWN = "\u2193";
|
|
@@ -40,8 +40,9 @@ const skipped = c.dim(c.gray(F_DOWN));
|
|
|
40
40
|
function getCols(delta = 0) {
|
|
41
41
|
var _a;
|
|
42
42
|
let length = (_a = process.stdout) == null ? void 0 : _a.columns;
|
|
43
|
-
if (!length || Number.isNaN(length))
|
|
43
|
+
if (!length || Number.isNaN(length)) {
|
|
44
44
|
length = 30;
|
|
45
|
+
}
|
|
45
46
|
return Math.max(length + delta, 0);
|
|
46
47
|
}
|
|
47
48
|
function divider(text, left, right) {
|
|
@@ -62,8 +63,9 @@ function divider(text, left, right) {
|
|
|
62
63
|
}
|
|
63
64
|
function formatTestPath(root, path) {
|
|
64
65
|
var _a;
|
|
65
|
-
if (isAbsolute(path))
|
|
66
|
+
if (isAbsolute(path)) {
|
|
66
67
|
path = relative(root, path);
|
|
68
|
+
}
|
|
67
69
|
const dir = dirname(path);
|
|
68
70
|
const ext = ((_a = path.match(/(\.(spec|test)\.[cm]?[tj]sx?)$/)) == null ? void 0 : _a[0]) || "";
|
|
69
71
|
const base = basename(path, ext);
|
|
@@ -71,17 +73,23 @@ function formatTestPath(root, path) {
|
|
|
71
73
|
}
|
|
72
74
|
function renderSnapshotSummary(rootDir, snapshots) {
|
|
73
75
|
const summary = [];
|
|
74
|
-
if (snapshots.added)
|
|
76
|
+
if (snapshots.added) {
|
|
75
77
|
summary.push(c.bold(c.green(`${snapshots.added} written`)));
|
|
76
|
-
|
|
78
|
+
}
|
|
79
|
+
if (snapshots.unmatched) {
|
|
77
80
|
summary.push(c.bold(c.red(`${snapshots.unmatched} failed`)));
|
|
78
|
-
|
|
81
|
+
}
|
|
82
|
+
if (snapshots.updated) {
|
|
79
83
|
summary.push(c.bold(c.green(`${snapshots.updated} updated `)));
|
|
84
|
+
}
|
|
80
85
|
if (snapshots.filesRemoved) {
|
|
81
|
-
if (snapshots.didUpdate)
|
|
86
|
+
if (snapshots.didUpdate) {
|
|
82
87
|
summary.push(c.bold(c.green(`${snapshots.filesRemoved} files removed `)));
|
|
83
|
-
else
|
|
84
|
-
summary.push(
|
|
88
|
+
} else {
|
|
89
|
+
summary.push(
|
|
90
|
+
c.bold(c.yellow(`${snapshots.filesRemoved} files obsolete `))
|
|
91
|
+
);
|
|
92
|
+
}
|
|
85
93
|
}
|
|
86
94
|
if (snapshots.filesRemovedList && snapshots.filesRemovedList.length) {
|
|
87
95
|
const [head, ...tail] = snapshots.filesRemovedList;
|
|
@@ -91,13 +99,21 @@ function renderSnapshotSummary(rootDir, snapshots) {
|
|
|
91
99
|
});
|
|
92
100
|
}
|
|
93
101
|
if (snapshots.unchecked) {
|
|
94
|
-
if (snapshots.didUpdate)
|
|
102
|
+
if (snapshots.didUpdate) {
|
|
95
103
|
summary.push(c.bold(c.green(`${snapshots.unchecked} removed`)));
|
|
96
|
-
else
|
|
104
|
+
} else {
|
|
97
105
|
summary.push(c.bold(c.yellow(`${snapshots.unchecked} obsolete`)));
|
|
106
|
+
}
|
|
98
107
|
snapshots.uncheckedKeysByFile.forEach((uncheckedFile) => {
|
|
99
|
-
summary.push(
|
|
100
|
-
|
|
108
|
+
summary.push(
|
|
109
|
+
`${c.gray(F_DOWN_RIGHT)} ${formatTestPath(
|
|
110
|
+
rootDir,
|
|
111
|
+
uncheckedFile.filePath
|
|
112
|
+
)}`
|
|
113
|
+
);
|
|
114
|
+
uncheckedFile.keys.forEach(
|
|
115
|
+
(key) => summary.push(` ${c.gray(F_DOT)} ${key}`)
|
|
116
|
+
);
|
|
101
117
|
});
|
|
102
118
|
}
|
|
103
119
|
return summary;
|
|
@@ -109,8 +125,9 @@ function countTestErrors(tasks) {
|
|
|
109
125
|
}, 0);
|
|
110
126
|
}
|
|
111
127
|
function getStateString(tasks, name = "tests", showTotal = true) {
|
|
112
|
-
if (tasks.length === 0)
|
|
128
|
+
if (tasks.length === 0) {
|
|
113
129
|
return c.dim(`no ${name}`);
|
|
130
|
+
}
|
|
114
131
|
const passed = tasks.filter((i) => {
|
|
115
132
|
var _a;
|
|
116
133
|
return ((_a = i.result) == null ? void 0 : _a.state) === "pass";
|
|
@@ -130,13 +147,16 @@ function getStateString(tasks, name = "tests", showTotal = true) {
|
|
|
130
147
|
}
|
|
131
148
|
function getStateSymbol(task) {
|
|
132
149
|
var _a;
|
|
133
|
-
if (task.mode === "skip" || task.mode === "todo")
|
|
150
|
+
if (task.mode === "skip" || task.mode === "todo") {
|
|
134
151
|
return skipped;
|
|
135
|
-
|
|
152
|
+
}
|
|
153
|
+
if (!task.result) {
|
|
136
154
|
return c.gray("\xB7");
|
|
155
|
+
}
|
|
137
156
|
if (task.result.state === "run") {
|
|
138
|
-
if (task.type === "suite")
|
|
157
|
+
if (task.type === "suite") {
|
|
139
158
|
return pointer;
|
|
159
|
+
}
|
|
140
160
|
let spinner = spinnerMap.get(task);
|
|
141
161
|
if (!spinner) {
|
|
142
162
|
spinner = elegantSpinner();
|
|
@@ -181,16 +201,11 @@ function formatTimeString(date) {
|
|
|
181
201
|
return date.toTimeString().split(" ")[0];
|
|
182
202
|
}
|
|
183
203
|
function formatProjectName(name, suffix = " ") {
|
|
184
|
-
if (!name)
|
|
204
|
+
if (!name) {
|
|
185
205
|
return "";
|
|
206
|
+
}
|
|
186
207
|
const index = name.split("").reduce((acc, v, idx) => acc + v.charCodeAt(0) + idx, 0);
|
|
187
|
-
const colors = [
|
|
188
|
-
c.blue,
|
|
189
|
-
c.yellow,
|
|
190
|
-
c.cyan,
|
|
191
|
-
c.green,
|
|
192
|
-
c.magenta
|
|
193
|
-
];
|
|
208
|
+
const colors = [c.blue, c.yellow, c.cyan, c.green, c.magenta];
|
|
194
209
|
return colors[index % colors.length](`|${name}|`) + suffix;
|
|
195
210
|
}
|
|
196
211
|
|
|
@@ -214,4 +229,4 @@ var utils = /*#__PURE__*/Object.freeze({
|
|
|
214
229
|
spinnerMap: spinnerMap
|
|
215
230
|
});
|
|
216
231
|
|
|
217
|
-
export { F_RIGHT as F,
|
|
232
|
+
export { F_RIGHT as F, F_POINTER as a, getStateString as b, formatTimeString as c, countTestErrors as d, divider as e, formatProjectName as f, getStateSymbol as g, getCols as h, getHookStateSymbol as i, pointer as p, renderSnapshotSummary as r, stripAnsi as s, utils as u };
|
|
@@ -4,7 +4,9 @@ var _a, _b;
|
|
|
4
4
|
const REGEXP_WRAP_PREFIX = "$$vitest:";
|
|
5
5
|
const processSend = (_a = process.send) == null ? void 0 : _a.bind(process);
|
|
6
6
|
const processOn = (_b = process.on) == null ? void 0 : _b.bind(process);
|
|
7
|
-
function createThreadsRpcOptions({
|
|
7
|
+
function createThreadsRpcOptions({
|
|
8
|
+
port
|
|
9
|
+
}) {
|
|
8
10
|
return {
|
|
9
11
|
post: (v) => {
|
|
10
12
|
port.postMessage(v);
|
|
@@ -23,8 +25,9 @@ function createForksRpcOptions(nodeV8) {
|
|
|
23
25
|
},
|
|
24
26
|
on(fn) {
|
|
25
27
|
processOn("message", (message, ...extras) => {
|
|
26
|
-
if (message == null ? void 0 : message.__tinypool_worker_message__)
|
|
28
|
+
if (message == null ? void 0 : message.__tinypool_worker_message__) {
|
|
27
29
|
return;
|
|
30
|
+
}
|
|
28
31
|
return fn(message, ...extras);
|
|
29
32
|
});
|
|
30
33
|
}
|
|
@@ -33,14 +36,18 @@ function createForksRpcOptions(nodeV8) {
|
|
|
33
36
|
function unwrapSerializableConfig(config) {
|
|
34
37
|
if (config.testNamePattern && typeof config.testNamePattern === "string") {
|
|
35
38
|
const testNamePattern = config.testNamePattern;
|
|
36
|
-
if (testNamePattern.startsWith(REGEXP_WRAP_PREFIX))
|
|
37
|
-
config.testNamePattern = parseRegexp(
|
|
39
|
+
if (testNamePattern.startsWith(REGEXP_WRAP_PREFIX)) {
|
|
40
|
+
config.testNamePattern = parseRegexp(
|
|
41
|
+
testNamePattern.slice(REGEXP_WRAP_PREFIX.length)
|
|
42
|
+
);
|
|
43
|
+
}
|
|
38
44
|
}
|
|
39
45
|
if (config.defines && Array.isArray(config.defines.keys) && config.defines.original) {
|
|
40
46
|
const { keys, original } = config.defines;
|
|
41
47
|
const defines = {};
|
|
42
|
-
for (const key of keys)
|
|
48
|
+
for (const key of keys) {
|
|
43
49
|
defines[key] = original[key];
|
|
50
|
+
}
|
|
44
51
|
config.defines = defines;
|
|
45
52
|
}
|
|
46
53
|
return config;
|