fix(logging): Improve performance metrics reporting and add local permissions configuration
This commit is contained in:
		| @@ -425,15 +425,23 @@ export class TsTestLogger { | ||||
|      | ||||
|     // Performance metrics | ||||
|     if (this.options.verbose) { | ||||
|       const avgDuration = Math.round(totalDuration / summary.totalTests); | ||||
|       const slowestTest = this.fileResults | ||||
|         .flatMap(r => r.tests) | ||||
|         .sort((a, b) => b.duration - a.duration)[0]; | ||||
|       // Calculate metrics based on actual test durations | ||||
|       const allTests = this.fileResults.flatMap(r => r.tests); | ||||
|       const testDurations = allTests.map(t => t.duration); | ||||
|       const sumOfTestDurations = testDurations.reduce((sum, d) => sum + d, 0); | ||||
|       const avgTestDuration = allTests.length > 0 ? Math.round(sumOfTestDurations / allTests.length) : 0; | ||||
|        | ||||
|       // Find slowest test (exclude 0ms durations unless all are 0) | ||||
|       const nonZeroDurations = allTests.filter(t => t.duration > 0); | ||||
|       const testsToSort = nonZeroDurations.length > 0 ? nonZeroDurations : allTests; | ||||
|       const slowestTest = testsToSort.sort((a, b) => b.duration - a.duration)[0]; | ||||
|        | ||||
|       this.log(this.format('\n⏱️  Performance Metrics:', 'cyan')); | ||||
|       this.log(this.format(`   Average per test: ${avgDuration}ms`, 'white')); | ||||
|       if (slowestTest) { | ||||
|         this.log(this.format(`   Slowest test: ${slowestTest.name} (${slowestTest.duration}ms)`, 'yellow')); | ||||
|       this.log(this.format(`   Average per test: ${avgTestDuration}ms`, 'white')); | ||||
|       if (slowestTest && slowestTest.duration > 0) { | ||||
|         this.log(this.format(`   Slowest test: ${slowestTest.name} (${slowestTest.duration}ms)`, 'orange')); | ||||
|       } else if (allTests.length > 0) { | ||||
|         this.log(this.format(`   All tests completed in <1ms`, 'dim')); | ||||
|       } | ||||
|     } | ||||
|      | ||||
|   | ||||
		Reference in New Issue
	
	Block a user