11import { Uri , window , workspace , WorkspaceFolder } from "vscode" ;
22import * as tmp from "tmp" ;
33import { join } from "path" ;
4- import {
5- writeFileSync ,
6- ensureDirSync ,
7- symlinkSync ,
8- writeFile ,
9- mkdir ,
10- } from "fs-extra" ;
11- import { DirResult } from "tmp" ;
4+ import { writeFile , mkdir } from "fs-extra" ;
125
136import {
147 getFirstWorkspaceFolder ,
@@ -18,7 +11,6 @@ import {
1811 showBinaryChoiceWithUrlDialog ,
1912 showInformationMessageWithAction ,
2013 showNeverAskAgainDialog ,
21- walkDirectory ,
2214} from "../../../src/helpers" ;
2315import { reportStreamProgress } from "../../../src/common/vscode/progress" ;
2416import { Setting } from "../../../src/config" ;
@@ -243,70 +235,6 @@ describe("helpers", () => {
243235 } ) ;
244236} ) ;
245237
246- describe ( "walkDirectory" , ( ) => {
247- let tmpDir : DirResult ;
248- let dir : string ;
249- let dir2 : string ;
250-
251- beforeEach ( ( ) => {
252- tmpDir = tmp . dirSync ( { unsafeCleanup : true } ) ;
253- dir = join ( tmpDir . name , "dir" ) ;
254- ensureDirSync ( dir ) ;
255- dir2 = join ( tmpDir . name , "dir2" ) ;
256- } ) ;
257-
258- afterEach ( ( ) => {
259- tmpDir . removeCallback ( ) ;
260- } ) ;
261-
262- it ( "should walk a directory" , async ( ) => {
263- const file1 = join ( dir , "file1" ) ;
264- const file2 = join ( dir , "file2" ) ;
265- const file3 = join ( dir , "file3" ) ;
266- const dir3 = join ( dir , "dir3" ) ;
267- const file4 = join ( dir , "file4" ) ;
268- const file5 = join ( dir , "file5" ) ;
269- const file6 = join ( dir , "file6" ) ;
270-
271- // These symlinks link back to paths that are already existing, so ignore.
272- const symLinkFile7 = join ( dir , "symlink0" ) ;
273- const symlinkDir = join ( dir2 , "symlink1" ) ;
274-
275- // some symlinks that point outside of the base dir.
276- const file8 = join ( tmpDir . name , "file8" ) ;
277- const file9 = join ( dir2 , "file8" ) ;
278- const symlinkDir2 = join ( dir2 , "symlink2" ) ;
279- const symlinkFile2 = join ( dir2 , "symlinkFile3" ) ;
280-
281- ensureDirSync ( dir2 ) ;
282- ensureDirSync ( dir3 ) ;
283-
284- writeFileSync ( file1 , "file1" ) ;
285- writeFileSync ( file2 , "file2" ) ;
286- writeFileSync ( file3 , "file3" ) ;
287- writeFileSync ( file4 , "file4" ) ;
288- writeFileSync ( file5 , "file5" ) ;
289- writeFileSync ( file6 , "file6" ) ;
290- writeFileSync ( file8 , "file8" ) ;
291- writeFileSync ( file9 , "file9" ) ;
292-
293- // We don't really need to be testing all of these variants of symlinks,
294- // but it doesn't hurt, and will help us if we ever do decide to support them.
295- symlinkSync ( file6 , symLinkFile7 , "file" ) ;
296- symlinkSync ( dir3 , symlinkDir , "dir" ) ;
297- symlinkSync ( file8 , symlinkFile2 , "file" ) ;
298- symlinkSync ( dir2 , symlinkDir2 , "dir" ) ;
299-
300- const files = [ ] ;
301- for await ( const file of walkDirectory ( dir ) ) {
302- files . push ( file ) ;
303- }
304-
305- // Only real files should be returned.
306- expect ( files . sort ( ) ) . toEqual ( [ file1 , file2 , file3 , file4 , file5 , file6 ] ) ;
307- } ) ;
308- } ) ;
309-
310238describe ( "isFolderAlreadyInWorkspace" , ( ) => {
311239 beforeEach ( ( ) => {
312240 const folders = [
0 commit comments