@storybook/addon-vitest 0.0.0-pr-32795-sha-81cf1f23 → 0.0.0-pr-32717-sha-f340a68b
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/dist/_browser-chunks/chunk-JK72E6FR.js +6 -0
- package/dist/_browser-chunks/chunk-RPDOPHZX.js +77 -0
- package/dist/_node-chunks/chunk-724JPUHM.js +40 -0
- package/dist/_node-chunks/{chunk-KCHXXKAS.js → chunk-7ZCNTQXP.js} +24 -15
- package/dist/_node-chunks/chunk-A4VFZRVB.js +502 -0
- package/dist/_node-chunks/chunk-G6ASZ6US.js +69 -0
- package/dist/_node-chunks/{chunk-ML5LEYEM.js → chunk-K5BRNZW2.js} +19 -14
- package/dist/_node-chunks/chunk-KHNVQCL7.js +92 -0
- package/dist/_node-chunks/chunk-MLM43G3E.js +260 -0
- package/dist/_node-chunks/chunk-NGOGIT42.js +60 -0
- package/dist/_node-chunks/chunk-TXTKPPIA.js +247 -0
- package/dist/index.js +5 -1
- package/dist/manager.js +354 -163
- package/dist/node/coverage-reporter.js +864 -319
- package/dist/node/vitest.js +466 -190
- package/dist/postinstall.js +1276 -633
- package/dist/preset.js +354 -160
- package/dist/vitest-plugin/global-setup.js +105 -51
- package/dist/vitest-plugin/index.js +2381 -1161
- package/dist/vitest-plugin/setup-file.js +12 -6
- package/dist/vitest-plugin/test-utils.js +71 -31
- package/package.json +3 -7
- package/dist/_browser-chunks/chunk-ULSHVN74.js +0 -60
- package/dist/_node-chunks/chunk-43MIUCD6.js +0 -138
- package/dist/_node-chunks/chunk-NCYNCIBX.js +0 -1697
- package/dist/_node-chunks/chunk-NSF3UF7J.js +0 -339
- package/dist/_node-chunks/chunk-PYDFQUST.js +0 -35
- package/dist/_node-chunks/chunk-XTWQR354.js +0 -69
- package/dist/_node-chunks/chunk-ZI6UZG2P.js +0 -83
|
@@ -1,106 +1,144 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_xvr6gehai1p from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_xvr6gehai1p from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_xvr6gehai1p from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_xvr6gehai1p.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_xvr6gehai1p.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_xvr6gehai1p.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
require_gte
|
|
14
|
-
} from "../_node-chunks/chunk-
|
|
14
|
+
} from "../_node-chunks/chunk-A4VFZRVB.js";
|
|
15
15
|
import {
|
|
16
16
|
__commonJS,
|
|
17
|
+
__name,
|
|
17
18
|
__require,
|
|
18
19
|
__toESM
|
|
19
|
-
} from "../_node-chunks/chunk-
|
|
20
|
+
} from "../_node-chunks/chunk-K5BRNZW2.js";
|
|
20
21
|
|
|
21
22
|
// ../../node_modules/istanbul-lib-report/node_modules/make-dir/index.js
|
|
22
23
|
var require_make_dir = __commonJS({
|
|
23
24
|
"../../node_modules/istanbul-lib-report/node_modules/make-dir/index.js"(exports, module) {
|
|
24
25
|
"use strict";
|
|
25
|
-
var fs = __require("fs")
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
var fs = __require("fs");
|
|
27
|
+
var path = __require("path");
|
|
28
|
+
var { promisify } = __require("util");
|
|
29
|
+
var semverGte = require_gte();
|
|
30
|
+
var useNativeRecursiveOption = semverGte(process.version, "10.12.0");
|
|
31
|
+
var checkPath = /* @__PURE__ */ __name((pth) => {
|
|
32
|
+
if (process.platform === "win32") {
|
|
33
|
+
const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ""));
|
|
34
|
+
if (pathHasInvalidWinCharacters) {
|
|
35
|
+
const error = new Error(`Path contains invalid characters: ${pth}`);
|
|
36
|
+
error.code = "EINVAL";
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
29
39
|
}
|
|
30
|
-
},
|
|
31
|
-
|
|
40
|
+
}, "checkPath");
|
|
41
|
+
var processOptions = /* @__PURE__ */ __name((options) => {
|
|
42
|
+
const defaults = {
|
|
32
43
|
mode: 511,
|
|
33
44
|
fs
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
},
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
};
|
|
46
|
+
return {
|
|
47
|
+
...defaults,
|
|
48
|
+
...options
|
|
49
|
+
};
|
|
50
|
+
}, "processOptions");
|
|
51
|
+
var permissionError = /* @__PURE__ */ __name((pth) => {
|
|
52
|
+
const error = new Error(`operation not permitted, mkdir '${pth}'`);
|
|
53
|
+
error.code = "EPERM";
|
|
54
|
+
error.errno = -4048;
|
|
55
|
+
error.path = pth;
|
|
56
|
+
error.syscall = "mkdir";
|
|
57
|
+
return error;
|
|
58
|
+
}, "permissionError");
|
|
59
|
+
var makeDir = /* @__PURE__ */ __name(async (input, options) => {
|
|
60
|
+
checkPath(input);
|
|
61
|
+
options = processOptions(options);
|
|
62
|
+
const mkdir = promisify(options.fs.mkdir);
|
|
63
|
+
const stat = promisify(options.fs.stat);
|
|
42
64
|
if (useNativeRecursiveOption && options.fs.mkdir === fs.mkdir) {
|
|
43
|
-
|
|
44
|
-
|
|
65
|
+
const pth = path.resolve(input);
|
|
66
|
+
await mkdir(pth, {
|
|
45
67
|
mode: options.mode,
|
|
46
|
-
recursive:
|
|
47
|
-
})
|
|
68
|
+
recursive: true
|
|
69
|
+
});
|
|
70
|
+
return pth;
|
|
48
71
|
}
|
|
49
|
-
|
|
72
|
+
const make = /* @__PURE__ */ __name(async (pth) => {
|
|
50
73
|
try {
|
|
51
|
-
|
|
74
|
+
await mkdir(pth, options.mode);
|
|
75
|
+
return pth;
|
|
52
76
|
} catch (error) {
|
|
53
|
-
if (error.code === "EPERM")
|
|
77
|
+
if (error.code === "EPERM") {
|
|
54
78
|
throw error;
|
|
79
|
+
}
|
|
55
80
|
if (error.code === "ENOENT") {
|
|
56
|
-
if (path.dirname(pth) === pth)
|
|
81
|
+
if (path.dirname(pth) === pth) {
|
|
57
82
|
throw permissionError(pth);
|
|
58
|
-
|
|
83
|
+
}
|
|
84
|
+
if (error.message.includes("null bytes")) {
|
|
59
85
|
throw error;
|
|
60
|
-
|
|
86
|
+
}
|
|
87
|
+
await make(path.dirname(pth));
|
|
88
|
+
return make(pth);
|
|
61
89
|
}
|
|
62
90
|
try {
|
|
63
|
-
|
|
91
|
+
const stats = await stat(pth);
|
|
92
|
+
if (!stats.isDirectory()) {
|
|
64
93
|
throw new Error("The path is not a directory");
|
|
94
|
+
}
|
|
65
95
|
} catch {
|
|
66
96
|
throw error;
|
|
67
97
|
}
|
|
68
98
|
return pth;
|
|
69
99
|
}
|
|
70
|
-
};
|
|
100
|
+
}, "make");
|
|
71
101
|
return make(path.resolve(input));
|
|
72
|
-
};
|
|
102
|
+
}, "makeDir");
|
|
73
103
|
module.exports = makeDir;
|
|
74
104
|
module.exports.sync = (input, options) => {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
105
|
+
checkPath(input);
|
|
106
|
+
options = processOptions(options);
|
|
107
|
+
if (useNativeRecursiveOption && options.fs.mkdirSync === fs.mkdirSync) {
|
|
108
|
+
const pth = path.resolve(input);
|
|
109
|
+
fs.mkdirSync(pth, {
|
|
78
110
|
mode: options.mode,
|
|
79
|
-
recursive:
|
|
80
|
-
})
|
|
111
|
+
recursive: true
|
|
112
|
+
});
|
|
113
|
+
return pth;
|
|
81
114
|
}
|
|
82
|
-
|
|
115
|
+
const make = /* @__PURE__ */ __name((pth) => {
|
|
83
116
|
try {
|
|
84
117
|
options.fs.mkdirSync(pth, options.mode);
|
|
85
118
|
} catch (error) {
|
|
86
|
-
if (error.code === "EPERM")
|
|
119
|
+
if (error.code === "EPERM") {
|
|
87
120
|
throw error;
|
|
121
|
+
}
|
|
88
122
|
if (error.code === "ENOENT") {
|
|
89
|
-
if (path.dirname(pth) === pth)
|
|
123
|
+
if (path.dirname(pth) === pth) {
|
|
90
124
|
throw permissionError(pth);
|
|
91
|
-
|
|
125
|
+
}
|
|
126
|
+
if (error.message.includes("null bytes")) {
|
|
92
127
|
throw error;
|
|
93
|
-
|
|
128
|
+
}
|
|
129
|
+
make(path.dirname(pth));
|
|
130
|
+
return make(pth);
|
|
94
131
|
}
|
|
95
132
|
try {
|
|
96
|
-
if (!options.fs.statSync(pth).isDirectory())
|
|
133
|
+
if (!options.fs.statSync(pth).isDirectory()) {
|
|
97
134
|
throw new Error("The path is not a directory");
|
|
135
|
+
}
|
|
98
136
|
} catch {
|
|
99
137
|
throw error;
|
|
100
138
|
}
|
|
101
139
|
}
|
|
102
140
|
return pth;
|
|
103
|
-
};
|
|
141
|
+
}, "make");
|
|
104
142
|
return make(path.resolve(input));
|
|
105
143
|
};
|
|
106
144
|
}
|
|
@@ -111,7 +149,9 @@ var require_has_flag = __commonJS({
|
|
|
111
149
|
"../../node_modules/has-flag/index.js"(exports, module) {
|
|
112
150
|
"use strict";
|
|
113
151
|
module.exports = (flag, argv = process.argv) => {
|
|
114
|
-
|
|
152
|
+
const prefix = flag.startsWith("-") ? "" : flag.length === 1 ? "-" : "--";
|
|
153
|
+
const position = argv.indexOf(prefix + flag);
|
|
154
|
+
const terminatorPosition = argv.indexOf("--");
|
|
115
155
|
return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
|
|
116
156
|
};
|
|
117
157
|
}
|
|
@@ -121,41 +161,75 @@ var require_has_flag = __commonJS({
|
|
|
121
161
|
var require_supports_color = __commonJS({
|
|
122
162
|
"../../node_modules/supports-color/index.js"(exports, module) {
|
|
123
163
|
"use strict";
|
|
124
|
-
var os = __require("os")
|
|
125
|
-
|
|
126
|
-
|
|
164
|
+
var os = __require("os");
|
|
165
|
+
var tty = __require("tty");
|
|
166
|
+
var hasFlag = require_has_flag();
|
|
167
|
+
var { env } = process;
|
|
168
|
+
var forceColor;
|
|
169
|
+
if (hasFlag("no-color") || hasFlag("no-colors") || hasFlag("color=false") || hasFlag("color=never")) {
|
|
170
|
+
forceColor = 0;
|
|
171
|
+
} else if (hasFlag("color") || hasFlag("colors") || hasFlag("color=true") || hasFlag("color=always")) {
|
|
172
|
+
forceColor = 1;
|
|
173
|
+
}
|
|
174
|
+
if ("FORCE_COLOR" in env) {
|
|
175
|
+
if (env.FORCE_COLOR === "true") {
|
|
176
|
+
forceColor = 1;
|
|
177
|
+
} else if (env.FORCE_COLOR === "false") {
|
|
178
|
+
forceColor = 0;
|
|
179
|
+
} else {
|
|
180
|
+
forceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
127
183
|
function translateLevel(level) {
|
|
128
|
-
|
|
184
|
+
if (level === 0) {
|
|
185
|
+
return false;
|
|
186
|
+
}
|
|
187
|
+
return {
|
|
129
188
|
level,
|
|
130
|
-
hasBasic:
|
|
189
|
+
hasBasic: true,
|
|
131
190
|
has256: level >= 2,
|
|
132
191
|
has16m: level >= 3
|
|
133
192
|
};
|
|
134
193
|
}
|
|
194
|
+
__name(translateLevel, "translateLevel");
|
|
135
195
|
function supportsColor(haveStream, streamIsTTY) {
|
|
136
|
-
if (forceColor === 0)
|
|
196
|
+
if (forceColor === 0) {
|
|
137
197
|
return 0;
|
|
138
|
-
|
|
198
|
+
}
|
|
199
|
+
if (hasFlag("color=16m") || hasFlag("color=full") || hasFlag("color=truecolor")) {
|
|
139
200
|
return 3;
|
|
140
|
-
|
|
201
|
+
}
|
|
202
|
+
if (hasFlag("color=256")) {
|
|
141
203
|
return 2;
|
|
142
|
-
|
|
204
|
+
}
|
|
205
|
+
if (haveStream && !streamIsTTY && forceColor === void 0) {
|
|
143
206
|
return 0;
|
|
144
|
-
|
|
145
|
-
|
|
207
|
+
}
|
|
208
|
+
const min = forceColor || 0;
|
|
209
|
+
if (env.TERM === "dumb") {
|
|
146
210
|
return min;
|
|
211
|
+
}
|
|
147
212
|
if (process.platform === "win32") {
|
|
148
|
-
|
|
149
|
-
|
|
213
|
+
const osRelease = os.release().split(".");
|
|
214
|
+
if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10586) {
|
|
215
|
+
return Number(osRelease[2]) >= 14931 ? 3 : 2;
|
|
216
|
+
}
|
|
217
|
+
return 1;
|
|
218
|
+
}
|
|
219
|
+
if ("CI" in env) {
|
|
220
|
+
if (["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship") {
|
|
221
|
+
return 1;
|
|
222
|
+
}
|
|
223
|
+
return min;
|
|
150
224
|
}
|
|
151
|
-
if ("
|
|
152
|
-
return ["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI", "GITHUB_ACTIONS", "BUILDKITE"].some((sign) => sign in env) || env.CI_NAME === "codeship" ? 1 : min;
|
|
153
|
-
if ("TEAMCITY_VERSION" in env)
|
|
225
|
+
if ("TEAMCITY_VERSION" in env) {
|
|
154
226
|
return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
|
|
155
|
-
|
|
227
|
+
}
|
|
228
|
+
if (env.COLORTERM === "truecolor") {
|
|
156
229
|
return 3;
|
|
230
|
+
}
|
|
157
231
|
if ("TERM_PROGRAM" in env) {
|
|
158
|
-
|
|
232
|
+
const version = parseInt((env.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
|
|
159
233
|
switch (env.TERM_PROGRAM) {
|
|
160
234
|
case "iTerm.app":
|
|
161
235
|
return version >= 3 ? 3 : 2;
|
|
@@ -163,16 +237,27 @@ var require_supports_color = __commonJS({
|
|
|
163
237
|
return 2;
|
|
164
238
|
}
|
|
165
239
|
}
|
|
166
|
-
|
|
240
|
+
if (/-256(color)?$/i.test(env.TERM)) {
|
|
241
|
+
return 2;
|
|
242
|
+
}
|
|
243
|
+
if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
|
|
244
|
+
return 1;
|
|
245
|
+
}
|
|
246
|
+
if ("COLORTERM" in env) {
|
|
247
|
+
return 1;
|
|
248
|
+
}
|
|
249
|
+
return min;
|
|
167
250
|
}
|
|
251
|
+
__name(supportsColor, "supportsColor");
|
|
168
252
|
function getSupportLevel(stream) {
|
|
169
|
-
|
|
253
|
+
const level = supportsColor(stream, stream && stream.isTTY);
|
|
170
254
|
return translateLevel(level);
|
|
171
255
|
}
|
|
256
|
+
__name(getSupportLevel, "getSupportLevel");
|
|
172
257
|
module.exports = {
|
|
173
258
|
supportsColor: getSupportLevel,
|
|
174
|
-
stdout: translateLevel(supportsColor(
|
|
175
|
-
stderr: translateLevel(supportsColor(
|
|
259
|
+
stdout: translateLevel(supportsColor(true, tty.isatty(1))),
|
|
260
|
+
stderr: translateLevel(supportsColor(true, tty.isatty(2)))
|
|
176
261
|
};
|
|
177
262
|
}
|
|
178
263
|
});
|
|
@@ -181,7 +266,14 @@ var require_supports_color = __commonJS({
|
|
|
181
266
|
var require_file_writer = __commonJS({
|
|
182
267
|
"../../node_modules/istanbul-lib-report/lib/file-writer.js"(exports, module) {
|
|
183
268
|
"use strict";
|
|
184
|
-
var path = __require("path")
|
|
269
|
+
var path = __require("path");
|
|
270
|
+
var fs = __require("fs");
|
|
271
|
+
var mkdirp = require_make_dir();
|
|
272
|
+
var supportsColor = require_supports_color();
|
|
273
|
+
var ContentWriter = class {
|
|
274
|
+
static {
|
|
275
|
+
__name(this, "ContentWriter");
|
|
276
|
+
}
|
|
185
277
|
/**
|
|
186
278
|
* returns the colorized version of a string. Typically,
|
|
187
279
|
* content writers that write to files will return the
|
|
@@ -207,9 +299,14 @@ var require_file_writer = __commonJS({
|
|
|
207
299
|
*/
|
|
208
300
|
close() {
|
|
209
301
|
}
|
|
210
|
-
}
|
|
302
|
+
};
|
|
303
|
+
var FileContentWriter = class extends ContentWriter {
|
|
304
|
+
static {
|
|
305
|
+
__name(this, "FileContentWriter");
|
|
306
|
+
}
|
|
211
307
|
constructor(fd) {
|
|
212
|
-
super()
|
|
308
|
+
super();
|
|
309
|
+
this.fd = fd;
|
|
213
310
|
}
|
|
214
311
|
write(str) {
|
|
215
312
|
fs.writeSync(this.fd, str);
|
|
@@ -217,22 +314,40 @@ var require_file_writer = __commonJS({
|
|
|
217
314
|
close() {
|
|
218
315
|
fs.closeSync(this.fd);
|
|
219
316
|
}
|
|
220
|
-
}
|
|
317
|
+
};
|
|
318
|
+
var capture = false;
|
|
319
|
+
var output = "";
|
|
320
|
+
var ConsoleWriter = class extends ContentWriter {
|
|
321
|
+
static {
|
|
322
|
+
__name(this, "ConsoleWriter");
|
|
323
|
+
}
|
|
221
324
|
write(str) {
|
|
222
|
-
|
|
325
|
+
if (capture) {
|
|
326
|
+
output += str;
|
|
327
|
+
} else {
|
|
328
|
+
process.stdout.write(str);
|
|
329
|
+
}
|
|
223
330
|
}
|
|
224
331
|
colorize(str, clazz) {
|
|
225
|
-
|
|
332
|
+
const colors = {
|
|
226
333
|
low: "31;1",
|
|
227
334
|
medium: "33;1",
|
|
228
335
|
high: "32;1"
|
|
229
336
|
};
|
|
230
|
-
|
|
337
|
+
if (supportsColor.stdout && colors[clazz]) {
|
|
338
|
+
return `\x1B[${colors[clazz]}m${str}\x1B[0m`;
|
|
339
|
+
}
|
|
340
|
+
return str;
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
var FileWriter = class _FileWriter {
|
|
344
|
+
static {
|
|
345
|
+
__name(this, "FileWriter");
|
|
231
346
|
}
|
|
232
|
-
}, FileWriter = class _FileWriter {
|
|
233
347
|
constructor(baseDir) {
|
|
234
|
-
if (!baseDir)
|
|
348
|
+
if (!baseDir) {
|
|
235
349
|
throw new Error("baseDir must be specified");
|
|
350
|
+
}
|
|
236
351
|
this.baseDir = baseDir;
|
|
237
352
|
}
|
|
238
353
|
/**
|
|
@@ -240,10 +355,10 @@ var require_file_writer = __commonJS({
|
|
|
240
355
|
* super useful for tests!
|
|
241
356
|
*/
|
|
242
357
|
static startCapture() {
|
|
243
|
-
capture =
|
|
358
|
+
capture = true;
|
|
244
359
|
}
|
|
245
360
|
static stopCapture() {
|
|
246
|
-
capture =
|
|
361
|
+
capture = false;
|
|
247
362
|
}
|
|
248
363
|
static getOutput() {
|
|
249
364
|
return output;
|
|
@@ -258,10 +373,11 @@ var require_file_writer = __commonJS({
|
|
|
258
373
|
* @returns {FileWriter}
|
|
259
374
|
*/
|
|
260
375
|
writerForDir(subdir) {
|
|
261
|
-
if (path.isAbsolute(subdir))
|
|
376
|
+
if (path.isAbsolute(subdir)) {
|
|
262
377
|
throw new Error(
|
|
263
378
|
`Cannot create subdir writer for absolute path: ${subdir}`
|
|
264
379
|
);
|
|
380
|
+
}
|
|
265
381
|
return new _FileWriter(`${this.baseDir}/${subdir}`);
|
|
266
382
|
}
|
|
267
383
|
/**
|
|
@@ -272,11 +388,18 @@ var require_file_writer = __commonJS({
|
|
|
272
388
|
* (e.g., an "this file is autogenerated" comment, copyright notice, etc.)
|
|
273
389
|
*/
|
|
274
390
|
copyFile(source, dest, header) {
|
|
275
|
-
if (path.isAbsolute(dest))
|
|
391
|
+
if (path.isAbsolute(dest)) {
|
|
276
392
|
throw new Error(`Cannot write to absolute path: ${dest}`);
|
|
277
|
-
|
|
393
|
+
}
|
|
394
|
+
dest = path.resolve(this.baseDir, dest);
|
|
395
|
+
mkdirp.sync(path.dirname(dest));
|
|
278
396
|
let contents;
|
|
279
|
-
|
|
397
|
+
if (header) {
|
|
398
|
+
contents = header + fs.readFileSync(source, "utf8");
|
|
399
|
+
} else {
|
|
400
|
+
contents = fs.readFileSync(source);
|
|
401
|
+
}
|
|
402
|
+
fs.writeFileSync(dest, contents);
|
|
280
403
|
}
|
|
281
404
|
/**
|
|
282
405
|
* returns a content writer for writing content to the supplied file.
|
|
@@ -285,11 +408,15 @@ var require_file_writer = __commonJS({
|
|
|
285
408
|
* @returns {ContentWriter}
|
|
286
409
|
*/
|
|
287
410
|
writeFile(file) {
|
|
288
|
-
if (file === null || file === "-")
|
|
411
|
+
if (file === null || file === "-") {
|
|
289
412
|
return new ConsoleWriter();
|
|
290
|
-
|
|
413
|
+
}
|
|
414
|
+
if (path.isAbsolute(file)) {
|
|
291
415
|
throw new Error(`Cannot write to absolute path: ${file}`);
|
|
292
|
-
|
|
416
|
+
}
|
|
417
|
+
file = path.resolve(this.baseDir, file);
|
|
418
|
+
mkdirp.sync(path.dirname(file));
|
|
419
|
+
return new FileContentWriter(fs.openSync(file, "w"));
|
|
293
420
|
}
|
|
294
421
|
};
|
|
295
422
|
module.exports = FileWriter;
|
|
@@ -300,15 +427,21 @@ var require_file_writer = __commonJS({
|
|
|
300
427
|
var require_xml_writer = __commonJS({
|
|
301
428
|
"../../node_modules/istanbul-lib-report/lib/xml-writer.js"(exports, module) {
|
|
302
429
|
"use strict";
|
|
430
|
+
var INDENT = " ";
|
|
303
431
|
function attrString(attrs) {
|
|
304
432
|
return Object.entries(attrs || {}).map(([k, v]) => ` ${k}="${v}"`).join("");
|
|
305
433
|
}
|
|
434
|
+
__name(attrString, "attrString");
|
|
306
435
|
var XMLWriter = class {
|
|
436
|
+
static {
|
|
437
|
+
__name(this, "XMLWriter");
|
|
438
|
+
}
|
|
307
439
|
constructor(contentWriter) {
|
|
308
|
-
this.cw = contentWriter
|
|
440
|
+
this.cw = contentWriter;
|
|
441
|
+
this.stack = [];
|
|
309
442
|
}
|
|
310
443
|
indent(str) {
|
|
311
|
-
return this.stack.map(() =>
|
|
444
|
+
return this.stack.map(() => INDENT).join("") + str;
|
|
312
445
|
}
|
|
313
446
|
/**
|
|
314
447
|
* writes the opening XML tag with the supplied attributes
|
|
@@ -316,8 +449,9 @@ var require_xml_writer = __commonJS({
|
|
|
316
449
|
* @param {Object} [attrs=null] attrs attributes for the tag
|
|
317
450
|
*/
|
|
318
451
|
openTag(name, attrs) {
|
|
319
|
-
|
|
320
|
-
this.cw.println(str)
|
|
452
|
+
const str = this.indent(`<${name + attrString(attrs)}>`);
|
|
453
|
+
this.cw.println(str);
|
|
454
|
+
this.stack.push(name);
|
|
321
455
|
}
|
|
322
456
|
/**
|
|
323
457
|
* closes an open XML tag.
|
|
@@ -325,13 +459,16 @@ var require_xml_writer = __commonJS({
|
|
|
325
459
|
* notion of the tag that is currently open.
|
|
326
460
|
*/
|
|
327
461
|
closeTag(name) {
|
|
328
|
-
if (this.stack.length === 0)
|
|
462
|
+
if (this.stack.length === 0) {
|
|
329
463
|
throw new Error(`Attempt to close tag ${name} when not opened`);
|
|
330
|
-
|
|
331
|
-
|
|
464
|
+
}
|
|
465
|
+
const stashed = this.stack.pop();
|
|
466
|
+
const str = `</${name}>`;
|
|
467
|
+
if (stashed !== name) {
|
|
332
468
|
throw new Error(
|
|
333
469
|
`Attempt to close tag ${name} when ${stashed} was the one open`
|
|
334
470
|
);
|
|
471
|
+
}
|
|
335
472
|
this.cw.println(this.indent(str));
|
|
336
473
|
}
|
|
337
474
|
/**
|
|
@@ -342,7 +479,13 @@ var require_xml_writer = __commonJS({
|
|
|
342
479
|
*/
|
|
343
480
|
inlineTag(name, attrs, content) {
|
|
344
481
|
let str = "<" + name + attrString(attrs);
|
|
345
|
-
|
|
482
|
+
if (content) {
|
|
483
|
+
str += `>${content}</${name}>`;
|
|
484
|
+
} else {
|
|
485
|
+
str += "/>";
|
|
486
|
+
}
|
|
487
|
+
str = this.indent(str);
|
|
488
|
+
this.cw.println(str);
|
|
346
489
|
}
|
|
347
490
|
/**
|
|
348
491
|
* closes all open tags and ends the document
|
|
@@ -362,21 +505,38 @@ var require_tree = __commonJS({
|
|
|
362
505
|
"../../node_modules/istanbul-lib-report/lib/tree.js"(exports, module) {
|
|
363
506
|
"use strict";
|
|
364
507
|
var Visitor = class {
|
|
508
|
+
static {
|
|
509
|
+
__name(this, "Visitor");
|
|
510
|
+
}
|
|
365
511
|
constructor(delegate) {
|
|
366
512
|
this.delegate = delegate;
|
|
367
513
|
}
|
|
368
514
|
};
|
|
369
515
|
["Start", "End", "Summary", "SummaryEnd", "Detail"].map((k) => `on${k}`).forEach((fn) => {
|
|
370
516
|
Object.defineProperty(Visitor.prototype, fn, {
|
|
371
|
-
writable:
|
|
517
|
+
writable: true,
|
|
372
518
|
value(node, state) {
|
|
373
|
-
typeof this.delegate[fn]
|
|
519
|
+
if (typeof this.delegate[fn] === "function") {
|
|
520
|
+
this.delegate[fn](node, state);
|
|
521
|
+
}
|
|
374
522
|
}
|
|
375
523
|
});
|
|
376
524
|
});
|
|
377
525
|
var CompositeVisitor = class extends Visitor {
|
|
526
|
+
static {
|
|
527
|
+
__name(this, "CompositeVisitor");
|
|
528
|
+
}
|
|
378
529
|
constructor(visitors) {
|
|
379
|
-
super()
|
|
530
|
+
super();
|
|
531
|
+
if (!Array.isArray(visitors)) {
|
|
532
|
+
visitors = [visitors];
|
|
533
|
+
}
|
|
534
|
+
this.visitors = visitors.map((v) => {
|
|
535
|
+
if (v instanceof Visitor) {
|
|
536
|
+
return v;
|
|
537
|
+
}
|
|
538
|
+
return new Visitor(v);
|
|
539
|
+
});
|
|
380
540
|
}
|
|
381
541
|
};
|
|
382
542
|
["Start", "Summary", "SummaryEnd", "Detail", "End"].map((k) => `on${k}`).forEach((fn) => {
|
|
@@ -389,6 +549,9 @@ var require_tree = __commonJS({
|
|
|
389
549
|
});
|
|
390
550
|
});
|
|
391
551
|
var BaseNode = class {
|
|
552
|
+
static {
|
|
553
|
+
__name(this, "BaseNode");
|
|
554
|
+
}
|
|
392
555
|
isRoot() {
|
|
393
556
|
return !this.getParent();
|
|
394
557
|
}
|
|
@@ -400,11 +563,23 @@ var require_tree = __commonJS({
|
|
|
400
563
|
* @param state optional state that is passed around
|
|
401
564
|
*/
|
|
402
565
|
visit(visitor, state) {
|
|
403
|
-
|
|
566
|
+
if (this.isSummary()) {
|
|
567
|
+
visitor.onSummary(this, state);
|
|
568
|
+
} else {
|
|
569
|
+
visitor.onDetail(this, state);
|
|
570
|
+
}
|
|
571
|
+
this.getChildren().forEach((child) => {
|
|
404
572
|
child.visit(visitor, state);
|
|
405
|
-
})
|
|
573
|
+
});
|
|
574
|
+
if (this.isSummary()) {
|
|
575
|
+
visitor.onSummaryEnd(this, state);
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
var BaseTree = class {
|
|
580
|
+
static {
|
|
581
|
+
__name(this, "BaseTree");
|
|
406
582
|
}
|
|
407
|
-
}, BaseTree = class {
|
|
408
583
|
constructor(root) {
|
|
409
584
|
this.root = root;
|
|
410
585
|
}
|
|
@@ -420,7 +595,12 @@ var require_tree = __commonJS({
|
|
|
420
595
|
* @param state - the state to be passed around during tree traversal
|
|
421
596
|
*/
|
|
422
597
|
visit(visitor, state) {
|
|
423
|
-
|
|
598
|
+
if (!(visitor instanceof Visitor)) {
|
|
599
|
+
visitor = new Visitor(visitor);
|
|
600
|
+
}
|
|
601
|
+
visitor.onStart(this.getRoot(), state);
|
|
602
|
+
this.getRoot().visit(visitor, state);
|
|
603
|
+
visitor.onEnd(this.getRoot(), state);
|
|
424
604
|
}
|
|
425
605
|
};
|
|
426
606
|
module.exports = {
|
|
@@ -453,10 +633,15 @@ var require_watermarks = __commonJS({
|
|
|
453
633
|
var require_percent = __commonJS({
|
|
454
634
|
"../../node_modules/istanbul-lib-coverage/lib/percent.js"(exports, module) {
|
|
455
635
|
"use strict";
|
|
456
|
-
module.exports = function(covered, total) {
|
|
636
|
+
module.exports = /* @__PURE__ */ __name(function percent(covered, total) {
|
|
457
637
|
let tmp;
|
|
458
|
-
|
|
459
|
-
|
|
638
|
+
if (total > 0) {
|
|
639
|
+
tmp = 1e3 * 100 * covered / total;
|
|
640
|
+
return Math.floor(tmp / 10) / 100;
|
|
641
|
+
} else {
|
|
642
|
+
return 100;
|
|
643
|
+
}
|
|
644
|
+
}, "percent");
|
|
460
645
|
}
|
|
461
646
|
});
|
|
462
647
|
|
|
@@ -464,16 +649,16 @@ var require_percent = __commonJS({
|
|
|
464
649
|
var require_data_properties = __commonJS({
|
|
465
650
|
"../../node_modules/istanbul-lib-coverage/lib/data-properties.js"(exports, module) {
|
|
466
651
|
"use strict";
|
|
467
|
-
module.exports = function(klass, properties) {
|
|
652
|
+
module.exports = /* @__PURE__ */ __name(function dataProperties(klass, properties) {
|
|
468
653
|
properties.forEach((p) => {
|
|
469
654
|
Object.defineProperty(klass.prototype, p, {
|
|
470
|
-
enumerable:
|
|
655
|
+
enumerable: true,
|
|
471
656
|
get() {
|
|
472
657
|
return this.data[p];
|
|
473
658
|
}
|
|
474
659
|
});
|
|
475
660
|
});
|
|
476
|
-
};
|
|
661
|
+
}, "dataProperties");
|
|
477
662
|
}
|
|
478
663
|
});
|
|
479
664
|
|
|
@@ -481,14 +666,15 @@ var require_data_properties = __commonJS({
|
|
|
481
666
|
var require_coverage_summary = __commonJS({
|
|
482
667
|
"../../node_modules/istanbul-lib-coverage/lib/coverage-summary.js"(exports, module) {
|
|
483
668
|
"use strict";
|
|
484
|
-
var percent = require_percent()
|
|
669
|
+
var percent = require_percent();
|
|
670
|
+
var dataProperties = require_data_properties();
|
|
485
671
|
function blankSummary() {
|
|
486
|
-
|
|
672
|
+
const empty = /* @__PURE__ */ __name(() => ({
|
|
487
673
|
total: 0,
|
|
488
674
|
covered: 0,
|
|
489
675
|
skipped: 0,
|
|
490
676
|
pct: "Unknown"
|
|
491
|
-
});
|
|
677
|
+
}), "empty");
|
|
492
678
|
return {
|
|
493
679
|
lines: empty(),
|
|
494
680
|
statements: empty(),
|
|
@@ -497,35 +683,56 @@ var require_coverage_summary = __commonJS({
|
|
|
497
683
|
branchesTrue: empty()
|
|
498
684
|
};
|
|
499
685
|
}
|
|
686
|
+
__name(blankSummary, "blankSummary");
|
|
500
687
|
function assertValidSummary(obj) {
|
|
501
|
-
|
|
688
|
+
const valid = obj && obj.lines && obj.statements && obj.functions && obj.branches;
|
|
689
|
+
if (!valid) {
|
|
502
690
|
throw new Error(
|
|
503
691
|
"Invalid summary coverage object, missing keys, found:" + Object.keys(obj).join(",")
|
|
504
692
|
);
|
|
693
|
+
}
|
|
505
694
|
}
|
|
695
|
+
__name(assertValidSummary, "assertValidSummary");
|
|
506
696
|
var CoverageSummary = class _CoverageSummary {
|
|
697
|
+
static {
|
|
698
|
+
__name(this, "CoverageSummary");
|
|
699
|
+
}
|
|
507
700
|
/**
|
|
508
701
|
* @constructor
|
|
509
702
|
* @param {Object|CoverageSummary} [obj=undefined] an optional data object or
|
|
510
703
|
* another coverage summary to initialize this object with.
|
|
511
704
|
*/
|
|
512
705
|
constructor(obj) {
|
|
513
|
-
|
|
706
|
+
if (!obj) {
|
|
707
|
+
this.data = blankSummary();
|
|
708
|
+
} else if (obj instanceof _CoverageSummary) {
|
|
709
|
+
this.data = obj.data;
|
|
710
|
+
} else {
|
|
711
|
+
this.data = obj;
|
|
712
|
+
}
|
|
713
|
+
assertValidSummary(this.data);
|
|
514
714
|
}
|
|
515
715
|
/**
|
|
516
716
|
* merges a second summary coverage object into this one
|
|
517
717
|
* @param {CoverageSummary} obj - another coverage summary object
|
|
518
718
|
*/
|
|
519
719
|
merge(obj) {
|
|
520
|
-
|
|
720
|
+
const keys = [
|
|
521
721
|
"lines",
|
|
522
722
|
"statements",
|
|
523
723
|
"branches",
|
|
524
724
|
"functions",
|
|
525
725
|
"branchesTrue"
|
|
526
|
-
]
|
|
527
|
-
|
|
528
|
-
|
|
726
|
+
];
|
|
727
|
+
keys.forEach((key) => {
|
|
728
|
+
if (obj[key]) {
|
|
729
|
+
this[key].total += obj[key].total;
|
|
730
|
+
this[key].covered += obj[key].covered;
|
|
731
|
+
this[key].skipped += obj[key].skipped;
|
|
732
|
+
this[key].pct = percent(this[key].covered, this[key].total);
|
|
733
|
+
}
|
|
734
|
+
});
|
|
735
|
+
return this;
|
|
529
736
|
}
|
|
530
737
|
/**
|
|
531
738
|
* returns a POJO that is JSON serializable. May be used to get the raw
|
|
@@ -558,9 +765,11 @@ var require_coverage_summary = __commonJS({
|
|
|
558
765
|
var require_file_coverage = __commonJS({
|
|
559
766
|
"../../node_modules/istanbul-lib-coverage/lib/file-coverage.js"(exports, module) {
|
|
560
767
|
"use strict";
|
|
561
|
-
var percent = require_percent()
|
|
768
|
+
var percent = require_percent();
|
|
769
|
+
var dataProperties = require_data_properties();
|
|
770
|
+
var { CoverageSummary } = require_coverage_summary();
|
|
562
771
|
function emptyCoverage(filePath, reportLogic) {
|
|
563
|
-
|
|
772
|
+
const cov = {
|
|
564
773
|
path: filePath,
|
|
565
774
|
statementMap: {},
|
|
566
775
|
fnMap: {},
|
|
@@ -569,84 +778,137 @@ var require_file_coverage = __commonJS({
|
|
|
569
778
|
f: {},
|
|
570
779
|
b: {}
|
|
571
780
|
};
|
|
572
|
-
|
|
781
|
+
if (reportLogic) cov.bT = {};
|
|
782
|
+
return cov;
|
|
573
783
|
}
|
|
784
|
+
__name(emptyCoverage, "emptyCoverage");
|
|
574
785
|
function assertValidObject(obj) {
|
|
575
|
-
|
|
786
|
+
const valid = obj && obj.path && obj.statementMap && obj.fnMap && obj.branchMap && obj.s && obj.f && obj.b;
|
|
787
|
+
if (!valid) {
|
|
576
788
|
throw new Error(
|
|
577
789
|
"Invalid file coverage object, missing keys, found:" + Object.keys(obj).join(",")
|
|
578
790
|
);
|
|
791
|
+
}
|
|
579
792
|
}
|
|
580
|
-
|
|
581
|
-
|
|
793
|
+
__name(assertValidObject, "assertValidObject");
|
|
794
|
+
var keyFromLoc = /* @__PURE__ */ __name(({ start, end }) => `${start.line}|${start.column}|${end.line}|${end.column}`, "keyFromLoc");
|
|
795
|
+
var isObj = /* @__PURE__ */ __name((o) => !!o && typeof o === "object", "isObj");
|
|
796
|
+
var isLineCol = /* @__PURE__ */ __name((o) => isObj(o) && typeof o.line === "number" && typeof o.column === "number", "isLineCol");
|
|
797
|
+
var isLoc = /* @__PURE__ */ __name((o) => isObj(o) && isLineCol(o.start) && isLineCol(o.end), "isLoc");
|
|
798
|
+
var getLoc = /* @__PURE__ */ __name((o) => isLoc(o) ? o : isLoc(o.loc) ? o.loc : null, "getLoc");
|
|
799
|
+
var findNearestContainer = /* @__PURE__ */ __name((item, map) => {
|
|
800
|
+
const itemLoc = getLoc(item);
|
|
582
801
|
if (!itemLoc) return null;
|
|
583
|
-
let nearestContainingItem = null
|
|
584
|
-
|
|
585
|
-
|
|
802
|
+
let nearestContainingItem = null;
|
|
803
|
+
let containerDistance = null;
|
|
804
|
+
let containerKey = null;
|
|
805
|
+
for (const [i, mapItem] of Object.entries(map)) {
|
|
806
|
+
const mapLoc = getLoc(mapItem);
|
|
586
807
|
if (!mapLoc) continue;
|
|
587
|
-
|
|
808
|
+
const distance = [
|
|
588
809
|
itemLoc.start.line - mapLoc.start.line,
|
|
589
810
|
itemLoc.start.column - mapLoc.start.column,
|
|
590
811
|
mapLoc.end.line - itemLoc.end.line,
|
|
591
812
|
mapLoc.end.column - itemLoc.end.column
|
|
592
813
|
];
|
|
593
|
-
if (distance[0] < 0 || distance[2] < 0 || distance[0] === 0 && distance[1] < 0 || distance[2] === 0 && distance[3] < 0)
|
|
814
|
+
if (distance[0] < 0 || distance[2] < 0 || distance[0] === 0 && distance[1] < 0 || distance[2] === 0 && distance[3] < 0) {
|
|
594
815
|
continue;
|
|
816
|
+
}
|
|
595
817
|
if (nearestContainingItem === null) {
|
|
596
|
-
containerDistance = distance
|
|
818
|
+
containerDistance = distance;
|
|
819
|
+
nearestContainingItem = mapItem;
|
|
820
|
+
containerKey = i;
|
|
597
821
|
continue;
|
|
598
822
|
}
|
|
599
|
-
|
|
600
|
-
|
|
823
|
+
const closerBefore = distance[0] < containerDistance[0] || distance[0] === 0 && distance[1] < containerDistance[1];
|
|
824
|
+
const closerAfter = distance[2] < containerDistance[2] || distance[2] === 0 && distance[3] < containerDistance[3];
|
|
825
|
+
if (closerBefore || closerAfter) {
|
|
826
|
+
containerDistance = distance;
|
|
827
|
+
nearestContainingItem = mapItem;
|
|
828
|
+
containerKey = i;
|
|
829
|
+
}
|
|
601
830
|
}
|
|
602
831
|
return containerKey;
|
|
603
|
-
},
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
832
|
+
}, "findNearestContainer");
|
|
833
|
+
var addHits = /* @__PURE__ */ __name((aHits, bHits) => {
|
|
834
|
+
if (typeof aHits === "number" && typeof bHits === "number") {
|
|
835
|
+
return aHits + bHits;
|
|
836
|
+
} else if (Array.isArray(aHits) && Array.isArray(bHits)) {
|
|
837
|
+
return aHits.map((a, i) => (a || 0) + (bHits[i] || 0));
|
|
838
|
+
}
|
|
839
|
+
return null;
|
|
840
|
+
}, "addHits");
|
|
841
|
+
var addNearestContainerHits = /* @__PURE__ */ __name((item, itemHits, map, mapHits) => {
|
|
842
|
+
const container = findNearestContainer(item, map);
|
|
843
|
+
if (container) {
|
|
844
|
+
return addHits(itemHits, mapHits[container]);
|
|
845
|
+
} else {
|
|
846
|
+
return itemHits;
|
|
847
|
+
}
|
|
848
|
+
}, "addNearestContainerHits");
|
|
849
|
+
var mergeProp = /* @__PURE__ */ __name((aHits, aMap, bHits, bMap, itemKey = keyFromLoc) => {
|
|
850
|
+
const aItems = {};
|
|
851
|
+
for (const [key, itemHits] of Object.entries(aHits)) {
|
|
852
|
+
const item = aMap[key];
|
|
610
853
|
aItems[itemKey(item)] = [itemHits, item];
|
|
611
854
|
}
|
|
612
|
-
|
|
613
|
-
for (
|
|
614
|
-
|
|
855
|
+
const bItems = {};
|
|
856
|
+
for (const [key, itemHits] of Object.entries(bHits)) {
|
|
857
|
+
const item = bMap[key];
|
|
615
858
|
bItems[itemKey(item)] = [itemHits, item];
|
|
616
859
|
}
|
|
617
|
-
|
|
618
|
-
for (
|
|
619
|
-
let aItemHits = aValue[0]
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
860
|
+
const mergedItems = {};
|
|
861
|
+
for (const [key, aValue] of Object.entries(aItems)) {
|
|
862
|
+
let aItemHits = aValue[0];
|
|
863
|
+
const aItem = aValue[1];
|
|
864
|
+
const bValue = bItems[key];
|
|
865
|
+
if (!bValue) {
|
|
866
|
+
aItemHits = addNearestContainerHits(aItem, aItemHits, bMap, bHits);
|
|
867
|
+
} else {
|
|
868
|
+
aItemHits = addHits(aItemHits, bValue[0]);
|
|
869
|
+
}
|
|
870
|
+
mergedItems[key] = [aItemHits, aItem];
|
|
871
|
+
}
|
|
872
|
+
for (const [key, bValue] of Object.entries(bItems)) {
|
|
873
|
+
let bItemHits = bValue[0];
|
|
874
|
+
const bItem = bValue[1];
|
|
875
|
+
if (mergedItems[key]) continue;
|
|
876
|
+
bItemHits = addNearestContainerHits(bItem, bItemHits, aMap, aHits);
|
|
877
|
+
mergedItems[key] = [bItemHits, bItem];
|
|
878
|
+
}
|
|
879
|
+
const hits = {};
|
|
880
|
+
const map = {};
|
|
881
|
+
Object.values(mergedItems).forEach(([itemHits, item], i) => {
|
|
882
|
+
hits[i] = itemHits;
|
|
883
|
+
map[i] = item;
|
|
884
|
+
});
|
|
885
|
+
return [hits, map];
|
|
886
|
+
}, "mergeProp");
|
|
887
|
+
var FileCoverage = class _FileCoverage {
|
|
888
|
+
static {
|
|
889
|
+
__name(this, "FileCoverage");
|
|
625
890
|
}
|
|
626
|
-
let hits = {}, map = {};
|
|
627
|
-
return Object.values(mergedItems).forEach(([itemHits, item], i) => {
|
|
628
|
-
hits[i] = itemHits, map[i] = item;
|
|
629
|
-
}), [hits, map];
|
|
630
|
-
}, FileCoverage = class _FileCoverage {
|
|
631
891
|
/**
|
|
632
892
|
* @constructor
|
|
633
893
|
* @param {Object|FileCoverage|String} pathOrObj is a string that initializes
|
|
634
894
|
* and empty coverage object with the specified file path or a data object that
|
|
635
895
|
* has all the required properties for a file coverage object.
|
|
636
896
|
*/
|
|
637
|
-
constructor(pathOrObj, reportLogic =
|
|
638
|
-
if (!pathOrObj)
|
|
897
|
+
constructor(pathOrObj, reportLogic = false) {
|
|
898
|
+
if (!pathOrObj) {
|
|
639
899
|
throw new Error(
|
|
640
900
|
"Coverage must be initialized with a path or an object"
|
|
641
901
|
);
|
|
642
|
-
|
|
902
|
+
}
|
|
903
|
+
if (typeof pathOrObj === "string") {
|
|
643
904
|
this.data = emptyCoverage(pathOrObj, reportLogic);
|
|
644
|
-
else if (pathOrObj instanceof _FileCoverage)
|
|
905
|
+
} else if (pathOrObj instanceof _FileCoverage) {
|
|
645
906
|
this.data = pathOrObj.data;
|
|
646
|
-
else if (typeof pathOrObj
|
|
907
|
+
} else if (typeof pathOrObj === "object") {
|
|
647
908
|
this.data = pathOrObj;
|
|
648
|
-
else
|
|
909
|
+
} else {
|
|
649
910
|
throw new Error("Invalid argument to coverage constructor");
|
|
911
|
+
}
|
|
650
912
|
assertValidObject(this.data);
|
|
651
913
|
}
|
|
652
914
|
/**
|
|
@@ -654,13 +916,20 @@ var require_file_coverage = __commonJS({
|
|
|
654
916
|
* This is a map of hits keyed by line number in the source.
|
|
655
917
|
*/
|
|
656
918
|
getLineCoverage() {
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
919
|
+
const statementMap = this.data.statementMap;
|
|
920
|
+
const statements = this.data.s;
|
|
921
|
+
const lineMap = /* @__PURE__ */ Object.create(null);
|
|
922
|
+
Object.entries(statements).forEach(([st, count]) => {
|
|
923
|
+
if (!statementMap[st]) {
|
|
660
924
|
return;
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
925
|
+
}
|
|
926
|
+
const { line } = statementMap[st].start;
|
|
927
|
+
const prevVal = lineMap[line];
|
|
928
|
+
if (prevVal === void 0 || prevVal < count) {
|
|
929
|
+
lineMap[line] = count;
|
|
930
|
+
}
|
|
931
|
+
});
|
|
932
|
+
return lineMap;
|
|
664
933
|
}
|
|
665
934
|
/**
|
|
666
935
|
* returns an array of uncovered line numbers.
|
|
@@ -668,10 +937,14 @@ var require_file_coverage = __commonJS({
|
|
|
668
937
|
* collected.
|
|
669
938
|
*/
|
|
670
939
|
getUncoveredLines() {
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
940
|
+
const lc = this.getLineCoverage();
|
|
941
|
+
const ret = [];
|
|
942
|
+
Object.entries(lc).forEach(([l, hits]) => {
|
|
943
|
+
if (hits === 0) {
|
|
944
|
+
ret.push(l);
|
|
945
|
+
}
|
|
946
|
+
});
|
|
947
|
+
return ret;
|
|
675
948
|
}
|
|
676
949
|
/**
|
|
677
950
|
* returns a map of branch coverage by source line number.
|
|
@@ -679,18 +952,25 @@ var require_file_coverage = __commonJS({
|
|
|
679
952
|
* has a `covered`, `total` and `coverage` (percentage) property.
|
|
680
953
|
*/
|
|
681
954
|
getBranchCoverageByLine() {
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
955
|
+
const branchMap = this.branchMap;
|
|
956
|
+
const branches = this.b;
|
|
957
|
+
const ret = {};
|
|
958
|
+
Object.entries(branchMap).forEach(([k, map]) => {
|
|
959
|
+
const line = map.line || map.loc.start.line;
|
|
960
|
+
const branchData = branches[k];
|
|
961
|
+
ret[line] = ret[line] || [];
|
|
962
|
+
ret[line].push(...branchData);
|
|
963
|
+
});
|
|
964
|
+
Object.entries(ret).forEach(([k, dataArray]) => {
|
|
965
|
+
const covered = dataArray.filter((item) => item > 0);
|
|
966
|
+
const coverage = covered.length / dataArray.length * 100;
|
|
688
967
|
ret[k] = {
|
|
689
968
|
covered: covered.length,
|
|
690
969
|
total: dataArray.length,
|
|
691
970
|
coverage
|
|
692
971
|
};
|
|
693
|
-
})
|
|
972
|
+
});
|
|
973
|
+
return ret;
|
|
694
974
|
}
|
|
695
975
|
/**
|
|
696
976
|
* return a JSON-serializable POJO for this file coverage object
|
|
@@ -704,9 +984,10 @@ var require_file_coverage = __commonJS({
|
|
|
704
984
|
* Note that the other object should have the same structure as this one (same file).
|
|
705
985
|
*/
|
|
706
986
|
merge(other) {
|
|
707
|
-
if (other.all ===
|
|
987
|
+
if (other.all === true) {
|
|
708
988
|
return;
|
|
709
|
-
|
|
989
|
+
}
|
|
990
|
+
if (this.all === true) {
|
|
710
991
|
this.data = other.data;
|
|
711
992
|
return;
|
|
712
993
|
}
|
|
@@ -716,67 +997,100 @@ var require_file_coverage = __commonJS({
|
|
|
716
997
|
other.s,
|
|
717
998
|
other.statementMap
|
|
718
999
|
);
|
|
719
|
-
this.data.s = hits
|
|
720
|
-
|
|
1000
|
+
this.data.s = hits;
|
|
1001
|
+
this.data.statementMap = map;
|
|
1002
|
+
const keyFromLocProp = /* @__PURE__ */ __name((x) => keyFromLoc(x.loc), "keyFromLocProp");
|
|
1003
|
+
const keyFromLocationsProp = /* @__PURE__ */ __name((x) => keyFromLoc(x.locations[0]), "keyFromLocationsProp");
|
|
721
1004
|
[hits, map] = mergeProp(
|
|
722
1005
|
this.f,
|
|
723
1006
|
this.fnMap,
|
|
724
1007
|
other.f,
|
|
725
1008
|
other.fnMap,
|
|
726
1009
|
keyFromLocProp
|
|
727
|
-
)
|
|
1010
|
+
);
|
|
1011
|
+
this.data.f = hits;
|
|
1012
|
+
this.data.fnMap = map;
|
|
1013
|
+
[hits, map] = mergeProp(
|
|
728
1014
|
this.b,
|
|
729
1015
|
this.branchMap,
|
|
730
1016
|
other.b,
|
|
731
1017
|
other.branchMap,
|
|
732
1018
|
keyFromLocationsProp
|
|
733
|
-
)
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
1019
|
+
);
|
|
1020
|
+
this.data.b = hits;
|
|
1021
|
+
this.data.branchMap = map;
|
|
1022
|
+
if (this.bT && other.bT) {
|
|
1023
|
+
[hits, map] = mergeProp(
|
|
1024
|
+
this.bT,
|
|
1025
|
+
this.branchMap,
|
|
1026
|
+
other.bT,
|
|
1027
|
+
other.branchMap,
|
|
1028
|
+
keyFromLocationsProp
|
|
1029
|
+
);
|
|
1030
|
+
this.data.bT = hits;
|
|
1031
|
+
}
|
|
740
1032
|
}
|
|
741
1033
|
computeSimpleTotals(property) {
|
|
742
1034
|
let stats = this[property];
|
|
743
|
-
typeof stats
|
|
744
|
-
|
|
1035
|
+
if (typeof stats === "function") {
|
|
1036
|
+
stats = stats.call(this);
|
|
1037
|
+
}
|
|
1038
|
+
const ret = {
|
|
745
1039
|
total: Object.keys(stats).length,
|
|
746
1040
|
covered: Object.values(stats).filter((v) => !!v).length,
|
|
747
1041
|
skipped: 0
|
|
748
1042
|
};
|
|
749
|
-
|
|
1043
|
+
ret.pct = percent(ret.covered, ret.total);
|
|
1044
|
+
return ret;
|
|
750
1045
|
}
|
|
751
1046
|
computeBranchTotals(property) {
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
1047
|
+
const stats = this[property];
|
|
1048
|
+
const ret = { total: 0, covered: 0, skipped: 0 };
|
|
1049
|
+
Object.values(stats).forEach((branches) => {
|
|
1050
|
+
ret.covered += branches.filter((hits) => hits > 0).length;
|
|
1051
|
+
ret.total += branches.length;
|
|
1052
|
+
});
|
|
1053
|
+
ret.pct = percent(ret.covered, ret.total);
|
|
1054
|
+
return ret;
|
|
756
1055
|
}
|
|
757
1056
|
/**
|
|
758
1057
|
* resets hit counts for all statements, functions and branches
|
|
759
1058
|
* in this coverage object resulting in zero coverage.
|
|
760
1059
|
*/
|
|
761
1060
|
resetHits() {
|
|
762
|
-
|
|
1061
|
+
const statements = this.s;
|
|
1062
|
+
const functions = this.f;
|
|
1063
|
+
const branches = this.b;
|
|
1064
|
+
const branchesTrue = this.bT;
|
|
763
1065
|
Object.keys(statements).forEach((s) => {
|
|
764
1066
|
statements[s] = 0;
|
|
765
|
-
})
|
|
1067
|
+
});
|
|
1068
|
+
Object.keys(functions).forEach((f) => {
|
|
766
1069
|
functions[f] = 0;
|
|
767
|
-
})
|
|
1070
|
+
});
|
|
1071
|
+
Object.keys(branches).forEach((b) => {
|
|
768
1072
|
branches[b].fill(0);
|
|
769
|
-
}), branchesTrue && Object.keys(branchesTrue).forEach((bT) => {
|
|
770
|
-
branchesTrue[bT].fill(0);
|
|
771
1073
|
});
|
|
1074
|
+
if (branchesTrue) {
|
|
1075
|
+
Object.keys(branchesTrue).forEach((bT) => {
|
|
1076
|
+
branchesTrue[bT].fill(0);
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
772
1079
|
}
|
|
773
1080
|
/**
|
|
774
1081
|
* returns a CoverageSummary for this file coverage object
|
|
775
1082
|
* @returns {CoverageSummary}
|
|
776
1083
|
*/
|
|
777
1084
|
toSummary() {
|
|
778
|
-
|
|
779
|
-
|
|
1085
|
+
const ret = {};
|
|
1086
|
+
ret.lines = this.computeSimpleTotals("getLineCoverage");
|
|
1087
|
+
ret.functions = this.computeSimpleTotals("f", "fnMap");
|
|
1088
|
+
ret.statements = this.computeSimpleTotals("s", "statementMap");
|
|
1089
|
+
ret.branches = this.computeBranchTotals("b");
|
|
1090
|
+
if (this.bT) {
|
|
1091
|
+
ret.branchesTrue = this.computeBranchTotals("bT");
|
|
1092
|
+
}
|
|
1093
|
+
return new CoverageSummary(ret);
|
|
780
1094
|
}
|
|
781
1095
|
};
|
|
782
1096
|
dataProperties(FileCoverage, [
|
|
@@ -804,24 +1118,41 @@ var require_file_coverage = __commonJS({
|
|
|
804
1118
|
var require_coverage_map = __commonJS({
|
|
805
1119
|
"../../node_modules/istanbul-lib-coverage/lib/coverage-map.js"(exports, module) {
|
|
806
1120
|
"use strict";
|
|
807
|
-
var { FileCoverage } = require_file_coverage()
|
|
1121
|
+
var { FileCoverage } = require_file_coverage();
|
|
1122
|
+
var { CoverageSummary } = require_coverage_summary();
|
|
808
1123
|
function maybeConstruct(obj, klass) {
|
|
809
|
-
|
|
1124
|
+
if (obj instanceof klass) {
|
|
1125
|
+
return obj;
|
|
1126
|
+
}
|
|
1127
|
+
return new klass(obj);
|
|
810
1128
|
}
|
|
1129
|
+
__name(maybeConstruct, "maybeConstruct");
|
|
811
1130
|
function loadMap(source) {
|
|
812
|
-
|
|
813
|
-
|
|
1131
|
+
const data = /* @__PURE__ */ Object.create(null);
|
|
1132
|
+
if (!source) {
|
|
1133
|
+
return data;
|
|
1134
|
+
}
|
|
1135
|
+
Object.entries(source).forEach(([k, cov]) => {
|
|
814
1136
|
data[k] = maybeConstruct(cov, FileCoverage);
|
|
815
|
-
})
|
|
1137
|
+
});
|
|
1138
|
+
return data;
|
|
816
1139
|
}
|
|
1140
|
+
__name(loadMap, "loadMap");
|
|
817
1141
|
var CoverageMap = class _CoverageMap {
|
|
1142
|
+
static {
|
|
1143
|
+
__name(this, "CoverageMap");
|
|
1144
|
+
}
|
|
818
1145
|
/**
|
|
819
1146
|
* @constructor
|
|
820
1147
|
* @param {Object} [obj=undefined] obj A coverage map from which to initialize this
|
|
821
1148
|
* map's contents. This can be the raw global coverage object.
|
|
822
1149
|
*/
|
|
823
1150
|
constructor(obj) {
|
|
824
|
-
obj instanceof _CoverageMap
|
|
1151
|
+
if (obj instanceof _CoverageMap) {
|
|
1152
|
+
this.data = obj.data;
|
|
1153
|
+
} else {
|
|
1154
|
+
this.data = loadMap(obj);
|
|
1155
|
+
}
|
|
825
1156
|
}
|
|
826
1157
|
/**
|
|
827
1158
|
* merges a second coverage map into this one
|
|
@@ -830,7 +1161,7 @@ var require_coverage_map = __commonJS({
|
|
|
830
1161
|
* as needed.
|
|
831
1162
|
*/
|
|
832
1163
|
merge(obj) {
|
|
833
|
-
|
|
1164
|
+
const other = maybeConstruct(obj, _CoverageMap);
|
|
834
1165
|
Object.values(other.data).forEach((fc) => {
|
|
835
1166
|
this.addFileCoverage(fc);
|
|
836
1167
|
});
|
|
@@ -843,7 +1174,9 @@ var require_coverage_map = __commonJS({
|
|
|
843
1174
|
*/
|
|
844
1175
|
filter(callback) {
|
|
845
1176
|
Object.keys(this.data).forEach((k) => {
|
|
846
|
-
callback(k)
|
|
1177
|
+
if (!callback(k)) {
|
|
1178
|
+
delete this.data[k];
|
|
1179
|
+
}
|
|
847
1180
|
});
|
|
848
1181
|
}
|
|
849
1182
|
/**
|
|
@@ -866,9 +1199,10 @@ var require_coverage_map = __commonJS({
|
|
|
866
1199
|
* @returns {FileCoverage}
|
|
867
1200
|
*/
|
|
868
1201
|
fileCoverageFor(file) {
|
|
869
|
-
|
|
870
|
-
if (!fc)
|
|
1202
|
+
const fc = this.data[file];
|
|
1203
|
+
if (!fc) {
|
|
871
1204
|
throw new Error(`No file coverage available for: ${file}`);
|
|
1205
|
+
}
|
|
872
1206
|
return fc;
|
|
873
1207
|
}
|
|
874
1208
|
/**
|
|
@@ -878,18 +1212,24 @@ var require_coverage_map = __commonJS({
|
|
|
878
1212
|
* @param {FileCoverage} fc the file coverage to add
|
|
879
1213
|
*/
|
|
880
1214
|
addFileCoverage(fc) {
|
|
881
|
-
|
|
882
|
-
|
|
1215
|
+
const cov = new FileCoverage(fc);
|
|
1216
|
+
const { path } = cov;
|
|
1217
|
+
if (this.data[path]) {
|
|
1218
|
+
this.data[path].merge(cov);
|
|
1219
|
+
} else {
|
|
1220
|
+
this.data[path] = cov;
|
|
1221
|
+
}
|
|
883
1222
|
}
|
|
884
1223
|
/**
|
|
885
1224
|
* returns the coverage summary for all the file coverage objects in this map.
|
|
886
1225
|
* @returns {CoverageSummary}
|
|
887
1226
|
*/
|
|
888
1227
|
getCoverageSummary() {
|
|
889
|
-
|
|
890
|
-
|
|
1228
|
+
const ret = new CoverageSummary();
|
|
1229
|
+
Object.values(this.data).forEach((fc) => {
|
|
891
1230
|
ret.merge(fc.toSummary());
|
|
892
|
-
})
|
|
1231
|
+
});
|
|
1232
|
+
return ret;
|
|
893
1233
|
}
|
|
894
1234
|
};
|
|
895
1235
|
module.exports = {
|
|
@@ -902,7 +1242,9 @@ var require_coverage_map = __commonJS({
|
|
|
902
1242
|
var require_istanbul_lib_coverage = __commonJS({
|
|
903
1243
|
"../../node_modules/istanbul-lib-coverage/index.js"(exports, module) {
|
|
904
1244
|
"use strict";
|
|
905
|
-
var { FileCoverage } = require_file_coverage()
|
|
1245
|
+
var { FileCoverage } = require_file_coverage();
|
|
1246
|
+
var { CoverageMap } = require_coverage_map();
|
|
1247
|
+
var { CoverageSummary } = require_coverage_summary();
|
|
906
1248
|
module.exports = {
|
|
907
1249
|
/**
|
|
908
1250
|
* creates a coverage summary object
|
|
@@ -911,7 +1253,10 @@ var require_istanbul_lib_coverage = __commonJS({
|
|
|
911
1253
|
* @returns {CoverageSummary}
|
|
912
1254
|
*/
|
|
913
1255
|
createCoverageSummary(obj) {
|
|
914
|
-
|
|
1256
|
+
if (obj && obj instanceof CoverageSummary) {
|
|
1257
|
+
return obj;
|
|
1258
|
+
}
|
|
1259
|
+
return new CoverageSummary(obj);
|
|
915
1260
|
},
|
|
916
1261
|
/**
|
|
917
1262
|
* creates a CoverageMap object
|
|
@@ -920,7 +1265,10 @@ var require_istanbul_lib_coverage = __commonJS({
|
|
|
920
1265
|
* @returns {CoverageMap}
|
|
921
1266
|
*/
|
|
922
1267
|
createCoverageMap(obj) {
|
|
923
|
-
|
|
1268
|
+
if (obj && obj instanceof CoverageMap) {
|
|
1269
|
+
return obj;
|
|
1270
|
+
}
|
|
1271
|
+
return new CoverageMap(obj);
|
|
924
1272
|
},
|
|
925
1273
|
/**
|
|
926
1274
|
* creates a FileCoverage object
|
|
@@ -929,7 +1277,10 @@ var require_istanbul_lib_coverage = __commonJS({
|
|
|
929
1277
|
* @returns {FileCoverage}
|
|
930
1278
|
*/
|
|
931
1279
|
createFileCoverage(obj) {
|
|
932
|
-
|
|
1280
|
+
if (obj && obj instanceof FileCoverage) {
|
|
1281
|
+
return obj;
|
|
1282
|
+
}
|
|
1283
|
+
return new FileCoverage(obj);
|
|
933
1284
|
}
|
|
934
1285
|
};
|
|
935
1286
|
module.exports.classes = {
|
|
@@ -945,21 +1296,59 @@ var require_istanbul_lib_coverage = __commonJS({
|
|
|
945
1296
|
var require_path = __commonJS({
|
|
946
1297
|
"../../node_modules/istanbul-lib-report/lib/path.js"(exports, module) {
|
|
947
1298
|
"use strict";
|
|
948
|
-
var path = __require("path")
|
|
1299
|
+
var path = __require("path");
|
|
1300
|
+
var parsePath = path.parse;
|
|
1301
|
+
var SEP = path.sep;
|
|
1302
|
+
var origParser = parsePath;
|
|
1303
|
+
var origSep = SEP;
|
|
949
1304
|
function makeRelativeNormalizedPath(str, sep) {
|
|
950
|
-
|
|
951
|
-
|
|
1305
|
+
const parsed = parsePath(str);
|
|
1306
|
+
let root = parsed.root;
|
|
1307
|
+
let dir;
|
|
1308
|
+
let file = parsed.base;
|
|
1309
|
+
let quoted;
|
|
1310
|
+
let pos;
|
|
1311
|
+
if (sep === "\\") {
|
|
1312
|
+
pos = root.indexOf(":\\");
|
|
1313
|
+
if (pos >= 0) {
|
|
1314
|
+
root = root.substring(0, pos + 2);
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
dir = parsed.dir.substring(root.length);
|
|
1318
|
+
if (str === "") {
|
|
1319
|
+
return [];
|
|
1320
|
+
}
|
|
1321
|
+
if (sep !== "/") {
|
|
1322
|
+
quoted = new RegExp(sep.replace(/\W/g, "\\$&"), "g");
|
|
1323
|
+
dir = dir.replace(quoted, "/");
|
|
1324
|
+
file = file.replace(quoted, "/");
|
|
1325
|
+
}
|
|
1326
|
+
if (dir !== "") {
|
|
1327
|
+
dir = `${dir}/${file}`;
|
|
1328
|
+
} else {
|
|
1329
|
+
dir = file;
|
|
1330
|
+
}
|
|
1331
|
+
if (dir.substring(0, 1) === "/") {
|
|
1332
|
+
dir = dir.substring(1);
|
|
1333
|
+
}
|
|
1334
|
+
dir = dir.split(/\/+/);
|
|
1335
|
+
return dir;
|
|
952
1336
|
}
|
|
1337
|
+
__name(makeRelativeNormalizedPath, "makeRelativeNormalizedPath");
|
|
953
1338
|
var Path = class _Path {
|
|
1339
|
+
static {
|
|
1340
|
+
__name(this, "Path");
|
|
1341
|
+
}
|
|
954
1342
|
constructor(strOrArray) {
|
|
955
|
-
if (Array.isArray(strOrArray))
|
|
1343
|
+
if (Array.isArray(strOrArray)) {
|
|
956
1344
|
this.v = strOrArray;
|
|
957
|
-
else if (typeof strOrArray
|
|
1345
|
+
} else if (typeof strOrArray === "string") {
|
|
958
1346
|
this.v = makeRelativeNormalizedPath(strOrArray, SEP);
|
|
959
|
-
else
|
|
1347
|
+
} else {
|
|
960
1348
|
throw new Error(
|
|
961
1349
|
`Invalid Path argument must be string or array:${strOrArray}`
|
|
962
1350
|
);
|
|
1351
|
+
}
|
|
963
1352
|
}
|
|
964
1353
|
toString() {
|
|
965
1354
|
return this.v.join("/");
|
|
@@ -968,10 +1357,12 @@ var require_path = __commonJS({
|
|
|
968
1357
|
return this.v.length > 0;
|
|
969
1358
|
}
|
|
970
1359
|
parent() {
|
|
971
|
-
if (!this.hasParent())
|
|
1360
|
+
if (!this.hasParent()) {
|
|
972
1361
|
throw new Error("Unable to get parent for 0 elem path");
|
|
973
|
-
|
|
974
|
-
|
|
1362
|
+
}
|
|
1363
|
+
const p = this.v.slice();
|
|
1364
|
+
p.pop();
|
|
1365
|
+
return new _Path(p);
|
|
975
1366
|
}
|
|
976
1367
|
elements() {
|
|
977
1368
|
return this.v.slice();
|
|
@@ -981,12 +1372,15 @@ var require_path = __commonJS({
|
|
|
981
1372
|
}
|
|
982
1373
|
contains(other) {
|
|
983
1374
|
let i;
|
|
984
|
-
if (other.length > this.length)
|
|
985
|
-
return
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
1375
|
+
if (other.length > this.length) {
|
|
1376
|
+
return false;
|
|
1377
|
+
}
|
|
1378
|
+
for (i = 0; i < other.length; i += 1) {
|
|
1379
|
+
if (this.v[i] !== other.v[i]) {
|
|
1380
|
+
return false;
|
|
1381
|
+
}
|
|
1382
|
+
}
|
|
1383
|
+
return true;
|
|
990
1384
|
}
|
|
991
1385
|
ancestorOf(other) {
|
|
992
1386
|
return other.contains(this) && other.length !== this.length;
|
|
@@ -995,18 +1389,29 @@ var require_path = __commonJS({
|
|
|
995
1389
|
return this.contains(other) && other.length !== this.length;
|
|
996
1390
|
}
|
|
997
1391
|
commonPrefixPath(other) {
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1392
|
+
const len = this.length > other.length ? other.length : this.length;
|
|
1393
|
+
let i;
|
|
1394
|
+
const ret = [];
|
|
1395
|
+
for (i = 0; i < len; i += 1) {
|
|
1396
|
+
if (this.v[i] === other.v[i]) {
|
|
1397
|
+
ret.push(this.v[i]);
|
|
1398
|
+
} else {
|
|
1399
|
+
break;
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1001
1402
|
return new _Path(ret);
|
|
1002
1403
|
}
|
|
1003
1404
|
static compare(a, b) {
|
|
1004
|
-
|
|
1005
|
-
|
|
1405
|
+
const al = a.length;
|
|
1406
|
+
const bl = b.length;
|
|
1407
|
+
if (al < bl) {
|
|
1006
1408
|
return -1;
|
|
1007
|
-
|
|
1409
|
+
}
|
|
1410
|
+
if (al > bl) {
|
|
1008
1411
|
return 1;
|
|
1009
|
-
|
|
1412
|
+
}
|
|
1413
|
+
const astr = a.toString();
|
|
1414
|
+
const bstr = b.toString();
|
|
1010
1415
|
return astr < bstr ? -1 : astr > bstr ? 1 : 0;
|
|
1011
1416
|
}
|
|
1012
1417
|
};
|
|
@@ -1018,7 +1423,7 @@ var require_path = __commonJS({
|
|
|
1018
1423
|
});
|
|
1019
1424
|
});
|
|
1020
1425
|
Object.defineProperty(Path.prototype, "length", {
|
|
1021
|
-
enumerable:
|
|
1426
|
+
enumerable: true,
|
|
1022
1427
|
get() {
|
|
1023
1428
|
return this.v.length;
|
|
1024
1429
|
}
|
|
@@ -1026,10 +1431,12 @@ var require_path = __commonJS({
|
|
|
1026
1431
|
module.exports = Path;
|
|
1027
1432
|
Path.tester = {
|
|
1028
1433
|
setParserAndSep(p, sep) {
|
|
1029
|
-
parsePath = p
|
|
1434
|
+
parsePath = p;
|
|
1435
|
+
SEP = sep;
|
|
1030
1436
|
},
|
|
1031
1437
|
reset() {
|
|
1032
|
-
parsePath = origParser
|
|
1438
|
+
parsePath = origParser;
|
|
1439
|
+
SEP = origSep;
|
|
1033
1440
|
}
|
|
1034
1441
|
};
|
|
1035
1442
|
}
|
|
@@ -1039,30 +1446,51 @@ var require_path = __commonJS({
|
|
|
1039
1446
|
var require_summarizer_factory = __commonJS({
|
|
1040
1447
|
"../../node_modules/istanbul-lib-report/lib/summarizer-factory.js"(exports, module) {
|
|
1041
1448
|
"use strict";
|
|
1042
|
-
var coverage = require_istanbul_lib_coverage()
|
|
1449
|
+
var coverage = require_istanbul_lib_coverage();
|
|
1450
|
+
var Path = require_path();
|
|
1451
|
+
var { BaseNode, BaseTree } = require_tree();
|
|
1452
|
+
var ReportNode = class _ReportNode extends BaseNode {
|
|
1453
|
+
static {
|
|
1454
|
+
__name(this, "ReportNode");
|
|
1455
|
+
}
|
|
1043
1456
|
constructor(path, fileCoverage) {
|
|
1044
|
-
super()
|
|
1457
|
+
super();
|
|
1458
|
+
this.path = path;
|
|
1459
|
+
this.parent = null;
|
|
1460
|
+
this.fileCoverage = fileCoverage;
|
|
1461
|
+
this.children = [];
|
|
1045
1462
|
}
|
|
1046
1463
|
static createRoot(children) {
|
|
1047
|
-
|
|
1048
|
-
|
|
1464
|
+
const root = new _ReportNode(new Path([]));
|
|
1465
|
+
children.forEach((child) => {
|
|
1049
1466
|
root.addChild(child);
|
|
1050
|
-
})
|
|
1467
|
+
});
|
|
1468
|
+
return root;
|
|
1051
1469
|
}
|
|
1052
1470
|
addChild(child) {
|
|
1053
|
-
child.parent = this
|
|
1471
|
+
child.parent = this;
|
|
1472
|
+
this.children.push(child);
|
|
1054
1473
|
}
|
|
1055
1474
|
asRelative(p) {
|
|
1056
|
-
|
|
1475
|
+
if (p.substring(0, 1) === "/") {
|
|
1476
|
+
return p.substring(1);
|
|
1477
|
+
}
|
|
1478
|
+
return p;
|
|
1057
1479
|
}
|
|
1058
1480
|
getQualifiedName() {
|
|
1059
1481
|
return this.asRelative(this.path.toString());
|
|
1060
1482
|
}
|
|
1061
1483
|
getRelativeName() {
|
|
1062
|
-
|
|
1484
|
+
const parent = this.getParent();
|
|
1485
|
+
const myPath = this.path;
|
|
1486
|
+
let relPath;
|
|
1487
|
+
let i;
|
|
1488
|
+
const parentPath = parent ? parent.path : new Path([]);
|
|
1063
1489
|
if (parentPath.ancestorOf(myPath)) {
|
|
1064
|
-
|
|
1490
|
+
relPath = new Path(myPath.elements());
|
|
1491
|
+
for (i = 0; i < parentPath.length; i += 1) {
|
|
1065
1492
|
relPath.shift();
|
|
1493
|
+
}
|
|
1066
1494
|
return this.asRelative(relPath.toString());
|
|
1067
1495
|
}
|
|
1068
1496
|
return this.asRelative(this.path.toString());
|
|
@@ -1080,30 +1508,49 @@ var require_summarizer_factory = __commonJS({
|
|
|
1080
1508
|
return this.fileCoverage;
|
|
1081
1509
|
}
|
|
1082
1510
|
getCoverageSummary(filesOnly) {
|
|
1083
|
-
|
|
1084
|
-
|
|
1511
|
+
const cacheProp = `c_${filesOnly ? "files" : "full"}`;
|
|
1512
|
+
let summary;
|
|
1513
|
+
if (Object.prototype.hasOwnProperty.call(this, cacheProp)) {
|
|
1085
1514
|
return this[cacheProp];
|
|
1086
|
-
|
|
1515
|
+
}
|
|
1516
|
+
if (!this.isSummary()) {
|
|
1087
1517
|
summary = this.getFileCoverage().toSummary();
|
|
1088
|
-
else {
|
|
1518
|
+
} else {
|
|
1089
1519
|
let count = 0;
|
|
1090
|
-
summary = coverage.createCoverageSummary()
|
|
1091
|
-
|
|
1092
|
-
|
|
1520
|
+
summary = coverage.createCoverageSummary();
|
|
1521
|
+
this.getChildren().forEach((child) => {
|
|
1522
|
+
if (filesOnly && child.isSummary()) {
|
|
1523
|
+
return;
|
|
1524
|
+
}
|
|
1525
|
+
count += 1;
|
|
1526
|
+
summary.merge(child.getCoverageSummary(filesOnly));
|
|
1527
|
+
});
|
|
1528
|
+
if (count === 0 && filesOnly) {
|
|
1529
|
+
summary = null;
|
|
1530
|
+
}
|
|
1093
1531
|
}
|
|
1094
|
-
|
|
1532
|
+
this[cacheProp] = summary;
|
|
1533
|
+
return summary;
|
|
1534
|
+
}
|
|
1535
|
+
};
|
|
1536
|
+
var ReportTree = class extends BaseTree {
|
|
1537
|
+
static {
|
|
1538
|
+
__name(this, "ReportTree");
|
|
1095
1539
|
}
|
|
1096
|
-
}, ReportTree = class extends BaseTree {
|
|
1097
1540
|
constructor(root, childPrefix) {
|
|
1098
1541
|
super(root);
|
|
1099
|
-
|
|
1100
|
-
childPrefix && !node.isRoot()
|
|
1101
|
-
|
|
1542
|
+
const maybePrefix = /* @__PURE__ */ __name((node) => {
|
|
1543
|
+
if (childPrefix && !node.isRoot()) {
|
|
1544
|
+
node.path.unshift(childPrefix);
|
|
1545
|
+
}
|
|
1546
|
+
}, "maybePrefix");
|
|
1102
1547
|
this.visit({
|
|
1103
1548
|
onDetail: maybePrefix,
|
|
1104
1549
|
onSummary(node) {
|
|
1105
|
-
maybePrefix(node)
|
|
1106
|
-
|
|
1550
|
+
maybePrefix(node);
|
|
1551
|
+
node.children.sort((a, b) => {
|
|
1552
|
+
const astr = a.path.toString();
|
|
1553
|
+
const bstr = b.path.toString();
|
|
1107
1554
|
return astr < bstr ? -1 : astr > bstr ? 1 : (
|
|
1108
1555
|
/* istanbul ignore next */
|
|
1109
1556
|
0
|
|
@@ -1119,79 +1566,132 @@ var require_summarizer_factory = __commonJS({
|
|
|
1119
1566
|
paths[0] || new Path([])
|
|
1120
1567
|
);
|
|
1121
1568
|
}
|
|
1569
|
+
__name(findCommonParent, "findCommonParent");
|
|
1122
1570
|
function findOrCreateParent(parentPath, nodeMap, created = () => {
|
|
1123
1571
|
}) {
|
|
1124
1572
|
let parent = nodeMap[parentPath.toString()];
|
|
1125
|
-
|
|
1573
|
+
if (!parent) {
|
|
1574
|
+
parent = new ReportNode(parentPath);
|
|
1575
|
+
nodeMap[parentPath.toString()] = parent;
|
|
1576
|
+
created(parentPath, parent);
|
|
1577
|
+
}
|
|
1578
|
+
return parent;
|
|
1126
1579
|
}
|
|
1580
|
+
__name(findOrCreateParent, "findOrCreateParent");
|
|
1127
1581
|
function toDirParents(list) {
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
findOrCreateParent(o.path.parent(), nodeMap)
|
|
1131
|
-
|
|
1582
|
+
const nodeMap = /* @__PURE__ */ Object.create(null);
|
|
1583
|
+
list.forEach((o) => {
|
|
1584
|
+
const parent = findOrCreateParent(o.path.parent(), nodeMap);
|
|
1585
|
+
parent.addChild(new ReportNode(o.path, o.fileCoverage));
|
|
1586
|
+
});
|
|
1587
|
+
return Object.values(nodeMap);
|
|
1132
1588
|
}
|
|
1589
|
+
__name(toDirParents, "toDirParents");
|
|
1133
1590
|
function addAllPaths(topPaths, nodeMap, path, node) {
|
|
1134
|
-
findOrCreateParent(
|
|
1591
|
+
const parent = findOrCreateParent(
|
|
1135
1592
|
path.parent(),
|
|
1136
1593
|
nodeMap,
|
|
1137
1594
|
(parentPath, parent2) => {
|
|
1138
|
-
parentPath.hasParent()
|
|
1595
|
+
if (parentPath.hasParent()) {
|
|
1596
|
+
addAllPaths(topPaths, nodeMap, parentPath, parent2);
|
|
1597
|
+
} else {
|
|
1598
|
+
topPaths.push(parent2);
|
|
1599
|
+
}
|
|
1139
1600
|
}
|
|
1140
|
-
)
|
|
1601
|
+
);
|
|
1602
|
+
parent.addChild(node);
|
|
1141
1603
|
}
|
|
1604
|
+
__name(addAllPaths, "addAllPaths");
|
|
1142
1605
|
function foldIntoOneDir(node, parent) {
|
|
1143
|
-
|
|
1144
|
-
|
|
1606
|
+
const { children } = node;
|
|
1607
|
+
if (children.length === 1 && !children[0].fileCoverage) {
|
|
1608
|
+
children[0].parent = parent;
|
|
1609
|
+
return foldIntoOneDir(children[0], parent);
|
|
1610
|
+
}
|
|
1611
|
+
node.children = children.map((child) => foldIntoOneDir(child, node));
|
|
1612
|
+
return node;
|
|
1145
1613
|
}
|
|
1614
|
+
__name(foldIntoOneDir, "foldIntoOneDir");
|
|
1146
1615
|
function pkgSummaryPrefix(dirParents, commonParent) {
|
|
1147
|
-
if (dirParents.some((dp) => dp.path.length === 0))
|
|
1148
|
-
return
|
|
1616
|
+
if (!dirParents.some((dp) => dp.path.length === 0)) {
|
|
1617
|
+
return;
|
|
1618
|
+
}
|
|
1619
|
+
if (commonParent.length === 0) {
|
|
1620
|
+
return "root";
|
|
1621
|
+
}
|
|
1622
|
+
return commonParent.name();
|
|
1149
1623
|
}
|
|
1624
|
+
__name(pkgSummaryPrefix, "pkgSummaryPrefix");
|
|
1150
1625
|
var SummarizerFactory = class {
|
|
1626
|
+
static {
|
|
1627
|
+
__name(this, "SummarizerFactory");
|
|
1628
|
+
}
|
|
1151
1629
|
constructor(coverageMap, defaultSummarizer = "pkg") {
|
|
1152
|
-
this._coverageMap = coverageMap
|
|
1630
|
+
this._coverageMap = coverageMap;
|
|
1631
|
+
this._defaultSummarizer = defaultSummarizer;
|
|
1632
|
+
this._initialList = coverageMap.files().map((filePath) => ({
|
|
1153
1633
|
filePath,
|
|
1154
1634
|
path: new Path(filePath),
|
|
1155
1635
|
fileCoverage: coverageMap.fileCoverageFor(filePath)
|
|
1156
|
-
}))
|
|
1636
|
+
}));
|
|
1637
|
+
this._commonParent = findCommonParent(
|
|
1157
1638
|
this._initialList.map((o) => o.path.parent())
|
|
1158
|
-
)
|
|
1159
|
-
|
|
1160
|
-
|
|
1639
|
+
);
|
|
1640
|
+
if (this._commonParent.length > 0) {
|
|
1641
|
+
this._initialList.forEach((o) => {
|
|
1642
|
+
o.path.splice(0, this._commonParent.length);
|
|
1643
|
+
});
|
|
1644
|
+
}
|
|
1161
1645
|
}
|
|
1162
1646
|
get defaultSummarizer() {
|
|
1163
1647
|
return this[this._defaultSummarizer];
|
|
1164
1648
|
}
|
|
1165
1649
|
get flat() {
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1650
|
+
if (!this._flat) {
|
|
1651
|
+
this._flat = new ReportTree(
|
|
1652
|
+
ReportNode.createRoot(
|
|
1653
|
+
this._initialList.map(
|
|
1654
|
+
(node) => new ReportNode(node.path, node.fileCoverage)
|
|
1655
|
+
)
|
|
1170
1656
|
)
|
|
1171
|
-
)
|
|
1172
|
-
|
|
1657
|
+
);
|
|
1658
|
+
}
|
|
1659
|
+
return this._flat;
|
|
1173
1660
|
}
|
|
1174
1661
|
_createPkg() {
|
|
1175
|
-
|
|
1176
|
-
|
|
1662
|
+
const dirParents = toDirParents(this._initialList);
|
|
1663
|
+
if (dirParents.length === 1) {
|
|
1664
|
+
return new ReportTree(dirParents[0]);
|
|
1665
|
+
}
|
|
1666
|
+
return new ReportTree(
|
|
1177
1667
|
ReportNode.createRoot(dirParents),
|
|
1178
1668
|
pkgSummaryPrefix(dirParents, this._commonParent)
|
|
1179
1669
|
);
|
|
1180
1670
|
}
|
|
1181
1671
|
get pkg() {
|
|
1182
|
-
|
|
1672
|
+
if (!this._pkg) {
|
|
1673
|
+
this._pkg = this._createPkg();
|
|
1674
|
+
}
|
|
1675
|
+
return this._pkg;
|
|
1183
1676
|
}
|
|
1184
1677
|
_createNested() {
|
|
1185
|
-
|
|
1678
|
+
const nodeMap = /* @__PURE__ */ Object.create(null);
|
|
1679
|
+
const topPaths = [];
|
|
1186
1680
|
this._initialList.forEach((o) => {
|
|
1187
|
-
|
|
1681
|
+
const node = new ReportNode(o.path, o.fileCoverage);
|
|
1188
1682
|
addAllPaths(topPaths, nodeMap, o.path, node);
|
|
1189
1683
|
});
|
|
1190
|
-
|
|
1191
|
-
|
|
1684
|
+
const topNodes = topPaths.map((node) => foldIntoOneDir(node));
|
|
1685
|
+
if (topNodes.length === 1) {
|
|
1686
|
+
return new ReportTree(topNodes[0]);
|
|
1687
|
+
}
|
|
1688
|
+
return new ReportTree(ReportNode.createRoot(topNodes));
|
|
1192
1689
|
}
|
|
1193
1690
|
get nested() {
|
|
1194
|
-
|
|
1691
|
+
if (!this._nested) {
|
|
1692
|
+
this._nested = this._createNested();
|
|
1693
|
+
}
|
|
1694
|
+
return this._nested;
|
|
1195
1695
|
}
|
|
1196
1696
|
};
|
|
1197
1697
|
module.exports = SummarizerFactory;
|
|
@@ -1202,7 +1702,12 @@ var require_summarizer_factory = __commonJS({
|
|
|
1202
1702
|
var require_context = __commonJS({
|
|
1203
1703
|
"../../node_modules/istanbul-lib-report/lib/context.js"(exports, module) {
|
|
1204
1704
|
"use strict";
|
|
1205
|
-
var fs = __require("fs")
|
|
1705
|
+
var fs = __require("fs");
|
|
1706
|
+
var FileWriter = require_file_writer();
|
|
1707
|
+
var XMLWriter = require_xml_writer();
|
|
1708
|
+
var tree = require_tree();
|
|
1709
|
+
var watermarks = require_watermarks();
|
|
1710
|
+
var SummarizerFactory = require_summarizer_factory();
|
|
1206
1711
|
function defaultSourceLookup(path) {
|
|
1207
1712
|
try {
|
|
1208
1713
|
return fs.readFileSync(path, "utf8");
|
|
@@ -1210,18 +1715,30 @@ var require_context = __commonJS({
|
|
|
1210
1715
|
throw new Error(`Unable to lookup source: ${path} (${ex.message})`);
|
|
1211
1716
|
}
|
|
1212
1717
|
}
|
|
1718
|
+
__name(defaultSourceLookup, "defaultSourceLookup");
|
|
1213
1719
|
function normalizeWatermarks(specified = {}) {
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
(!Array.isArray(specValue) || specValue.length !== 2)
|
|
1217
|
-
|
|
1720
|
+
Object.entries(watermarks.getDefault()).forEach(([k, value]) => {
|
|
1721
|
+
const specValue = specified[k];
|
|
1722
|
+
if (!Array.isArray(specValue) || specValue.length !== 2) {
|
|
1723
|
+
specified[k] = value;
|
|
1724
|
+
}
|
|
1725
|
+
});
|
|
1726
|
+
return specified;
|
|
1218
1727
|
}
|
|
1728
|
+
__name(normalizeWatermarks, "normalizeWatermarks");
|
|
1219
1729
|
var Context = class {
|
|
1730
|
+
static {
|
|
1731
|
+
__name(this, "Context");
|
|
1732
|
+
}
|
|
1220
1733
|
constructor(opts) {
|
|
1221
|
-
this.dir = opts.dir || "coverage"
|
|
1734
|
+
this.dir = opts.dir || "coverage";
|
|
1735
|
+
this.watermarks = normalizeWatermarks(opts.watermarks);
|
|
1736
|
+
this.sourceFinder = opts.sourceFinder || defaultSourceLookup;
|
|
1737
|
+
this._summarizerFactory = new SummarizerFactory(
|
|
1222
1738
|
opts.coverageMap,
|
|
1223
1739
|
opts.defaultSummarizer
|
|
1224
|
-
)
|
|
1740
|
+
);
|
|
1741
|
+
this.data = {};
|
|
1225
1742
|
}
|
|
1226
1743
|
/**
|
|
1227
1744
|
* returns a FileWriter implementation for reporting use. Also available
|
|
@@ -1249,8 +1766,17 @@ var require_context = __commonJS({
|
|
|
1249
1766
|
* @returns {String} one of `high`, `medium` or `low`
|
|
1250
1767
|
*/
|
|
1251
1768
|
classForPercent(type, value) {
|
|
1252
|
-
|
|
1253
|
-
|
|
1769
|
+
const watermarks2 = this.watermarks[type];
|
|
1770
|
+
if (!watermarks2) {
|
|
1771
|
+
return "unknown";
|
|
1772
|
+
}
|
|
1773
|
+
if (value < watermarks2[0]) {
|
|
1774
|
+
return "low";
|
|
1775
|
+
}
|
|
1776
|
+
if (value >= watermarks2[1]) {
|
|
1777
|
+
return "high";
|
|
1778
|
+
}
|
|
1779
|
+
return "medium";
|
|
1254
1780
|
}
|
|
1255
1781
|
/**
|
|
1256
1782
|
* returns an XML writer for the supplied content writer
|
|
@@ -1276,9 +1802,12 @@ var require_context = __commonJS({
|
|
|
1276
1802
|
}
|
|
1277
1803
|
};
|
|
1278
1804
|
Object.defineProperty(Context.prototype, "writer", {
|
|
1279
|
-
enumerable:
|
|
1805
|
+
enumerable: true,
|
|
1280
1806
|
get() {
|
|
1281
|
-
|
|
1807
|
+
if (!this.data.writer) {
|
|
1808
|
+
this.data.writer = new FileWriter(this.dir);
|
|
1809
|
+
}
|
|
1810
|
+
return this.data.writer;
|
|
1282
1811
|
}
|
|
1283
1812
|
});
|
|
1284
1813
|
module.exports = Context;
|
|
@@ -1289,7 +1818,11 @@ var require_context = __commonJS({
|
|
|
1289
1818
|
var require_report_base = __commonJS({
|
|
1290
1819
|
"../../node_modules/istanbul-lib-report/lib/report-base.js"(exports, module) {
|
|
1291
1820
|
"use strict";
|
|
1292
|
-
var _summarizer = Symbol("ReportBase.#summarizer")
|
|
1821
|
+
var _summarizer = Symbol("ReportBase.#summarizer");
|
|
1822
|
+
var ReportBase2 = class {
|
|
1823
|
+
static {
|
|
1824
|
+
__name(this, "ReportBase");
|
|
1825
|
+
}
|
|
1293
1826
|
constructor(opts = {}) {
|
|
1294
1827
|
this[_summarizer] = opts.summarizer;
|
|
1295
1828
|
}
|
|
@@ -1305,7 +1838,9 @@ var require_report_base = __commonJS({
|
|
|
1305
1838
|
var require_istanbul_lib_report = __commonJS({
|
|
1306
1839
|
"../../node_modules/istanbul-lib-report/index.js"(exports, module) {
|
|
1307
1840
|
"use strict";
|
|
1308
|
-
var Context = require_context()
|
|
1841
|
+
var Context = require_context();
|
|
1842
|
+
var watermarks = require_watermarks();
|
|
1843
|
+
var ReportBase2 = require_report_base();
|
|
1309
1844
|
module.exports = {
|
|
1310
1845
|
/**
|
|
1311
1846
|
* returns a reporting context for the supplied options
|
|
@@ -1334,16 +1869,26 @@ var require_istanbul_lib_report = __commonJS({
|
|
|
1334
1869
|
});
|
|
1335
1870
|
|
|
1336
1871
|
// src/node/coverage-reporter.ts
|
|
1337
|
-
var import_istanbul_lib_report = __toESM(require_istanbul_lib_report(), 1)
|
|
1872
|
+
var import_istanbul_lib_report = __toESM(require_istanbul_lib_report(), 1);
|
|
1873
|
+
var StorybookCoverageReporter = class extends import_istanbul_lib_report.ReportBase {
|
|
1874
|
+
static {
|
|
1875
|
+
__name(this, "StorybookCoverageReporter");
|
|
1876
|
+
}
|
|
1338
1877
|
#testManager;
|
|
1339
1878
|
#coverageOptions;
|
|
1340
1879
|
constructor(opts) {
|
|
1341
|
-
super()
|
|
1880
|
+
super();
|
|
1881
|
+
this.#testManager = opts.testManager;
|
|
1882
|
+
this.#coverageOptions = opts.coverageOptions;
|
|
1342
1883
|
}
|
|
1343
1884
|
onSummary(node) {
|
|
1344
|
-
if (!node.isRoot())
|
|
1885
|
+
if (!node.isRoot()) {
|
|
1345
1886
|
return;
|
|
1346
|
-
|
|
1887
|
+
}
|
|
1888
|
+
const rawCoverageSummary = node.getCoverageSummary(false);
|
|
1889
|
+
const percentage = Math.round(rawCoverageSummary.data.statements.pct);
|
|
1890
|
+
const [lowWatermark = 50, highWatermark = 80] = this.#coverageOptions?.watermarks?.statements ?? [];
|
|
1891
|
+
const coverageSummary = {
|
|
1347
1892
|
percentage,
|
|
1348
1893
|
status: percentage < lowWatermark ? "negative" : percentage < highWatermark ? "warning" : "positive"
|
|
1349
1894
|
};
|