feat(tstest): add support for package.json before scripts during test execution
This commit is contained in:
@@ -122,6 +122,40 @@ export class TsTestLogger {
|
||||
this.log(this.format(`[${'█'.repeat(filled)}${'░'.repeat(empty)}] ${message}`, 'dim'));
|
||||
}
|
||||
|
||||
// Before-script lifecycle hooks
|
||||
beforeScriptStart(label: string, command: string) {
|
||||
if (this.options.json) {
|
||||
this.logJson({ event: 'beforeScript', label, command });
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.options.quiet) {
|
||||
this.log(`Running ${label}...`);
|
||||
} else {
|
||||
this.log(this.format(`\n🔧 Running ${label}...`, 'cyan'));
|
||||
this.log(this.format(` Command: ${command}`, 'dim'));
|
||||
}
|
||||
}
|
||||
|
||||
beforeScriptEnd(label: string, success: boolean, durationMs: number) {
|
||||
const durationStr = durationMs >= 1000 ? `${(durationMs / 1000).toFixed(1)}s` : `${durationMs}ms`;
|
||||
|
||||
if (this.options.json) {
|
||||
this.logJson({ event: 'beforeScriptEnd', label, success, durationMs });
|
||||
return;
|
||||
}
|
||||
|
||||
if (this.options.quiet) {
|
||||
this.log(success ? `${label} done (${durationStr})` : `${label} FAILED`);
|
||||
} else {
|
||||
if (success) {
|
||||
this.log(this.format(` ✓ ${label} completed (${durationStr})`, 'green'));
|
||||
} else {
|
||||
this.log(this.format(` ✗ ${label} failed (${durationStr})`, 'red'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Test discovery
|
||||
testDiscovery(count: number, pattern: string, executionMode: string) {
|
||||
if (this.options.json) {
|
||||
|
||||
Reference in New Issue
Block a user