Skip to content

Commit e322bb7

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 e322bb7

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

test/image/compare_pixels_test.js

Lines changed: 35 additions & 3 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);
@@ -60,7 +61,19 @@ if(mockList.length === 0) {
6061
if(!pattern) {
6162
console.log('Filtering out untestable mocks:');
6263
mockList = mockList.filter(untestableFilter);
63-
console.log('\n');
64+
}
65+
66+
// gl2d have limited image-test support
67+
if(pattern === 'gl2d_*') {
68+
69+
if(!isInQueue) {
70+
console.log('WARN: Running gl2d image tests in batch may lead to unwanted results\n');
71+
}
72+
73+
if(isCI) {
74+
console.log('Filtering out multiple-subplot gl2d mocks:');
75+
mockList = mockList.filter(untestableGL2DonCIfilter);
76+
}
6477
}
6578

6679
// main
@@ -93,11 +106,30 @@ function untestableFilter(mockName) {
93106
return cond;
94107
}
95108

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

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

0 commit comments

Comments
 (0)