Skip to content

Commit aff909e

Browse files
committed
test: add support for gl2d in compare pixel test routine
- warn when gl2d are ran batch - skip over multiple subplot test on CI, see #980 for details
1 parent 0b449f0 commit aff909e

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

test/image/compare_pixels_test.js

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ var QUEUE_WAIT = 10;
5151
var pattern = process.argv[2];
5252
var mockList = getMockList(pattern);
5353
var isInQueue = (process.argv[3] === '--queue');
54+
var isCI = process.env.CIRCLECI;
5455

5556
if(mockList.length === 0) {
5657
throw new Error('No mocks found with pattern ' + pattern);
@@ -63,6 +64,20 @@ if(!pattern) {
6364
console.log('\n');
6465
}
6566

67+
// gl2d have limited image-test support
68+
if(pattern === 'gl2d_*') {
69+
70+
if(!isInQueue) {
71+
console.log('WARN: Running gl2d image tests in batch may lead to unwanted results\n');
72+
}
73+
74+
if(isCI) {
75+
console.log('Filtering out multiple-subplot gl2d mocks:');
76+
mockList = mockList.first(untestableGL2DonCIfilter);
77+
console.log('\n');
78+
}
79+
}
80+
6681
// main
6782
if(isInQueue) {
6883
runInQueue(mockList);
@@ -93,11 +108,30 @@ function untestableFilter(mockName) {
93108
return cond;
94109
}
95110

111+
/* gl2d mocks that have multiple subplots
112+
* can't be generated properly on CircleCI
113+
* at the moment.
114+
*
115+
* For more info see:
116+
* https://github.com/plotly/plotly.js/pull/980
117+
*
118+
*/
119+
function untestableGL2DonCIfilter(mockName) {
120+
var cond = [
121+
'gl2d_multiple_subplots',
122+
'gl2d_simple_inset',
123+
'gl2d_stacked_coupled_subplots',
124+
'gl2d_stacked_subplots'
125+
].indexOf(mockName) !== -1;
126+
127+
if(!cond) console.log(' -', mockName);
128+
129+
return cond;
130+
}
131+
96132
function runInBatch(mockList) {
97133
var running = 0;
98134

99-
// remove mapbox mocks if circle ci
100-
101135
test('testing mocks in batch', function(t) {
102136
t.plan(mockList.length);
103137

0 commit comments

Comments
 (0)