@@ -112,19 +112,16 @@ suite('Extension Tests', async () => {
112112 } ) ;
113113
114114 test ( 'Pre-load test Files' , async ( ) => {
115- const fixtures = await vscode . workspace . fs . readDirectory ( fixturesUri ) ;
116- const baselines = await vscode . workspace . fs . readDirectory ( baselinesUri ) ;
115+ const files = await vscode . workspace . findFiles (
116+ new vscode . RelativePattern (
117+ workspaceFolder . uri ,
118+ '{fixtures,baselines}/**/*'
119+ )
120+ ) ;
117121 /* await */ Promise . allSettled (
118- [
119- fixtures . map ( ( file ) => vscode . window . showTextDocument (
120- vscode . Uri . joinPath ( fixturesUri , file [ 0 ] ) ,
121- showTextDocumentOptions
122- ) ) ,
123- baselines . map ( ( file ) => vscode . window . showTextDocument (
124- vscode . Uri . joinPath ( baselinesUri , file [ 0 ] ) ,
125- showTextDocumentOptions
126- ) ) ,
127- ] . flat ( 1 )
122+ files . map (
123+ uri => vscode . window . showTextDocument ( uri , showTextDocumentOptions )
124+ )
128125 ) ;
129126
130127 // Diagnostics can be slow
@@ -144,32 +141,24 @@ suite('Extension Tests', async () => {
144141 } ) ;
145142
146143 test ( 'FileTypes' , async ( ) => {
147- const files = await vscode . workspace . fs . readDirectory ( fixturesUri ) ;
148- const languageIds : { [ languageId : string ] : string [ ] ; } = { } ;
149-
150- for ( const file of files ) {
151- const path = file [ 0 ] ;
152-
153- if ( path == 'fileTypes/ascii.tm-grammar.plist' ) {
154- // TODO: `fileTypes/ascii.tm-grammar.plist` should be `ascii-textmate`
144+ const files = await vscode . workspace . findFiles ( new vscode . RelativePattern ( fixturesUri , '**/*' ) ) ;
145+ files . sort ( ) ; // Must be predictable
146+ const documents = await Promise . all ( files . map ( uri => vscode . workspace . openTextDocument ( uri ) ) ) ;
147+
148+ const languageIds : {
149+ [ languageId : string ] : string [ ] ;
150+ } = { } ;
151+
152+ for ( const document of documents ) {
153+ const path = vscode . workspace . asRelativePath ( document . uri , false ) ;
154+ if ( path == 'fixtures/fileTypes/ascii.tm-grammar.plist' ) {
155+ // TODO: `fixtures/fileTypes/ascii.tm-grammar.plist` should be `ascii-textmate`
155156 // Works correctly in vscode-web
156157 // Broken in VSCode desktop nodejs
157158 continue ;
158159 }
159160
160- if ( file [ 1 ] === 2 ) {
161- const nestedFiles = await vscode . workspace . fs . readDirectory ( vscode . Uri . joinPath ( fixturesUri , path ) ) ;
162- nestedFiles . forEach ( file => file [ 0 ] = `${ path } /${ file [ 0 ] } ` ) ;
163- files . push ( ...nestedFiles ) ;
164- continue ;
165- }
166-
167- const editor = await vscode . window . showTextDocument (
168- vscode . Uri . joinPath ( fixturesUri , path ) ,
169- showTextDocumentOptions ,
170- ) ;
171-
172- const languageId = editor . document . languageId ;
161+ const languageId = document . languageId ;
173162 languageIds [ languageId ] ??= [ ] ;
174163 languageIds [ languageId ] . push ( path ) ;
175164 }
0 commit comments