@@ -11,11 +11,14 @@ const fixtures = path.join(__dirname, "fixtures");
11
11
const testHelper = new TestHelper ( fixtures ) ;
12
12
13
13
describe ( "ManyWatchers" , function ( ) {
14
- this . timeout ( 240000 ) ;
14
+ this . timeout ( 600000 ) ;
15
15
beforeEach ( testHelper . before ) ;
16
16
afterEach ( testHelper . after ) ;
17
17
18
18
it ( "should watch more than 4096 directories" , done => {
19
+ console . time ( "creating files" ) ;
20
+ // windows is very slow in creating so many files
21
+ // this can take about 1 minute
19
22
const files = [ ] ;
20
23
for ( let i = 1 ; i < 5000 ; i ++ ) {
21
24
let highBit = 1 ;
@@ -40,24 +43,31 @@ describe("ManyWatchers", function() {
40
43
}
41
44
testHelper . file ( "file" ) ;
42
45
files . push ( path . join ( fixtures , "file" ) ) ;
46
+ console . timeEnd ( "creating files" ) ;
43
47
testHelper . tick ( 10000 , ( ) => {
44
48
const w = new Watchpack ( {
45
49
aggregateTimeout : 1000
46
50
} ) ;
47
51
w . on ( "aggregated" , function ( changes ) {
52
+ console . timeEnd ( "detecting change event" ) ;
48
53
Array . from ( changes ) . should . be . eql ( [
49
54
path . join ( fixtures , "4096/900/file" )
50
55
] ) ;
51
56
w . close ( ) ;
52
57
done ( ) ;
53
58
} ) ;
54
- for ( let i = 100 ; i < files . length ; i += 987 ) {
59
+ console . time ( "creating/closing watchers" ) ;
60
+ // MacOS is very slow in creating and destroying watchers
61
+ // This can take about 2 minutes
62
+ for ( let i = 100 ; i < files . length ; i += 2432 ) {
55
63
for ( let j = 0 ; j < files . length - i ; j += 987 ) {
56
64
w . watch ( { files : files . slice ( j , j + i ) } ) ;
57
65
}
58
66
}
59
67
w . watch ( { files } ) ;
68
+ console . timeEnd ( "creating/closing watchers" ) ;
60
69
testHelper . tick ( 10000 , ( ) => {
70
+ console . time ( "detecting change event" ) ;
61
71
testHelper . file ( "4096/900/file" ) ;
62
72
} ) ;
63
73
} ) ;
0 commit comments