@git.zone/tstest 4.1.1 → 6.0.0
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/.smartconfig.json +5 -1
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/tstest.classes.runtime.bun.js +4 -3
- package/dist_ts/tstest.classes.runtime.chromium.js +5 -4
- package/dist_ts/tstest.classes.runtime.deno.js +49 -117
- package/dist_ts/tstest.classes.runtime.docker.js +9 -10
- package/dist_ts/tstest.classes.runtime.node.js +8 -3
- package/dist_ts/tstest.classes.tap.combinator.js +2 -4
- package/dist_ts/tstest.classes.tap.parser.d.ts +5 -1
- package/dist_ts/tstest.classes.tap.parser.js +47 -68
- package/dist_ts/tstest.classes.testfile.directives.js +2 -2
- package/dist_ts/tstest.classes.tstest.d.ts +2 -0
- package/dist_ts/tstest.classes.tstest.js +24 -10
- package/dist_ts/tstest.logging.d.ts +5 -1
- package/dist_ts/tstest.logging.js +30 -13
- package/dist_ts/tstest.plugins.d.ts +2 -1
- package/dist_ts/tstest.plugins.js +3 -2
- package/dist_ts_tapbundle_serverside/classes.tapnodetools.d.ts +2 -2
- package/dist_ts_tapbundle_serverside/classes.tapnodetools.js +10 -10
- package/dist_ts_tapbundle_serverside/plugins.d.ts +1 -0
- package/dist_ts_tapbundle_serverside/plugins.js +3 -1
- package/package.json +4 -4
- package/readme.md +17 -6
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/tstest.classes.runtime.bun.ts +3 -2
- package/ts/tstest.classes.runtime.chromium.ts +4 -3
- package/ts/tstest.classes.runtime.deno.ts +47 -131
- package/ts/tstest.classes.runtime.docker.ts +8 -9
- package/ts/tstest.classes.runtime.node.ts +7 -2
- package/ts/tstest.classes.tap.combinator.ts +1 -3
- package/ts/tstest.classes.tap.parser.ts +46 -75
- package/ts/tstest.classes.testfile.directives.ts +1 -1
- package/ts/tstest.classes.tstest.ts +33 -10
- package/ts/tstest.logging.ts +33 -13
- package/ts/tstest.plugins.ts +2 -1
package/ts/tstest.logging.ts
CHANGED
|
@@ -17,6 +17,7 @@ export interface TestFileResult {
|
|
|
17
17
|
failed: number;
|
|
18
18
|
total: number;
|
|
19
19
|
duration: number;
|
|
20
|
+
executionErrors?: string[];
|
|
20
21
|
tests: Array<{
|
|
21
22
|
name: string;
|
|
22
23
|
passed: boolean;
|
|
@@ -30,6 +31,7 @@ export interface TestSummary {
|
|
|
30
31
|
totalTests: number;
|
|
31
32
|
totalPassed: number;
|
|
32
33
|
totalFailed: number;
|
|
34
|
+
failedFiles: number;
|
|
33
35
|
totalSkipped: number;
|
|
34
36
|
totalDuration: number;
|
|
35
37
|
fileResults: TestFileResult[];
|
|
@@ -50,6 +52,13 @@ export class TsTestLogger {
|
|
|
50
52
|
this.options = options;
|
|
51
53
|
this.startTime = Date.now();
|
|
52
54
|
}
|
|
55
|
+
|
|
56
|
+
/** Keep each concurrent file's counters and log buffers separate. */
|
|
57
|
+
public createTestFileLogger(): TsTestLogger {
|
|
58
|
+
const logger = new TsTestLogger(this.options);
|
|
59
|
+
logger.fileResults = this.fileResults;
|
|
60
|
+
return logger;
|
|
61
|
+
}
|
|
53
62
|
|
|
54
63
|
private format(text: string, color?: string): string {
|
|
55
64
|
if (this.options.noColor || !color) {
|
|
@@ -305,14 +314,20 @@ export class TsTestLogger {
|
|
|
305
314
|
this.currentTestLogs = [];
|
|
306
315
|
}
|
|
307
316
|
|
|
308
|
-
testFileEnd(passed: number, failed: number, duration: number) {
|
|
317
|
+
testFileEnd(passed: number, failed: number, duration: number, executionErrors: readonly string[] = []) {
|
|
318
|
+
const fileFailed = failed > 0 || executionErrors.length > 0;
|
|
309
319
|
if (this.currentFileResult) {
|
|
320
|
+
this.currentFileResult.passed = passed;
|
|
321
|
+
this.currentFileResult.failed = failed;
|
|
322
|
+
this.currentFileResult.total = passed + failed;
|
|
323
|
+
this.currentFileResult.duration = duration;
|
|
324
|
+
this.currentFileResult.executionErrors = [...executionErrors];
|
|
310
325
|
this.fileResults.push(this.currentFileResult);
|
|
311
326
|
this.currentFileResult = null;
|
|
312
327
|
}
|
|
313
328
|
|
|
314
329
|
if (this.options.json) {
|
|
315
|
-
this.logJson({ event: 'fileEnd', passed, failed, duration });
|
|
330
|
+
this.logJson({ event: 'fileEnd', passed, failed, duration, executionErrors, fileFailed });
|
|
316
331
|
return;
|
|
317
332
|
}
|
|
318
333
|
|
|
@@ -320,10 +335,10 @@ export class TsTestLogger {
|
|
|
320
335
|
const total = passed + failed;
|
|
321
336
|
const durationStr = duration >= 1000 ? `${(duration / 1000).toFixed(1)}s` : `${duration}ms`;
|
|
322
337
|
|
|
323
|
-
if (
|
|
338
|
+
if (!fileFailed) {
|
|
324
339
|
this.log(this.format(` Summary: ${passed}/${total} PASSED in ${durationStr}`, 'green'));
|
|
325
340
|
} else {
|
|
326
|
-
this.log(this.format(` Summary: ${passed} passed, ${failed} failed of ${total} tests in ${durationStr}`, 'red'));
|
|
341
|
+
this.log(this.format(` Summary: FAILED — ${passed} passed, ${failed} failed of ${total} tests; ${executionErrors.length} execution errors in ${durationStr}`, 'red'));
|
|
327
342
|
}
|
|
328
343
|
}
|
|
329
344
|
|
|
@@ -335,7 +350,7 @@ export class TsTestLogger {
|
|
|
335
350
|
const logBasename = path.basename(this.currentTestLogFile);
|
|
336
351
|
|
|
337
352
|
// Create error copy if there were failures
|
|
338
|
-
if (
|
|
353
|
+
if (fileFailed) {
|
|
339
354
|
const errorDir = path.join(logDir, '00err');
|
|
340
355
|
if (!fs.existsSync(errorDir)) {
|
|
341
356
|
fs.mkdirSync(errorDir, { recursive: true });
|
|
@@ -509,6 +524,7 @@ export class TsTestLogger {
|
|
|
509
524
|
totalTests: this.fileResults.reduce((sum, r) => sum + r.total, 0),
|
|
510
525
|
totalPassed: this.fileResults.reduce((sum, r) => sum + r.passed, 0),
|
|
511
526
|
totalFailed: this.fileResults.reduce((sum, r) => sum + r.failed, 0),
|
|
527
|
+
failedFiles: this.fileResults.filter((r) => r.failed > 0 || r.executionErrors?.length > 0).length,
|
|
512
528
|
totalSkipped: skippedFiles.length,
|
|
513
529
|
totalDuration,
|
|
514
530
|
fileResults: this.fileResults,
|
|
@@ -521,13 +537,13 @@ export class TsTestLogger {
|
|
|
521
537
|
}
|
|
522
538
|
|
|
523
539
|
if (this.options.quiet) {
|
|
524
|
-
const status = summary.
|
|
540
|
+
const status = summary.failedFiles === 0 ? 'PASSED' : 'FAILED';
|
|
525
541
|
const durationStr = totalDuration >= 1000 ? `${(totalDuration / 1000).toFixed(1)}s` : `${totalDuration}ms`;
|
|
526
542
|
|
|
527
|
-
if (summary.
|
|
543
|
+
if (summary.failedFiles === 0) {
|
|
528
544
|
this.log(`\nSummary: ${summary.totalPassed}/${summary.totalTests} | ${durationStr} | ${status}`);
|
|
529
545
|
} else {
|
|
530
|
-
this.log(`\nSummary: ${summary.totalPassed} passed, ${summary.totalFailed} failed of ${summary.totalTests} tests | ${durationStr} | ${status}`);
|
|
546
|
+
this.log(`\nSummary: ${summary.totalPassed} passed, ${summary.totalFailed} failed of ${summary.totalTests} tests | ${summary.failedFiles} failed files | ${durationStr} | ${status}`);
|
|
531
547
|
}
|
|
532
548
|
return;
|
|
533
549
|
}
|
|
@@ -539,6 +555,7 @@ export class TsTestLogger {
|
|
|
539
555
|
this.log(this.format(`│ Total Tests: ${summary.totalTests.toString().padStart(14)} │`, 'white'));
|
|
540
556
|
this.log(this.format(`│ Passed: ${summary.totalPassed.toString().padStart(14)} │`, 'green'));
|
|
541
557
|
this.log(this.format(`│ Failed: ${summary.totalFailed.toString().padStart(14)} │`, summary.totalFailed > 0 ? 'red' : 'green'));
|
|
558
|
+
this.log(this.format(`│ Failed Files: ${summary.failedFiles.toString().padStart(14)} │`, summary.failedFiles > 0 ? 'red' : 'green'));
|
|
542
559
|
if (summary.totalSkipped > 0) {
|
|
543
560
|
this.log(this.format(`│ Skipped: ${summary.totalSkipped.toString().padStart(14)} │`, 'yellow'));
|
|
544
561
|
}
|
|
@@ -547,11 +564,14 @@ export class TsTestLogger {
|
|
|
547
564
|
this.log(this.format('└────────────────────────────────┘', 'dim'));
|
|
548
565
|
|
|
549
566
|
// File results
|
|
550
|
-
if (summary.
|
|
567
|
+
if (summary.failedFiles > 0) {
|
|
551
568
|
this.log(this.format('\n❌ Failed Tests:', 'red'));
|
|
552
569
|
this.fileResults.forEach(fileResult => {
|
|
553
|
-
if (fileResult.failed > 0) {
|
|
570
|
+
if (fileResult.failed > 0 || fileResult.executionErrors?.length > 0) {
|
|
554
571
|
this.log(this.format(`\n ${fileResult.file}`, 'yellow'));
|
|
572
|
+
for (const error of fileResult.executionErrors || []) {
|
|
573
|
+
this.log(this.format(` ❌ ${error}`, 'red'));
|
|
574
|
+
}
|
|
555
575
|
fileResult.tests.filter(t => !t.passed).forEach(test => {
|
|
556
576
|
this.log(this.format(` ❌ ${test.name}`, 'red'));
|
|
557
577
|
if (test.error) {
|
|
@@ -585,8 +605,8 @@ export class TsTestLogger {
|
|
|
585
605
|
}
|
|
586
606
|
|
|
587
607
|
// Final status
|
|
588
|
-
const status = summary.
|
|
589
|
-
const statusColor = summary.
|
|
608
|
+
const status = summary.failedFiles === 0 ? 'ALL TESTS PASSED! 🎉' : 'SOME TESTS FAILED! ❌';
|
|
609
|
+
const statusColor = summary.failedFiles === 0 ? 'green' : 'red';
|
|
590
610
|
this.log(this.format(`\n${status}`, statusColor));
|
|
591
611
|
}
|
|
592
612
|
|
|
@@ -710,4 +730,4 @@ export class TsTestLogger {
|
|
|
710
730
|
|
|
711
731
|
this.log(this.format('\n\n👋 Stopping watch mode...', 'cyan'));
|
|
712
732
|
}
|
|
713
|
-
}
|
|
733
|
+
}
|
package/ts/tstest.plugins.ts
CHANGED