@@ -10,7 +10,6 @@ import { FilePathDiscovery } from "../../../../../src/common/vscode/file-path-di
1010import { basename , dirname , join } from "path" ;
1111import { mkdirSync , readFileSync , rmSync , writeFileSync } from "fs" ;
1212import * as tmp from "tmp" ;
13- import { expectArraysEqual } from "../../../utils/expect-arrays-equal" ;
1413
1514interface TestData {
1615 path : string ;
@@ -127,11 +126,13 @@ describe("FilePathDiscovery", () => {
127126
128127 await discovery . initialRefresh ( ) ;
129128
130- expectArraysEqual ( discovery . getPaths ( ) , [
131- { path : join ( workspacePath , "123.test" ) , contents : "123" } ,
132- { path : join ( workspacePath , "456.test" ) , contents : "456" } ,
133- { path : join ( workspacePath , "bar" , "789.test" ) , contents : "789" } ,
134- ] ) ;
129+ expect ( new Set ( discovery . getPaths ( ) ) ) . toEqual (
130+ new Set ( [
131+ { path : join ( workspacePath , "123.test" ) , contents : "123" } ,
132+ { path : join ( workspacePath , "456.test" ) , contents : "456" } ,
133+ { path : join ( workspacePath , "bar" , "789.test" ) , contents : "789" } ,
134+ ] ) ,
135+ ) ;
135136 } ) ;
136137
137138 it ( "should ignore non-test files" , async ( ) => {
@@ -141,9 +142,9 @@ describe("FilePathDiscovery", () => {
141142
142143 await discovery . initialRefresh ( ) ;
143144
144- expectArraysEqual ( discovery . getPaths ( ) , [
145- { path : join ( workspacePath , "1.test" ) , contents : "1" } ,
146- ] ) ;
145+ expect ( new Set ( discovery . getPaths ( ) ) ) . toEqual (
146+ new Set ( [ { path : join ( workspacePath , "1.test" ) , contents : "1" } ] ) ,
147+ ) ;
147148 } ) ;
148149 } ) ;
149150
@@ -161,9 +162,9 @@ describe("FilePathDiscovery", () => {
161162 onDidCreateFile . fire ( Uri . file ( newFile ) ) ;
162163 await discovery . waitForCurrentRefresh ( ) ;
163164
164- expectArraysEqual ( discovery . getPaths ( ) , [
165- { path : join ( workspacePath , "1.test" ) , contents : "1" } ,
166- ] ) ;
165+ expect ( new Set ( discovery . getPaths ( ) ) ) . toEqual (
166+ new Set ( [ { path : join ( workspacePath , "1.test" ) , contents : "1" } ] ) ,
167+ ) ;
167168 expect ( didChangePathsListener ) . toHaveBeenCalled ( ) ;
168169 } ) ;
169170
@@ -178,7 +179,7 @@ describe("FilePathDiscovery", () => {
178179 onDidCreateFile . fire ( Uri . file ( join ( workspacePath , "1.test" ) ) ) ;
179180 await discovery . waitForCurrentRefresh ( ) ;
180181
181- expectArraysEqual ( discovery . getPaths ( ) , [ ] ) ;
182+ expect ( discovery . getPaths ( ) ) . toEqual ( [ ] ) ;
182183 expect ( didChangePathsListener ) . not . toHaveBeenCalled ( ) ;
183184 } ) ;
184185
@@ -197,11 +198,13 @@ describe("FilePathDiscovery", () => {
197198 onDidCreateFile . fire ( Uri . file ( newDir ) ) ;
198199 await discovery . waitForCurrentRefresh ( ) ;
199200
200- expectArraysEqual ( discovery . getPaths ( ) , [
201- { path : join ( newDir , "1.test" ) , contents : "1" } ,
202- { path : join ( newDir , "bar" , "2.test" ) , contents : "2" } ,
203- { path : join ( newDir , "bar" , "3.test" ) , contents : "3" } ,
204- ] ) ;
201+ expect ( new Set ( discovery . getPaths ( ) ) ) . toEqual (
202+ new Set ( [
203+ { path : join ( newDir , "1.test" ) , contents : "1" } ,
204+ { path : join ( newDir , "bar" , "2.test" ) , contents : "2" } ,
205+ { path : join ( newDir , "bar" , "3.test" ) , contents : "3" } ,
206+ ] ) ,
207+ ) ;
205208 expect ( didChangePathsListener ) . toHaveBeenCalled ( ) ;
206209 } ) ;
207210
@@ -214,16 +217,16 @@ describe("FilePathDiscovery", () => {
214217 const didChangePathsListener = jest . fn ( ) ;
215218 discovery . onDidChangePaths ( didChangePathsListener ) ;
216219
217- expectArraysEqual ( discovery . getPaths ( ) , [
218- { path : join ( workspacePath , "1.test" ) , contents : "1" } ,
219- ] ) ;
220+ expect ( new Set ( discovery . getPaths ( ) ) ) . toEqual (
221+ new Set ( [ { path : join ( workspacePath , "1.test" ) , contents : "1" } ] ) ,
222+ ) ;
220223
221224 onDidCreateFile . fire ( Uri . file ( testFile ) ) ;
222225 await discovery . waitForCurrentRefresh ( ) ;
223226
224- expectArraysEqual ( discovery . getPaths ( ) , [
225- { path : join ( workspacePath , "1.test" ) , contents : "1" } ,
226- ] ) ;
227+ expect ( new Set ( discovery . getPaths ( ) ) ) . toEqual (
228+ new Set ( [ { path : join ( workspacePath , "1.test" ) , contents : "1" } ] ) ,
229+ ) ;
227230 expect ( didChangePathsListener ) . not . toHaveBeenCalled ( ) ;
228231 } ) ;
229232 } ) ;
@@ -238,16 +241,16 @@ describe("FilePathDiscovery", () => {
238241 const didChangePathsListener = jest . fn ( ) ;
239242 discovery . onDidChangePaths ( didChangePathsListener ) ;
240243
241- expectArraysEqual ( discovery . getPaths ( ) , [
242- { path : join ( workspacePath , "123.test" ) , contents : "123" } ,
243- ] ) ;
244+ expect ( new Set ( discovery . getPaths ( ) ) ) . toEqual (
245+ new Set ( [ { path : join ( workspacePath , "123.test" ) , contents : "123" } ] ) ,
246+ ) ;
244247
245248 onDidChangeFile . fire ( Uri . file ( testFile ) ) ;
246249 await discovery . waitForCurrentRefresh ( ) ;
247250
248- expectArraysEqual ( discovery . getPaths ( ) , [
249- { path : join ( workspacePath , "123.test" ) , contents : "123" } ,
250- ] ) ;
251+ expect ( new Set ( discovery . getPaths ( ) ) ) . toEqual (
252+ new Set ( [ { path : join ( workspacePath , "123.test" ) , contents : "123" } ] ) ,
253+ ) ;
251254 expect ( didChangePathsListener ) . not . toHaveBeenCalled ( ) ;
252255 } ) ;
253256
@@ -260,17 +263,17 @@ describe("FilePathDiscovery", () => {
260263 const didChangePathsListener = jest . fn ( ) ;
261264 discovery . onDidChangePaths ( didChangePathsListener ) ;
262265
263- expectArraysEqual ( discovery . getPaths ( ) , [
264- { path : join ( workspacePath , "1.test" ) , contents : "foo" } ,
265- ] ) ;
266+ expect ( new Set ( discovery . getPaths ( ) ) ) . toEqual (
267+ new Set ( [ { path : join ( workspacePath , "1.test" ) , contents : "foo" } ] ) ,
268+ ) ;
266269
267270 writeFileSync ( testFile , "bar" ) ;
268271 onDidChangeFile . fire ( Uri . file ( testFile ) ) ;
269272 await discovery . waitForCurrentRefresh ( ) ;
270273
271- expectArraysEqual ( discovery . getPaths ( ) , [
272- { path : join ( workspacePath , "1.test" ) , contents : "bar" } ,
273- ] ) ;
274+ expect ( new Set ( discovery . getPaths ( ) ) ) . toEqual (
275+ new Set ( [ { path : join ( workspacePath , "1.test" ) , contents : "bar" } ] ) ,
276+ ) ;
274277 expect ( didChangePathsListener ) . toHaveBeenCalled ( ) ;
275278 } ) ;
276279 } ) ;
@@ -285,15 +288,15 @@ describe("FilePathDiscovery", () => {
285288 const didChangePathsListener = jest . fn ( ) ;
286289 discovery . onDidChangePaths ( didChangePathsListener ) ;
287290
288- expectArraysEqual ( discovery . getPaths ( ) , [
289- { path : join ( workspacePath , "1.test" ) , contents : "1" } ,
290- ] ) ;
291+ expect ( new Set ( discovery . getPaths ( ) ) ) . toEqual (
292+ new Set ( [ { path : join ( workspacePath , "1.test" ) , contents : "1" } ] ) ,
293+ ) ;
291294
292295 rmSync ( testFile ) ;
293296 onDidDeleteFile . fire ( Uri . file ( testFile ) ) ;
294297 await discovery . waitForCurrentRefresh ( ) ;
295298
296- expectArraysEqual ( discovery . getPaths ( ) , [ ] ) ;
299+ expect ( discovery . getPaths ( ) ) . toEqual ( [ ] ) ;
297300 expect ( didChangePathsListener ) . toHaveBeenCalled ( ) ;
298301 } ) ;
299302
@@ -306,16 +309,16 @@ describe("FilePathDiscovery", () => {
306309 const didChangePathsListener = jest . fn ( ) ;
307310 discovery . onDidChangePaths ( didChangePathsListener ) ;
308311
309- expectArraysEqual ( discovery . getPaths ( ) , [
310- { path : join ( workspacePath , "1.test" ) , contents : "1" } ,
311- ] ) ;
312+ expect ( new Set ( discovery . getPaths ( ) ) ) . toEqual (
313+ new Set ( [ { path : join ( workspacePath , "1.test" ) , contents : "1" } ] ) ,
314+ ) ;
312315
313316 onDidDeleteFile . fire ( Uri . file ( testFile ) ) ;
314317 await discovery . waitForCurrentRefresh ( ) ;
315318
316- expectArraysEqual ( discovery . getPaths ( ) , [
317- { path : join ( workspacePath , "1.test" ) , contents : "1" } ,
318- ] ) ;
319+ expect ( new Set ( discovery . getPaths ( ) ) ) . toEqual (
320+ new Set ( [ { path : join ( workspacePath , "1.test" ) , contents : "1" } ] ) ,
321+ ) ;
319322 expect ( didChangePathsListener ) . not . toHaveBeenCalled ( ) ;
320323 } ) ;
321324
@@ -329,20 +332,22 @@ describe("FilePathDiscovery", () => {
329332 const didChangePathsListener = jest . fn ( ) ;
330333 discovery . onDidChangePaths ( didChangePathsListener ) ;
331334
332- expectArraysEqual ( discovery . getPaths ( ) , [
333- { path : join ( workspacePath , "123.test" ) , contents : "123" } ,
334- { path : join ( workspacePath , "bar" , "456.test" ) , contents : "456" } ,
335- { path : join ( workspacePath , "bar" , "789.test" ) , contents : "789" } ,
336- ] ) ;
335+ expect ( new Set ( discovery . getPaths ( ) ) ) . toEqual (
336+ new Set ( [
337+ { path : join ( workspacePath , "123.test" ) , contents : "123" } ,
338+ { path : join ( workspacePath , "bar" , "456.test" ) , contents : "456" } ,
339+ { path : join ( workspacePath , "bar" , "789.test" ) , contents : "789" } ,
340+ ] ) ,
341+ ) ;
337342
338343 rmSync ( join ( workspacePath , "bar" ) , { recursive : true } ) ;
339344
340345 onDidDeleteFile . fire ( Uri . file ( join ( workspacePath , "bar" ) ) ) ;
341346 await discovery . waitForCurrentRefresh ( ) ;
342347
343- expectArraysEqual ( discovery . getPaths ( ) , [
344- { path : join ( workspacePath , "123.test" ) , contents : "123" } ,
345- ] ) ;
348+ expect ( new Set ( discovery . getPaths ( ) ) ) . toEqual (
349+ new Set ( [ { path : join ( workspacePath , "123.test" ) , contents : "123" } ] ) ,
350+ ) ;
346351 expect ( didChangePathsListener ) . toHaveBeenCalled ( ) ;
347352 } ) ;
348353 } ) ;
@@ -390,9 +395,9 @@ describe("FilePathDiscovery", () => {
390395
391396 await discovery . initialRefresh ( ) ;
392397
393- expectArraysEqual ( discovery . getPaths ( ) , [
394- { path : join ( workspacePath , "123.test" ) , contents : "123" } ,
395- ] ) ;
398+ expect ( new Set ( discovery . getPaths ( ) ) ) . toEqual (
399+ new Set ( [ { path : join ( workspacePath , "123.test" ) , contents : "123" } ] ) ,
400+ ) ;
396401
397402 const previousWorkspaceFolders = workspace . workspaceFolders || [ ] ;
398403 const newWorkspaceFolders : WorkspaceFolder [ ] = [
@@ -413,10 +418,12 @@ describe("FilePathDiscovery", () => {
413418 } ) ;
414419 await discovery . waitForCurrentRefresh ( ) ;
415420
416- expectArraysEqual ( discovery . getPaths ( ) , [
417- { path : join ( workspacePath , "123.test" ) , contents : "123" } ,
418- { path : join ( tmpDir , "workspace2" , "456.test" ) , contents : "456" } ,
419- ] ) ;
421+ expect ( new Set ( discovery . getPaths ( ) ) ) . toEqual (
422+ new Set ( [
423+ { path : join ( workspacePath , "123.test" ) , contents : "123" } ,
424+ { path : join ( tmpDir , "workspace2" , "456.test" ) , contents : "456" } ,
425+ ] ) ,
426+ ) ;
420427 } ) ;
421428
422429 it ( "should forgot files in old workspaces, even if the files on disk still exist" , async ( ) => {
@@ -439,10 +446,12 @@ describe("FilePathDiscovery", () => {
439446
440447 await discovery . initialRefresh ( ) ;
441448
442- expectArraysEqual ( discovery . getPaths ( ) , [
443- { path : join ( tmpDir , "workspace1" , "123.test" ) , contents : "123" } ,
444- { path : join ( tmpDir , "workspace2" , "456.test" ) , contents : "456" } ,
445- ] ) ;
449+ expect ( new Set ( discovery . getPaths ( ) ) ) . toEqual (
450+ new Set ( [
451+ { path : join ( tmpDir , "workspace1" , "123.test" ) , contents : "123" } ,
452+ { path : join ( tmpDir , "workspace2" , "456.test" ) , contents : "456" } ,
453+ ] ) ,
454+ ) ;
446455
447456 workspaceFoldersSpy . mockReturnValue ( [ workspaceFolders [ 0 ] ] ) ;
448457 onDidChangeWorkspaceFolders . fire ( {
@@ -451,9 +460,11 @@ describe("FilePathDiscovery", () => {
451460 } ) ;
452461 await discovery . waitForCurrentRefresh ( ) ;
453462
454- expectArraysEqual ( discovery . getPaths ( ) , [
455- { path : join ( tmpDir , "workspace1" , "123.test" ) , contents : "123" } ,
456- ] ) ;
463+ expect ( new Set ( discovery . getPaths ( ) ) ) . toEqual (
464+ new Set ( [
465+ { path : join ( tmpDir , "workspace1" , "123.test" ) , contents : "123" } ,
466+ ] ) ,
467+ ) ;
457468 } ) ;
458469 } ) ;
459470} ) ;
0 commit comments