Skip to content

Commit dc01813

Browse files
committedAug 27, 2020
add time logging to test, make test faster, increase timeout
1 parent fe75d0d commit dc01813

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed
 

‎test/ManyWatchers.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@ const fixtures = path.join(__dirname, "fixtures");
1111
const testHelper = new TestHelper(fixtures);
1212

1313
describe("ManyWatchers", function() {
14-
this.timeout(240000);
14+
this.timeout(600000);
1515
beforeEach(testHelper.before);
1616
afterEach(testHelper.after);
1717

1818
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
1922
const files = [];
2023
for (let i = 1; i < 5000; i++) {
2124
let highBit = 1;
@@ -40,24 +43,31 @@ describe("ManyWatchers", function() {
4043
}
4144
testHelper.file("file");
4245
files.push(path.join(fixtures, "file"));
46+
console.timeEnd("creating files");
4347
testHelper.tick(10000, () => {
4448
const w = new Watchpack({
4549
aggregateTimeout: 1000
4650
});
4751
w.on("aggregated", function(changes) {
52+
console.timeEnd("detecting change event");
4853
Array.from(changes).should.be.eql([
4954
path.join(fixtures, "4096/900/file")
5055
]);
5156
w.close();
5257
done();
5358
});
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) {
5563
for (let j = 0; j < files.length - i; j += 987) {
5664
w.watch({ files: files.slice(j, j + i) });
5765
}
5866
}
5967
w.watch({ files });
68+
console.timeEnd("creating/closing watchers");
6069
testHelper.tick(10000, () => {
70+
console.time("detecting change event");
6171
testHelper.file("4096/900/file");
6272
});
6373
});

0 commit comments

Comments
 (0)
Please sign in to comment.