Skip to content

Commit a3c21d5

Browse files
committed
test images in batches:
- by calling testMock inside setTimeout
1 parent 1bad588 commit a3c21d5

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

test/image/compare_pixels_test.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ else runSingle(userFileName);
3131
function runAll () {
3232
test('testing mocks', function (t) {
3333

34-
var files = fs.readdirSync(constants.pathToTestImageMocks);
34+
var allMocks = fs.readdirSync(constants.pathToTestImageMocks);
3535

3636
/*
3737
* Some test cases exhibit run-to-run randomness;
@@ -45,10 +45,16 @@ function runAll () {
4545
* - all gl2d (38)
4646
* - gl2d_bunny-hull (1)
4747
*/
48-
t.plan(files.length - 40);
48+
t.plan(allMocks.length - 40);
4949

50-
for (var i = 0; i < 20; i ++) {
51-
testMock(files[i], t);
50+
var BASE_TIMEOUT = 500,
51+
BATCH_SIZE = 5,
52+
cnt = 0;
53+
54+
for(var i = 0; i < allMocks.length; i++) {
55+
setTimeout(function() {
56+
testMock(allMocks[cnt++], t);
57+
}, BASE_TIMEOUT * Math.floor(i / BATCH_SIZE) * BATCH_SIZE);
5258
}
5359

5460
});

0 commit comments

Comments
 (0)