@@ -2,6 +2,7 @@ import { Logger } from '@idl/logger';
22import { Sleep } from '@idl/shared' ;
33import { GetWorkspaceConfig } from '@idl/vscode/config' ;
44import { arch , platform } from 'os' ;
5+ import { performance } from 'perf_hooks' ;
56import * as vscode from 'vscode' ;
67
78import { ACTIVATION_RESULT } from '../main' ;
@@ -77,6 +78,15 @@ export class Runner {
7778 // get the current workspace config
7879 const config = GetWorkspaceConfig ( ) ;
7980
81+ /** Get start time */
82+ const t0 = performance . now ( ) ;
83+
84+ /** Get the number of tests */
85+ const nTests = this . tests . length ;
86+
87+ // alert user
88+ this . logger . info ( `Preparing to run ${ nTests } tests` ) ;
89+
8090 // run all of our tests
8191 for ( let i = 0 ; i < this . tests . length ; i ++ ) {
8292 try {
@@ -87,7 +97,7 @@ export class Runner {
8797 }
8898
8999 // log test we are starting
90- this . logger . info ( this . tests [ i ] . name ) ;
100+ this . logger . info ( `( ${ i + 1 } / ${ nTests } ) ${ this . tests [ i ] . name } ` ) ;
91101
92102 // attempt to run test
93103 await this . tests [ i ] . fn ( ACTIVATION_RESULT ) ;
@@ -131,6 +141,14 @@ export class Runner {
131141 }
132142 }
133143
144+ // alert users
145+ this . logger . info ( [
146+ `Finished running tests in ${ Math . ceil (
147+ ( performance . now ( ) - t0 ) / 1000
148+ ) } seconds with ${ failures } failed tests`,
149+ '' ,
150+ ] ) ;
151+
134152 return failures ;
135153 }
136154
@@ -141,11 +159,35 @@ export class Runner {
141159 /** Initialize failures */
142160 let failures = 0 ;
143161
162+ /** Track total tests */
163+ let total = 0 ;
164+
165+ /** Get start time */
166+ const t0 = performance . now ( ) ;
167+
168+ // alert user
169+ this . logger . info ( [
170+ `Running tests for ${ this . runners . length } test runners` ,
171+ '' ,
172+ ] ) ;
173+
144174 // run all of our tests - no need for try/catch, handled internally below
145175 for ( let i = 0 ; i < this . runners . length ; i ++ ) {
176+ // update total
177+ total += this . runners [ i ] . tests . length ;
178+
179+ // run and track failures
146180 failures += await this . runners [ i ] . runOurTests ( ) ;
147181 }
148182
183+ // alert user
184+ this . logger . info ( [
185+ `Finished running all tests in ${ Math . ceil (
186+ ( performance . now ( ) - t0 ) / 1000
187+ ) } seconds with ${ failures } failed tests`,
188+ { total, failures } ,
189+ ] ) ;
190+
149191 return failures ;
150192 }
151193}
0 commit comments