@@ -122,6 +122,16 @@ function updateRunningTodoTests() {
122122}
123123
124124function traverseFiles ( collect : boolean ) {
125+ // add missing files: now we have only files with running tests on the initial ws open event
126+ const files = client . state . getFiles ( )
127+ const currentFiles = explorerTree . nodes
128+ const missingFiles = files . filter ( f => ! currentFiles . has ( f . id ) )
129+ for ( let i = 0 ; i < missingFiles . length ; i ++ ) {
130+ createOrUpdateFileNode ( missingFiles [ i ] , collect )
131+ createOrUpdateEntry ( missingFiles [ i ] . tasks )
132+ }
133+
134+ // update pending tasks
125135 const rootTasks = explorerTree . root . tasks
126136 // collect remote children
127137 for ( let i = 0 ; i < rootTasks . length ; i ++ ) {
@@ -142,11 +152,29 @@ function traverseFiles(collect: boolean) {
142152}
143153
144154function traverseReceivedFiles ( collect : boolean ) {
145- const rootTasks = explorerTree . root . tasks
146155 const updatedFiles = new Map ( explorerTree . pendingTasks . entries ( ) )
147156 explorerTree . pendingTasks . clear ( )
148- const idMap = client . state . idMap
157+
158+ // add missing files: now we have only files with running tests on the initial ws open event
159+ const currentFiles = explorerTree . nodes
160+ const missingFiles = Array
161+ . from ( updatedFiles . keys ( ) )
162+ . filter ( id => ! currentFiles . has ( id ) )
163+ . map ( id => findById ( id ) )
164+ . filter ( Boolean ) as File [ ]
165+
166+ let newFile : File
167+ for ( let i = 0 ; i < missingFiles . length ; i ++ ) {
168+ newFile = missingFiles [ i ]
169+ createOrUpdateFileNode ( newFile , false )
170+ createOrUpdateEntry ( newFile . tasks )
171+ // remove the file from the updated files
172+ updatedFiles . delete ( newFile . id )
173+ }
174+
149175 // collect remote children
176+ const idMap = client . state . idMap
177+ const rootTasks = explorerTree . root . tasks
150178 for ( let i = 0 ; i < rootTasks . length ; i ++ ) {
151179 const fileNode = rootTasks [ i ]
152180 const file = findById ( fileNode . id )
0 commit comments