@@ -122,6 +122,16 @@ function updateRunningTodoTests() {
122
122
}
123
123
124
124
function 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
125
135
const rootTasks = explorerTree . root . tasks
126
136
// collect remote children
127
137
for ( let i = 0 ; i < rootTasks . length ; i ++ ) {
@@ -142,11 +152,29 @@ function traverseFiles(collect: boolean) {
142
152
}
143
153
144
154
function traverseReceivedFiles ( collect : boolean ) {
145
- const rootTasks = explorerTree . root . tasks
146
155
const updatedFiles = new Map ( explorerTree . pendingTasks . entries ( ) )
147
156
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
+
149
175
// collect remote children
176
+ const idMap = client . state . idMap
177
+ const rootTasks = explorerTree . root . tasks
150
178
for ( let i = 0 ; i < rootTasks . length ; i ++ ) {
151
179
const fileNode = rootTasks [ i ]
152
180
const file = findById ( fileNode . id )
0 commit comments