@@ -9,6 +9,7 @@ import * as Id from '../Id/Id.ts'
99import * as MemoryLeakFinder from '../MemoryLeakFinder/MemoryLeakFinder.ts'
1010import * as MemoryLeakResultsPath from '../MemoryLeakResultsPath/MemoryLeakResultsPath.ts'
1111import * as PrepareTestsOrAttach from '../PrepareTestsOrAttach/PrepareTestsOrAttach.ts'
12+ import * as ShouldShowInitializingMessage from '../ShouldShowInitializingMessage/ShouldShowInitializingMessage.ts'
1213import * as TestWorkerEventType from '../TestWorkerEventType/TestWorkerEventType.ts'
1314import * as TestWorkerRunTests from '../TestWorkerRunTests/TestWorkerRunTests.ts'
1415import * as TestWorkerSetupTest from '../TestWorkerSetupTest/TestWorkerSetupTest.ts'
@@ -225,20 +226,26 @@ export const runTestsWithCallback = async ({
225226 }
226227 const initialStart = Time . now ( )
227228 const first = formattedPaths [ 0 ]
228- await callback ( TestWorkerEventType . HandleInitializing )
229+ const showInitializingMessage = await ShouldShowInitializingMessage . shouldShowInitializingMessage ( {
230+ arch,
231+ commit,
232+ ide,
233+ insidersCommit,
234+ platform,
235+ vscodePath,
236+ vscodeVersion,
237+ } )
229238
230239 const context = {
231240 runs,
232241 }
233242
234- const intializeEnd = performance . now ( )
235- const intializeTime = intializeEnd - initialStart
236-
237- await callback ( TestWorkerEventType . HandleInitialized , intializeTime )
238-
239- const testStart = performance . now ( )
240- await callback ( TestWorkerEventType . TestsStarting , total )
241- await callback ( TestWorkerEventType . TestRunning , first . absolutePath , first . relativeDirname , first . dirent , /* isFirst */ true )
243+ let testStart = 0
244+ if ( ! showInitializingMessage ) {
245+ testStart = performance . now ( )
246+ await callback ( TestWorkerEventType . TestsStarting , total )
247+ await callback ( TestWorkerEventType . TestRunning , first . absolutePath , first . relativeDirname , first . dirent , true )
248+ }
242249
243250 let workers = {
244251 functionTrackerRpc : emptyRpc ,
@@ -247,6 +254,7 @@ export const runTestsWithCallback = async ({
247254 testWorkerRpc : emptyRpc ,
248255 videoRpc : emptyRpc ,
249256 }
257+ let hasHandledInitializing = false
250258
251259 for ( let i = 0 ; i < formattedPaths . length ; i ++ ) {
252260 const formattedPath = formattedPaths [ i ]
@@ -256,6 +264,10 @@ export const runTestsWithCallback = async ({
256264 const needsSetup = i === 0 || restartBetween
257265
258266 if ( needsSetup ) {
267+ const initializeStart = Time . now ( )
268+ if ( showInitializingMessage && ! hasHandledInitializing ) {
269+ await callback ( TestWorkerEventType . HandleInitializing )
270+ }
259271 await disposeWorkers ( workers )
260272 PrepareTestsOrAttach . state . promise = undefined
261273 const { functionTrackerRpc, initializationWorkerRpc, memoryRpc, testWorkerRpc, videoRpc } =
@@ -295,6 +307,11 @@ export const runTestsWithCallback = async ({
295307 vscodePath,
296308 vscodeVersion,
297309 } )
310+ if ( showInitializingMessage && ! hasHandledInitializing ) {
311+ const intializeTime = performance . now ( ) - initializeStart
312+ await callback ( TestWorkerEventType . HandleInitialized , intializeTime )
313+ hasHandledInitializing = true
314+ }
298315 workers = {
299316 functionTrackerRpc : functionTrackerRpc || emptyRpc ,
300317 initializationWorkerRpc : initializationWorkerRpc || emptyRpc ,
@@ -307,11 +324,16 @@ export const runTestsWithCallback = async ({
307324
308325 const { memoryRpc, testWorkerRpc, videoRpc } = workers
309326
310- let wasOriginallySkipped = false
311- if ( i !== 0 ) {
312- await callback ( TestWorkerEventType . TestRunning , absolutePath , relativeDirname , dirent , /* isFirst */ true )
327+ if ( i === 0 && showInitializingMessage ) {
328+ testStart = performance . now ( )
329+ await callback ( TestWorkerEventType . TestsStarting , total )
330+ await callback ( TestWorkerEventType . TestRunning , absolutePath , relativeDirname , dirent , true )
331+ } else if ( i !== 0 ) {
332+ await callback ( TestWorkerEventType . TestRunning , absolutePath , relativeDirname , dirent , false )
313333 }
314334
335+ let wasOriginallySkipped = false
336+
315337 try {
316338 const start = i === 0 ? initialStart : Time . now ( )
317339 const testResult = await TestWorkerSetupTest . testWorkerSetupTest (
0 commit comments