@test-station/core 0.2.21 → 0.2.23
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/package.json +7 -7
- package/src/report.js +54 -11
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@test-station/core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.23",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -9,12 +9,12 @@
|
|
|
9
9
|
".": "./src/index.js"
|
|
10
10
|
},
|
|
11
11
|
"dependencies": {
|
|
12
|
-
"@test-station/adapter-jest": "0.2.
|
|
13
|
-
"@test-station/adapter-node-test": "0.2.
|
|
14
|
-
"@test-station/adapter-playwright": "0.2.
|
|
15
|
-
"@test-station/adapter-shell": "0.2.
|
|
16
|
-
"@test-station/adapter-vitest": "0.2.
|
|
17
|
-
"@test-station/plugin-source-analysis": "0.2.
|
|
12
|
+
"@test-station/adapter-jest": "0.2.23",
|
|
13
|
+
"@test-station/adapter-node-test": "0.2.23",
|
|
14
|
+
"@test-station/adapter-playwright": "0.2.23",
|
|
15
|
+
"@test-station/adapter-shell": "0.2.23",
|
|
16
|
+
"@test-station/adapter-vitest": "0.2.23",
|
|
17
|
+
"@test-station/plugin-source-analysis": "0.2.23"
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"build": "node ../../scripts/check-package.mjs ./src/index.js",
|
package/src/report.js
CHANGED
|
@@ -76,7 +76,10 @@ export function normalizeSuiteResult(rawResult, suite, packageName) {
|
|
|
76
76
|
runtime: suite.adapter,
|
|
77
77
|
command: formatCommand(suite.command),
|
|
78
78
|
cwd: suite.cwd,
|
|
79
|
-
status:
|
|
79
|
+
status: deriveCollectionStatus({
|
|
80
|
+
summary,
|
|
81
|
+
reportedStatus: rawResult?.status,
|
|
82
|
+
}),
|
|
80
83
|
durationMs: Number.isFinite(rawResult?.durationMs) ? rawResult.durationMs : 0,
|
|
81
84
|
summary,
|
|
82
85
|
coverage,
|
|
@@ -306,20 +309,31 @@ function buildModulesFromPackages(packages, coverageFiles, policy) {
|
|
|
306
309
|
owner: themeEntry.owner,
|
|
307
310
|
coverage: coverageSummaryFromFiles(themeEntry.coverageFiles),
|
|
308
311
|
packages: Array.from(themeEntry.packageMap.values())
|
|
309
|
-
.map((packageEntry) =>
|
|
310
|
-
|
|
311
|
-
summary: summarizeTests(packageEntry.tests),
|
|
312
|
-
durationMs: summarizeDuration(packageEntry.tests),
|
|
313
|
-
frameworks: Array.from(packageEntry.frameworks).sort(),
|
|
314
|
-
suites: Array.from(packageEntry.suites.values()).map((suiteEntry) => {
|
|
312
|
+
.map((packageEntry) => {
|
|
313
|
+
const suites = Array.from(packageEntry.suites.values()).map((suiteEntry) => {
|
|
315
314
|
const suiteSummary = summarizeTests(suiteEntry.tests);
|
|
316
315
|
return {
|
|
317
316
|
...suiteEntry,
|
|
318
317
|
summary: suiteSummary,
|
|
319
|
-
status:
|
|
318
|
+
status: deriveCollectionStatus({
|
|
319
|
+
summary: suiteSummary,
|
|
320
|
+
reportedStatus: suiteEntry.status,
|
|
321
|
+
}),
|
|
320
322
|
};
|
|
321
|
-
})
|
|
322
|
-
|
|
323
|
+
});
|
|
324
|
+
const packageSummary = summarizeTests(packageEntry.tests);
|
|
325
|
+
return {
|
|
326
|
+
name: packageEntry.name,
|
|
327
|
+
summary: packageSummary,
|
|
328
|
+
durationMs: summarizeDuration(packageEntry.tests),
|
|
329
|
+
frameworks: Array.from(packageEntry.frameworks).sort(),
|
|
330
|
+
status: deriveCollectionStatus({
|
|
331
|
+
summary: packageSummary,
|
|
332
|
+
suites,
|
|
333
|
+
}),
|
|
334
|
+
suites,
|
|
335
|
+
};
|
|
336
|
+
})
|
|
323
337
|
.sort((left, right) => left.name.localeCompare(right.name)),
|
|
324
338
|
};
|
|
325
339
|
})
|
|
@@ -384,7 +398,10 @@ function finalizePackageResult(pkg) {
|
|
|
384
398
|
const summary = summarizeSuites(pkg.suites);
|
|
385
399
|
return {
|
|
386
400
|
...pkg,
|
|
387
|
-
status:
|
|
401
|
+
status: deriveCollectionStatus({
|
|
402
|
+
summary,
|
|
403
|
+
suites: pkg.suites,
|
|
404
|
+
}),
|
|
388
405
|
summary,
|
|
389
406
|
coverage: mergeCoverageSummaries(pkg.suites.map((suite) => suite.coverage).filter(Boolean)),
|
|
390
407
|
modules: dedupe(pkg.suites.flatMap((suite) => suite.tests.map((test) => test.module || 'uncategorized'))).sort(),
|
|
@@ -511,12 +528,38 @@ export function deriveStatusFromSummary(summary) {
|
|
|
511
528
|
return 'passed';
|
|
512
529
|
}
|
|
513
530
|
|
|
531
|
+
export function deriveCollectionStatus({ summary, reportedStatus = null, suites = [] } = {}) {
|
|
532
|
+
const normalizedReportedStatus = normalizeOptionalStatus(reportedStatus);
|
|
533
|
+
const suiteStatuses = (Array.isArray(suites) ? suites : []).map((suite) => normalizeOptionalStatus(suite?.status));
|
|
534
|
+
|
|
535
|
+
if (suiteStatuses.includes('failed') || normalizedReportedStatus === 'failed') {
|
|
536
|
+
return 'failed';
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
if (summary && summary.total > 0) {
|
|
540
|
+
return deriveStatusFromSummary(summary);
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
if (suiteStatuses.includes('passed') || normalizedReportedStatus === 'passed') {
|
|
544
|
+
return 'passed';
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
return 'skipped';
|
|
548
|
+
}
|
|
549
|
+
|
|
514
550
|
export function normalizeStatus(status) {
|
|
515
551
|
if (status === 'failed') return 'failed';
|
|
516
552
|
if (status === 'skipped') return 'skipped';
|
|
517
553
|
return 'passed';
|
|
518
554
|
}
|
|
519
555
|
|
|
556
|
+
function normalizeOptionalStatus(status) {
|
|
557
|
+
if (status === 'failed' || status === 'skipped' || status === 'passed') {
|
|
558
|
+
return status;
|
|
559
|
+
}
|
|
560
|
+
return null;
|
|
561
|
+
}
|
|
562
|
+
|
|
520
563
|
export function formatCommand(command) {
|
|
521
564
|
if (Array.isArray(command)) {
|
|
522
565
|
return command.join(' ');
|