as-test 1.1.2 → 1.1.4
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/CHANGELOG.md +19 -5
- package/README.md +150 -149
- package/as-test.config.schema.json +24 -0
- package/assembly/coverage.ts +12 -0
- package/assembly/index.ts +16 -0
- package/assembly/src/suite.ts +2 -0
- package/assembly/test.ts +85 -0
- package/bin/commands/run-core.js +63 -4
- package/bin/commands/run.js +3 -1
- package/bin/commands/test.js +3 -1
- package/bin/coverage-points.js +207 -2
- package/bin/index.js +56 -2
- package/bin/reporters/default.js +120 -31
- package/bin/types.js +2 -0
- package/bin/util.js +24 -1
- package/package.json +3 -2
- package/transform/lib/coverage.js +220 -71
package/bin/commands/run-core.js
CHANGED
|
@@ -719,6 +719,8 @@ export async function run(flags = {}, configPath = DEFAULT_CONFIG_PATH, selector
|
|
|
719
719
|
clean: cleanOutput,
|
|
720
720
|
snapshotEnabled,
|
|
721
721
|
showCoverage,
|
|
722
|
+
showCoverageAll: Boolean(flags.showCoverageAll),
|
|
723
|
+
verbose: Boolean(flags.verbose),
|
|
722
724
|
buildTime,
|
|
723
725
|
snapshotSummary,
|
|
724
726
|
coverageSummary,
|
|
@@ -1204,6 +1206,10 @@ function normalizeCoverage(value) {
|
|
|
1204
1206
|
column: Number(p.column ?? 0),
|
|
1205
1207
|
type: String(p.type ?? ""),
|
|
1206
1208
|
executed: Boolean(p.executed),
|
|
1209
|
+
parentHash: String(p.parentHash ?? ""),
|
|
1210
|
+
scopeKind: String(p.scopeKind ?? ""),
|
|
1211
|
+
scopeName: String(p.scopeName ?? ""),
|
|
1212
|
+
depth: Number(p.depth ?? 0),
|
|
1207
1213
|
};
|
|
1208
1214
|
})
|
|
1209
1215
|
.filter((point) => point.file.length > 0);
|
|
@@ -1307,12 +1313,18 @@ function isIgnoredCoverageFile(file, coverage) {
|
|
|
1307
1313
|
const normalized = file.replace(/\\/g, "/");
|
|
1308
1314
|
if (!isAllowedCoverageSourceFile(normalized))
|
|
1309
1315
|
return true;
|
|
1310
|
-
if (normalized.startsWith("node_modules/"))
|
|
1311
|
-
return true;
|
|
1312
|
-
if (normalized.includes("/node_modules/"))
|
|
1313
|
-
return true;
|
|
1314
1316
|
if (isAssemblyScriptStdlibFile(normalized))
|
|
1315
1317
|
return true;
|
|
1318
|
+
const classification = classifyCoverageFile(normalized);
|
|
1319
|
+
if (classification.kind == "dependency") {
|
|
1320
|
+
if (coverage.mode != "all" && !coverage.dependencies.length)
|
|
1321
|
+
return true;
|
|
1322
|
+
if (coverage.dependencies.length &&
|
|
1323
|
+
(!classification.packageName ||
|
|
1324
|
+
!coverage.dependencies.includes(classification.packageName))) {
|
|
1325
|
+
return true;
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1316
1328
|
if (!coverage.includeSpecs && normalized.endsWith(".spec.ts"))
|
|
1317
1329
|
return true;
|
|
1318
1330
|
if (coverage.include.length &&
|
|
@@ -1381,11 +1393,42 @@ function isAssemblyScriptStdlibFile(file) {
|
|
|
1381
1393
|
return true;
|
|
1382
1394
|
return false;
|
|
1383
1395
|
}
|
|
1396
|
+
function classifyCoverageFile(file) {
|
|
1397
|
+
const packageName = resolveCoverageDependencyPackage(file);
|
|
1398
|
+
if (packageName) {
|
|
1399
|
+
return { kind: "dependency", packageName };
|
|
1400
|
+
}
|
|
1401
|
+
return { kind: "project", packageName: null };
|
|
1402
|
+
}
|
|
1403
|
+
function resolveCoverageDependencyPackage(file) {
|
|
1404
|
+
const normalized = file.replace(/\\/g, "/");
|
|
1405
|
+
const marker = "/node_modules/";
|
|
1406
|
+
const prefixed = normalized.startsWith("node_modules/")
|
|
1407
|
+
? `/${normalized}`
|
|
1408
|
+
: normalized;
|
|
1409
|
+
const index = prefixed.lastIndexOf(marker);
|
|
1410
|
+
if (index == -1)
|
|
1411
|
+
return null;
|
|
1412
|
+
const after = prefixed.slice(index + marker.length);
|
|
1413
|
+
if (!after.length)
|
|
1414
|
+
return null;
|
|
1415
|
+
const segments = after.split("/").filter(Boolean);
|
|
1416
|
+
if (!segments.length)
|
|
1417
|
+
return null;
|
|
1418
|
+
if (segments[0].startsWith("@")) {
|
|
1419
|
+
if (segments.length < 2)
|
|
1420
|
+
return null;
|
|
1421
|
+
return `${segments[0]}/${segments[1]}`;
|
|
1422
|
+
}
|
|
1423
|
+
return segments[0];
|
|
1424
|
+
}
|
|
1384
1425
|
function resolveCoverageOptions(raw) {
|
|
1385
1426
|
if (typeof raw == "boolean") {
|
|
1386
1427
|
return {
|
|
1387
1428
|
enabled: raw,
|
|
1429
|
+
mode: "project",
|
|
1388
1430
|
includeSpecs: false,
|
|
1431
|
+
dependencies: [],
|
|
1389
1432
|
include: [],
|
|
1390
1433
|
exclude: [],
|
|
1391
1434
|
ignore: {
|
|
@@ -1403,7 +1446,11 @@ function resolveCoverageOptions(raw) {
|
|
|
1403
1446
|
: null;
|
|
1404
1447
|
return {
|
|
1405
1448
|
enabled: obj.enabled == null ? false : Boolean(obj.enabled),
|
|
1449
|
+
mode: obj.mode == "all" ? "all" : "project",
|
|
1406
1450
|
includeSpecs: Boolean(obj.includeSpecs),
|
|
1451
|
+
dependencies: Array.isArray(obj.dependencies)
|
|
1452
|
+
? obj.dependencies.filter((item) => typeof item == "string")
|
|
1453
|
+
: [],
|
|
1407
1454
|
include: Array.isArray(obj.include)
|
|
1408
1455
|
? obj.include.filter((item) => typeof item == "string")
|
|
1409
1456
|
: [],
|
|
@@ -1428,7 +1475,9 @@ function resolveCoverageOptions(raw) {
|
|
|
1428
1475
|
}
|
|
1429
1476
|
return {
|
|
1430
1477
|
enabled: false,
|
|
1478
|
+
mode: "project",
|
|
1431
1479
|
includeSpecs: false,
|
|
1480
|
+
dependencies: [],
|
|
1432
1481
|
include: [],
|
|
1433
1482
|
exclude: [],
|
|
1434
1483
|
ignore: {
|
|
@@ -1475,10 +1524,14 @@ function matchesCoverageTextPattern(value, pattern) {
|
|
|
1475
1524
|
return globPatternToRegExp(normalized).test(value);
|
|
1476
1525
|
}
|
|
1477
1526
|
function compareCoveragePoints(a, b) {
|
|
1527
|
+
const depthA = a.depth ?? 0;
|
|
1528
|
+
const depthB = b.depth ?? 0;
|
|
1478
1529
|
if (a.line !== b.line)
|
|
1479
1530
|
return a.line - b.line;
|
|
1480
1531
|
if (a.column !== b.column)
|
|
1481
1532
|
return a.column - b.column;
|
|
1533
|
+
if (depthA !== depthB)
|
|
1534
|
+
return depthA - depthB;
|
|
1482
1535
|
if (a.type !== b.type)
|
|
1483
1536
|
return a.type.localeCompare(b.type);
|
|
1484
1537
|
return a.hash.localeCompare(b.hash);
|
|
@@ -2479,3 +2532,9 @@ function resolveReporterFactory(mod) {
|
|
|
2479
2532
|
}
|
|
2480
2533
|
throw new Error(`reporter module must export a factory as "createReporter" or default`);
|
|
2481
2534
|
}
|
|
2535
|
+
export const __coverageInternals = {
|
|
2536
|
+
classifyCoverageFile,
|
|
2537
|
+
resolveCoverageDependencyPackage,
|
|
2538
|
+
isIgnoredCoverageFile,
|
|
2539
|
+
resolveCoverageOptions,
|
|
2540
|
+
};
|
package/bin/commands/run.js
CHANGED
|
@@ -4,12 +4,14 @@ export async function executeRunCommand(rawArgs, flags, configPath, selectedMode
|
|
|
4
4
|
const suiteSelectors = deps.resolveSuiteSelectors(rawArgs, "run");
|
|
5
5
|
const listFlags = deps.resolveListFlags(rawArgs, "run");
|
|
6
6
|
const featureToggles = deps.resolveFeatureToggles(rawArgs, "run");
|
|
7
|
+
const showCoverageMode = deps.resolveShowCoverageMode(rawArgs, "run");
|
|
7
8
|
const runFlags = {
|
|
8
9
|
snapshot: !flags.includes("--no-snapshot"),
|
|
9
10
|
createSnapshots: flags.includes("--create-snapshots"),
|
|
10
11
|
overwriteSnapshots: flags.includes("--overwrite-snapshots"),
|
|
11
12
|
clean: flags.includes("--clean"),
|
|
12
|
-
showCoverage:
|
|
13
|
+
showCoverage: showCoverageMode != undefined,
|
|
14
|
+
showCoverageAll: showCoverageMode == "all",
|
|
13
15
|
verbose: flags.includes("--verbose"),
|
|
14
16
|
...deps.resolveParallelJobs(rawArgs, "run"),
|
|
15
17
|
coverage: featureToggles.coverage,
|
package/bin/commands/test.js
CHANGED
|
@@ -8,12 +8,14 @@ export async function executeTestCommand(rawArgs, flags, configPath, selectedMod
|
|
|
8
8
|
tryAs: featureToggles.tryAs,
|
|
9
9
|
coverage: featureToggles.coverage,
|
|
10
10
|
};
|
|
11
|
+
const showCoverageMode = deps.resolveShowCoverageMode(rawArgs, "test");
|
|
11
12
|
const runFlags = {
|
|
12
13
|
snapshot: !flags.includes("--no-snapshot"),
|
|
13
14
|
createSnapshots: flags.includes("--create-snapshots"),
|
|
14
15
|
overwriteSnapshots: flags.includes("--overwrite-snapshots"),
|
|
15
16
|
clean: flags.includes("--clean"),
|
|
16
|
-
showCoverage:
|
|
17
|
+
showCoverage: showCoverageMode != undefined,
|
|
18
|
+
showCoverageAll: showCoverageMode == "all",
|
|
17
19
|
verbose: flags.includes("--verbose"),
|
|
18
20
|
...deps.resolveParallelJobs(rawArgs, "test"),
|
|
19
21
|
coverage: featureToggles.coverage,
|
package/bin/coverage-points.js
CHANGED
|
@@ -13,7 +13,61 @@ export function describeCoveragePoint(file, line, column, fallbackType) {
|
|
|
13
13
|
highlightEnd: 0,
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
-
const
|
|
16
|
+
const parameter = detectCoverageParameter(context.visible, context.focus, fallbackType);
|
|
17
|
+
if (parameter) {
|
|
18
|
+
return {
|
|
19
|
+
displayType: parameter.type,
|
|
20
|
+
subjectName: parameter.name,
|
|
21
|
+
visible: context.visible,
|
|
22
|
+
focus: context.focus,
|
|
23
|
+
highlightStart: parameter.start,
|
|
24
|
+
highlightEnd: parameter.end,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
const ternary = detectCoverageTernary(context.visible, context.focus, fallbackType);
|
|
28
|
+
if (ternary) {
|
|
29
|
+
return {
|
|
30
|
+
displayType: ternary.type,
|
|
31
|
+
subjectName: null,
|
|
32
|
+
visible: context.visible,
|
|
33
|
+
focus: context.focus,
|
|
34
|
+
highlightStart: ternary.start,
|
|
35
|
+
highlightEnd: ternary.end,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const ifBranch = detectCoverageIfBranch(context.visible, fallbackType);
|
|
39
|
+
if (ifBranch) {
|
|
40
|
+
return {
|
|
41
|
+
displayType: ifBranch.type,
|
|
42
|
+
subjectName: null,
|
|
43
|
+
visible: context.visible,
|
|
44
|
+
focus: context.focus,
|
|
45
|
+
highlightStart: ifBranch.start,
|
|
46
|
+
highlightEnd: ifBranch.end,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
const assignment = detectCoverageAssignment(context.visible, fallbackType);
|
|
50
|
+
if (assignment) {
|
|
51
|
+
return {
|
|
52
|
+
displayType: assignment.type,
|
|
53
|
+
subjectName: null,
|
|
54
|
+
visible: context.visible,
|
|
55
|
+
focus: context.focus,
|
|
56
|
+
highlightStart: assignment.start,
|
|
57
|
+
highlightEnd: assignment.end,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
const declarationAllowed = fallbackType == "Expression" ||
|
|
61
|
+
fallbackType == "Block" ||
|
|
62
|
+
fallbackType == "Function" ||
|
|
63
|
+
fallbackType == "Method" ||
|
|
64
|
+
fallbackType == "Constructor" ||
|
|
65
|
+
fallbackType == "Variable" ||
|
|
66
|
+
fallbackType == "Property" ||
|
|
67
|
+
fallbackType == "Call";
|
|
68
|
+
const declaration = declarationAllowed
|
|
69
|
+
? detectCoverageDeclaration(context.visible)
|
|
70
|
+
: null;
|
|
17
71
|
if (declaration) {
|
|
18
72
|
const [highlightStart, highlightEnd] = resolveCoverageHighlightSpan(context.visible, context.focus);
|
|
19
73
|
return {
|
|
@@ -25,7 +79,10 @@ export function describeCoveragePoint(file, line, column, fallbackType) {
|
|
|
25
79
|
highlightEnd,
|
|
26
80
|
};
|
|
27
81
|
}
|
|
28
|
-
const
|
|
82
|
+
const callAllowed = fallbackType == "Expression" || fallbackType == "Call";
|
|
83
|
+
const call = callAllowed
|
|
84
|
+
? detectCoverageCall(context.visible, context.focus)
|
|
85
|
+
: null;
|
|
29
86
|
if (call) {
|
|
30
87
|
return {
|
|
31
88
|
displayType: "Call",
|
|
@@ -130,6 +187,147 @@ function detectCoverageDeclaration(visible) {
|
|
|
130
187
|
}
|
|
131
188
|
return null;
|
|
132
189
|
}
|
|
190
|
+
function detectCoverageParameter(visible, focus, fallbackType) {
|
|
191
|
+
const inlineParameter = detectCoverageInlineParameter(visible, focus, fallbackType);
|
|
192
|
+
if (inlineParameter) {
|
|
193
|
+
return inlineParameter;
|
|
194
|
+
}
|
|
195
|
+
const openParen = visible.indexOf("(");
|
|
196
|
+
const closeParen = visible.lastIndexOf(")");
|
|
197
|
+
if (openParen == -1 || closeParen == -1 || closeParen <= openParen) {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
if (focus <= openParen || focus >= closeParen) {
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
const params = visible.slice(openParen + 1, closeParen);
|
|
204
|
+
const matches = [
|
|
205
|
+
...params.matchAll(/([A-Za-z_]\w*)\s*:\s*[^,)=]+(?:=\s*[^,)]*)?/g),
|
|
206
|
+
];
|
|
207
|
+
if (!matches.length)
|
|
208
|
+
return null;
|
|
209
|
+
for (const match of matches) {
|
|
210
|
+
const localStart = match.index ?? -1;
|
|
211
|
+
if (localStart == -1)
|
|
212
|
+
continue;
|
|
213
|
+
const localEnd = localStart + match[0].length;
|
|
214
|
+
const absoluteStart = openParen + 1 + localStart;
|
|
215
|
+
const absoluteEnd = openParen + 1 + localEnd;
|
|
216
|
+
if (focus < absoluteStart || focus > absoluteEnd)
|
|
217
|
+
continue;
|
|
218
|
+
const name = match[1] ?? null;
|
|
219
|
+
if (!name)
|
|
220
|
+
return null;
|
|
221
|
+
const nameOffset = match[0].indexOf(name);
|
|
222
|
+
const equalsOffset = match[0].indexOf("=");
|
|
223
|
+
if (fallbackType == "DefaultValue" && equalsOffset != -1) {
|
|
224
|
+
const valueStart = absoluteStart + equalsOffset + 1;
|
|
225
|
+
const valueVisibleStart = skipCoverageWhitespace(visible, valueStart);
|
|
226
|
+
const [start, end] = resolveCoverageHighlightSpan(visible, Math.max(valueVisibleStart, focus));
|
|
227
|
+
return {
|
|
228
|
+
type: "DefaultValue",
|
|
229
|
+
name,
|
|
230
|
+
start,
|
|
231
|
+
end,
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
return {
|
|
235
|
+
type: fallbackType == "Parameter" ? "Parameter" : "Property",
|
|
236
|
+
name,
|
|
237
|
+
start: absoluteStart + nameOffset,
|
|
238
|
+
end: absoluteStart + nameOffset + name.length,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
function detectCoverageInlineParameter(visible, focus, fallbackType) {
|
|
244
|
+
const match = visible.match(/^([A-Za-z_]\w*)\s*:\s*[^=,]+(?:=\s*[^,]+)?[,]?$/);
|
|
245
|
+
if (!match)
|
|
246
|
+
return null;
|
|
247
|
+
const name = match[1] ?? null;
|
|
248
|
+
if (!name)
|
|
249
|
+
return null;
|
|
250
|
+
const nameStart = visible.indexOf(name);
|
|
251
|
+
const nameEnd = nameStart + name.length;
|
|
252
|
+
const equalsIndex = visible.indexOf("=");
|
|
253
|
+
if (fallbackType == "DefaultValue" && equalsIndex != -1) {
|
|
254
|
+
const valueStart = skipCoverageWhitespace(visible, equalsIndex + 1);
|
|
255
|
+
const [start, end] = resolveCoverageHighlightSpan(visible, Math.max(valueStart, focus));
|
|
256
|
+
return {
|
|
257
|
+
type: "DefaultValue",
|
|
258
|
+
name,
|
|
259
|
+
start,
|
|
260
|
+
end,
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
return {
|
|
264
|
+
type: fallbackType == "Parameter" ? "Parameter" : "Property",
|
|
265
|
+
name,
|
|
266
|
+
start: nameStart,
|
|
267
|
+
end: nameEnd,
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
function detectCoverageTernary(visible, focus, fallbackType) {
|
|
271
|
+
if (fallbackType != "Ternary" && fallbackType != "LogicalBranch") {
|
|
272
|
+
return null;
|
|
273
|
+
}
|
|
274
|
+
const q = visible.indexOf("?");
|
|
275
|
+
if (q == -1)
|
|
276
|
+
return null;
|
|
277
|
+
if (fallbackType == "LogicalBranch") {
|
|
278
|
+
const [start, end] = resolveCoverageHighlightSpan(visible, focus);
|
|
279
|
+
return { type: "LogicalBranch", start, end };
|
|
280
|
+
}
|
|
281
|
+
const colon = visible.indexOf(":", q + 1);
|
|
282
|
+
if (colon == -1) {
|
|
283
|
+
const [start, end] = resolveCoverageHighlightSpan(visible, focus);
|
|
284
|
+
return { type: "Ternary", start, end };
|
|
285
|
+
}
|
|
286
|
+
const branchStart = focus <= colon ? q + 1 : colon + 1;
|
|
287
|
+
const normalizedStart = skipCoverageWhitespace(visible, branchStart);
|
|
288
|
+
const [start, end] = resolveCoverageHighlightSpan(visible, Math.max(normalizedStart, focus));
|
|
289
|
+
return { type: "Ternary", start, end };
|
|
290
|
+
}
|
|
291
|
+
function detectCoverageIfBranch(visible, fallbackType) {
|
|
292
|
+
if (fallbackType != "IfBranch")
|
|
293
|
+
return null;
|
|
294
|
+
const match = visible.match(/^if\s*\(([^)]*)\)/);
|
|
295
|
+
if (!match)
|
|
296
|
+
return null;
|
|
297
|
+
const full = match[0];
|
|
298
|
+
const condition = match[1] ?? "";
|
|
299
|
+
const openParen = full.indexOf("(");
|
|
300
|
+
const conditionPadding = condition.length
|
|
301
|
+
? condition.length - condition.trimStart().length
|
|
302
|
+
: 0;
|
|
303
|
+
const conditionStart = openParen == -1 ? -1 : openParen + 1 + conditionPadding;
|
|
304
|
+
if (conditionStart == -1 || !condition.length) {
|
|
305
|
+
return { type: "IfBranch", start: 0, end: full.length };
|
|
306
|
+
}
|
|
307
|
+
return {
|
|
308
|
+
type: "IfBranch",
|
|
309
|
+
start: conditionStart,
|
|
310
|
+
end: conditionStart + condition.length,
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
function detectCoverageAssignment(visible, fallbackType) {
|
|
314
|
+
if (fallbackType != "Assignment")
|
|
315
|
+
return null;
|
|
316
|
+
const match = visible.match(/([A-Za-z_]\w*(?:\.[A-Za-z_]\w*|\[[^\]]+\])?)\s*(=|\+=|-=|\*=|\*\*=|\/=|%=|<<=|>>=|>>>=|&=|\|=|\^=)/);
|
|
317
|
+
if (!match)
|
|
318
|
+
return null;
|
|
319
|
+
const full = match[0];
|
|
320
|
+
const lhs = match[1] ?? "";
|
|
321
|
+
const operator = match[2] ?? "=";
|
|
322
|
+
const fullStart = visible.indexOf(full);
|
|
323
|
+
const lhsStart = fullStart + full.indexOf(lhs);
|
|
324
|
+
const operatorStart = fullStart + full.lastIndexOf(operator);
|
|
325
|
+
return {
|
|
326
|
+
type: "Assignment",
|
|
327
|
+
start: lhsStart,
|
|
328
|
+
end: operatorStart + operator.length,
|
|
329
|
+
};
|
|
330
|
+
}
|
|
133
331
|
function detectCoverageCall(visible, focus) {
|
|
134
332
|
const matches = [...visible.matchAll(/\b([A-Za-z_]\w*)(?:<[^>()]+>)?\s*\(/g)];
|
|
135
333
|
if (!matches.length)
|
|
@@ -171,3 +369,10 @@ function detectCoverageCall(visible, focus) {
|
|
|
171
369
|
function isCoverageBoundary(ch) {
|
|
172
370
|
return /[\s()[\]{}.,;:+\-*/%&|^!?=<>]/.test(ch);
|
|
173
371
|
}
|
|
372
|
+
function skipCoverageWhitespace(visible, index) {
|
|
373
|
+
let current = Math.max(0, Math.min(visible.length - 1, index));
|
|
374
|
+
while (current < visible.length - 1 && /\s/.test(visible.charAt(current))) {
|
|
375
|
+
current++;
|
|
376
|
+
}
|
|
377
|
+
return current;
|
|
378
|
+
}
|
package/bin/index.js
CHANGED
|
@@ -78,6 +78,7 @@ else if (COMMANDS.includes(args[0])) {
|
|
|
78
78
|
resolveParallelJobs,
|
|
79
79
|
resolveBrowserOverride,
|
|
80
80
|
resolveReporterOverride,
|
|
81
|
+
resolveShowCoverageMode,
|
|
81
82
|
resolveExecutionModes,
|
|
82
83
|
listExecutionPlan,
|
|
83
84
|
runRuntimeModes,
|
|
@@ -96,6 +97,7 @@ else if (COMMANDS.includes(args[0])) {
|
|
|
96
97
|
resolveParallelJobs,
|
|
97
98
|
resolveBrowserOverride,
|
|
98
99
|
resolveReporterOverride,
|
|
100
|
+
resolveShowCoverageMode,
|
|
99
101
|
resolveFuzzOverrides,
|
|
100
102
|
resolveExecutionModes,
|
|
101
103
|
listExecutionPlan,
|
|
@@ -277,7 +279,7 @@ function printCommandHelp(command) {
|
|
|
277
279
|
process.stdout.write(" --create-snapshots Create missing snapshot entries\n");
|
|
278
280
|
process.stdout.write(" --overwrite-snapshots Overwrite existing snapshot entries on mismatch\n");
|
|
279
281
|
process.stdout.write(" --no-snapshot Disable snapshot assertions for this run\n");
|
|
280
|
-
process.stdout.write(" --show-coverage
|
|
282
|
+
process.stdout.write(" --show-coverage[=all] Print uncovered coverage point details; use =all to expand nested gaps\n");
|
|
281
283
|
process.stdout.write(" --suite <name[,name...]> Filter results to matching suite names or suite slug paths\n");
|
|
282
284
|
process.stdout.write(" --suites <name[,name...]> Alias for --suite\n");
|
|
283
285
|
process.stdout.write(" --enable <feature> Enable feature (coverage|try-as)\n");
|
|
@@ -305,7 +307,7 @@ function printCommandHelp(command) {
|
|
|
305
307
|
process.stdout.write(" --create-snapshots Create missing snapshot entries\n");
|
|
306
308
|
process.stdout.write(" --overwrite-snapshots Overwrite existing snapshot entries on mismatch\n");
|
|
307
309
|
process.stdout.write(" --no-snapshot Disable snapshot assertions for this run\n");
|
|
308
|
-
process.stdout.write(" --show-coverage
|
|
310
|
+
process.stdout.write(" --show-coverage[=all] Print uncovered coverage point details; use =all to expand nested gaps\n");
|
|
309
311
|
process.stdout.write(" --suite <name[,name...]> Filter results to matching suite names or suite slug paths\n");
|
|
310
312
|
process.stdout.write(" --suites <name[,name...]> Alias for --suite\n");
|
|
311
313
|
process.stdout.write(" --enable <feature> Enable feature (coverage|try-as)\n");
|
|
@@ -462,8 +464,15 @@ function resolveCommandArgs(rawArgs, command) {
|
|
|
462
464
|
arg == "--build-jobs" ||
|
|
463
465
|
arg == "--run-jobs" ||
|
|
464
466
|
arg == "--browser" ||
|
|
467
|
+
arg == "--show-coverage" ||
|
|
465
468
|
arg == "--fuzz-runs" ||
|
|
466
469
|
arg == "--fuzz-seed") {
|
|
470
|
+
if (arg == "--show-coverage") {
|
|
471
|
+
const next = rawArgs[i + 1];
|
|
472
|
+
if (next == "all")
|
|
473
|
+
i++;
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
467
476
|
i++;
|
|
468
477
|
continue;
|
|
469
478
|
}
|
|
@@ -476,6 +485,7 @@ function resolveCommandArgs(rawArgs, command) {
|
|
|
476
485
|
arg.startsWith("--build-jobs=") ||
|
|
477
486
|
arg.startsWith("--run-jobs=") ||
|
|
478
487
|
arg.startsWith("--browser=") ||
|
|
488
|
+
arg.startsWith("--show-coverage=") ||
|
|
479
489
|
arg.startsWith("--fuzz-runs=") ||
|
|
480
490
|
arg.startsWith("--fuzz-seed=")) {
|
|
481
491
|
continue;
|
|
@@ -762,6 +772,34 @@ function resolveReporterOverride(rawArgs, command) {
|
|
|
762
772
|
}
|
|
763
773
|
return undefined;
|
|
764
774
|
}
|
|
775
|
+
function resolveShowCoverageMode(rawArgs, command) {
|
|
776
|
+
let seenCommand = false;
|
|
777
|
+
for (let i = 0; i < rawArgs.length; i++) {
|
|
778
|
+
const arg = rawArgs[i];
|
|
779
|
+
if (!seenCommand) {
|
|
780
|
+
if (arg == command)
|
|
781
|
+
seenCommand = true;
|
|
782
|
+
continue;
|
|
783
|
+
}
|
|
784
|
+
if (arg == "--show-coverage") {
|
|
785
|
+
const next = rawArgs[i + 1];
|
|
786
|
+
if (next == "all")
|
|
787
|
+
return "all";
|
|
788
|
+
return "collapsed";
|
|
789
|
+
}
|
|
790
|
+
if (arg.startsWith("--show-coverage=")) {
|
|
791
|
+
const value = arg.slice("--show-coverage=".length).trim();
|
|
792
|
+
if (!value.length) {
|
|
793
|
+
throw new Error("--show-coverage requires a value when using =");
|
|
794
|
+
}
|
|
795
|
+
if (value != "all") {
|
|
796
|
+
throw new Error(`--show-coverage only supports "all" when given a value`);
|
|
797
|
+
}
|
|
798
|
+
return "all";
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
return undefined;
|
|
802
|
+
}
|
|
765
803
|
function resolveJobs(rawArgs, command) {
|
|
766
804
|
let seenCommand = false;
|
|
767
805
|
let parallel = false;
|
|
@@ -1140,6 +1178,8 @@ async function runTestSequential(runFlags, configPath, selectors, suiteSelectors
|
|
|
1140
1178
|
clean: runFlags.clean,
|
|
1141
1179
|
snapshotEnabled,
|
|
1142
1180
|
showCoverage: runFlags.showCoverage,
|
|
1181
|
+
showCoverageAll: runFlags.showCoverageAll,
|
|
1182
|
+
verbose: runFlags.verbose,
|
|
1143
1183
|
buildTime: getMergedIntervalDuration(buildIntervals),
|
|
1144
1184
|
snapshotSummary: summary.snapshotSummary,
|
|
1145
1185
|
coverageSummary: summary.coverageSummary,
|
|
@@ -1372,6 +1412,8 @@ async function runRuntimeMatrix(runFlags, configPath, selectors, suiteSelectors,
|
|
|
1372
1412
|
clean: runFlags.clean,
|
|
1373
1413
|
snapshotEnabled,
|
|
1374
1414
|
showCoverage: runFlags.showCoverage,
|
|
1415
|
+
showCoverageAll: runFlags.showCoverageAll,
|
|
1416
|
+
verbose: runFlags.verbose,
|
|
1375
1417
|
buildTime: 0,
|
|
1376
1418
|
snapshotSummary: summary.snapshotSummary,
|
|
1377
1419
|
coverageSummary: summary.coverageSummary,
|
|
@@ -1435,6 +1477,8 @@ async function runTestModes(runFlags, configPath, selectors, suiteSelectors, fuz
|
|
|
1435
1477
|
clean: runFlags.clean,
|
|
1436
1478
|
snapshotEnabled: effectiveRunFlags.snapshot !== false,
|
|
1437
1479
|
showCoverage: effectiveRunFlags.showCoverage,
|
|
1480
|
+
showCoverageAll: effectiveRunFlags.showCoverageAll,
|
|
1481
|
+
verbose: effectiveRunFlags.verbose,
|
|
1438
1482
|
buildTime: modeResult.summary.buildTime +
|
|
1439
1483
|
getMergedIntervalDuration(collectFuzzBuildIntervals(fuzzResults)),
|
|
1440
1484
|
snapshotSummary: modeResult.summary.snapshotSummary,
|
|
@@ -1572,6 +1616,8 @@ async function runTestMatrix(runFlags, configPath, selectors, suiteSelectors, fu
|
|
|
1572
1616
|
clean: runFlags.clean,
|
|
1573
1617
|
snapshotEnabled,
|
|
1574
1618
|
showCoverage: runFlags.showCoverage,
|
|
1619
|
+
showCoverageAll: runFlags.showCoverageAll,
|
|
1620
|
+
verbose: runFlags.verbose,
|
|
1575
1621
|
buildTime: getMergedIntervalDuration(buildIntervals),
|
|
1576
1622
|
snapshotSummary: summary.snapshotSummary,
|
|
1577
1623
|
coverageSummary: summary.coverageSummary,
|
|
@@ -1664,6 +1710,8 @@ async function runRuntimeSingleParallel(runFlags, configPath, selectors, suiteSe
|
|
|
1664
1710
|
clean: runFlags.clean,
|
|
1665
1711
|
snapshotEnabled,
|
|
1666
1712
|
showCoverage: runFlags.showCoverage,
|
|
1713
|
+
showCoverageAll: runFlags.showCoverageAll,
|
|
1714
|
+
verbose: runFlags.verbose,
|
|
1667
1715
|
buildTime: 0,
|
|
1668
1716
|
snapshotSummary: summary.snapshotSummary,
|
|
1669
1717
|
coverageSummary: summary.coverageSummary,
|
|
@@ -1778,6 +1826,8 @@ async function runRuntimeMatrixParallel(runFlags, configPath, selectors, suiteSe
|
|
|
1778
1826
|
clean: runFlags.clean,
|
|
1779
1827
|
snapshotEnabled,
|
|
1780
1828
|
showCoverage: runFlags.showCoverage,
|
|
1829
|
+
showCoverageAll: runFlags.showCoverageAll,
|
|
1830
|
+
verbose: runFlags.verbose,
|
|
1781
1831
|
buildTime: getMergedIntervalDuration(buildIntervals),
|
|
1782
1832
|
snapshotSummary: summary.snapshotSummary,
|
|
1783
1833
|
coverageSummary: summary.coverageSummary,
|
|
@@ -1880,6 +1930,8 @@ async function runTestSingleParallel(runFlags, configPath, selectors, suiteSelec
|
|
|
1880
1930
|
clean: runFlags.clean,
|
|
1881
1931
|
snapshotEnabled,
|
|
1882
1932
|
showCoverage: runFlags.showCoverage,
|
|
1933
|
+
showCoverageAll: runFlags.showCoverageAll,
|
|
1934
|
+
verbose: runFlags.verbose,
|
|
1883
1935
|
buildTime: getMergedIntervalDuration(buildIntervals),
|
|
1884
1936
|
snapshotSummary: summary.snapshotSummary,
|
|
1885
1937
|
coverageSummary: summary.coverageSummary,
|
|
@@ -2013,6 +2065,8 @@ async function runTestMatrixParallel(runFlags, configPath, selectors, suiteSelec
|
|
|
2013
2065
|
clean: runFlags.clean,
|
|
2014
2066
|
snapshotEnabled,
|
|
2015
2067
|
showCoverage: runFlags.showCoverage,
|
|
2068
|
+
showCoverageAll: runFlags.showCoverageAll,
|
|
2069
|
+
verbose: runFlags.verbose,
|
|
2016
2070
|
buildTime: getMergedIntervalDuration(buildIntervals),
|
|
2017
2071
|
snapshotSummary: summary.snapshotSummary,
|
|
2018
2072
|
coverageSummary: summary.coverageSummary,
|