Skip to content

Commit da53969

Browse files
committed
add --skip-flaky and --just-flaky CLI opts for text-image
1 parent 54e9c4f commit da53969

File tree

1 file changed

+43
-33
lines changed

1 file changed

+43
-33
lines changed

test/image/compare_pixels_test.js

Lines changed: 43 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@ var QUEUE_WAIT = 10;
4747
* Run all gl3d image test in queue:
4848
*
4949
* npm run test-image -- gl3d_* --queue
50+
*
51+
*
5052
*/
5153

52-
var argv = minimist(process.argv.slice(2), {boolean: ['queue', 'filter' ]});
53-
var isInQueue = argv.queue;
54-
var filter = argv.filter;
54+
var argv = minimist(process.argv.slice(2), {
55+
boolean: ['queue', 'filter', 'skip-flaky', 'just-flaky']
56+
});
5557

5658
var allMock = false;
5759
// If no pattern is provided, all mocks are compared
@@ -80,40 +82,38 @@ allMockList = allMockList.filter(unique);
8082

8183
// filter out untestable mocks if no pattern is specified (ie. we're testing all mocks)
8284
// or if flag '--filter' is provided
83-
if(allMock || filter) {
85+
console.log('');
86+
if(allMock || argv.filter) {
8487
console.log('Filtering out untestable mocks:');
85-
allMockList = allMockList.filter(untestableFilter);
86-
console.log('\n');
87-
}
88-
89-
sortGl2dMockList(allMockList);
90-
91-
// main
92-
if(isInQueue) {
93-
runInQueue(allMockList);
94-
} else {
95-
runInBatch(allMockList);
88+
// Test cases:
89+
// - font-wishlist
90+
// - all mapbox
91+
// don't behave consistently from run-to-run and/or
92+
// machine-to-machine; skip over them for now.
93+
allMockList = allMockList.filter(function(mockName) {
94+
var cond = !(
95+
mockName === 'font-wishlist' ||
96+
mockName.indexOf('mapbox_') !== -1
97+
);
98+
if(!cond) console.log(' -', mockName);
99+
return cond;
100+
});
96101
}
97102

98-
/* Test cases:
99-
*
100-
* - font-wishlist
101-
* - all mapbox
102-
*
103-
* don't behave consistently from run-to-run and/or
104-
* machine-to-machine; skip over them for now.
105-
*
106-
*/
107-
function untestableFilter(mockName) {
108-
var cond =
109-
!(
110-
mockName === 'font-wishlist' ||
111-
mockName.indexOf('mapbox_') !== -1
112-
);
113-
114-
if(!cond) console.log(' -', mockName);
103+
var FLAKY_LIST = [
104+
];
115105

116-
return cond;
106+
console.log('');
107+
if(argv['skip-flaky']) {
108+
allMockList = allMockList.filter(function(mockName) {
109+
var cond = FLAKY_LIST.indexOf(mockName) === -1;
110+
if(!cond) console.log('Skipping flaky mock', mockName);
111+
return cond;
112+
});
113+
} else if(argv['just-flaky']) {
114+
allMockList = allMockList.filter(function(mockName) {
115+
return FLAKY_LIST.indexOf(mockName) !== -1;
116+
});
117117
}
118118

119119
/* gl2d pointcloud and other non-regl gl2d mock(s)
@@ -277,3 +277,13 @@ function comparePixels(mockName, cb) {
277277
.pipe(saveImageStream)
278278
.on('close', checkImage);
279279
}
280+
281+
sortGl2dMockList(allMockList);
282+
console.log('');
283+
284+
// main
285+
if(argv.queue) {
286+
runInQueue(allMockList);
287+
} else {
288+
runInBatch(allMockList);
289+
}

0 commit comments

Comments
 (0)