Skip to content

Commit 6d8da96

Browse files
committed
enforce @flaky tags on 'it' blocks only
1 parent e23ee6e commit 6d8da96

File tree

3 files changed

+51
-46
lines changed

3 files changed

+51
-46
lines changed

tasks/test_syntax.js

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,11 @@ assertES5();
3434
function assertJasmineSuites() {
3535
var BLACK_LIST = ['fdescribe', 'fit', 'xdescribe', 'xit'];
3636
var TAGS = ['noCI', 'noCIdep', 'gl', 'flaky'];
37+
var IT_ONLY_TAGS = ['gl', 'flaky'];
3738
var logs = [];
3839

40+
var addTagPrefix = function(t) { return '@' + t; };
41+
3942
glob(combineGlobs([testGlob, bundleTestGlob]), function(err, files) {
4043
files.forEach(function(file) {
4144
var code = fs.readFileSync(file, 'utf-8');
@@ -58,7 +61,7 @@ function assertJasmineSuites() {
5861
logs.push([
5962
bn, lineInfo,
6063
'contains an unrecognized tag,',
61-
'not one of: ' + TAGS.map(function(t) { return '\@' + t; }).join(', ')
64+
'not one of: ' + TAGS.map(addTagPrefix).join(', ')
6265
].join(' '));
6366
}
6467
}
@@ -71,13 +74,15 @@ function assertJasmineSuites() {
7174
}
7275
}
7376

74-
if(isJasmineTestDescribe(node, 'gl')) {
75-
logs.push([
76-
bn, lineInfo,
77-
'contains a @gl tag is a *describe* block,',
78-
'@gl tags are allowed only in jasmine *it* blocks.'
79-
].join(' '));
80-
}
77+
IT_ONLY_TAGS.forEach(function(t) {
78+
if(isJasmineTestDescribe(node, t)) {
79+
logs.push([
80+
bn, lineInfo,
81+
'contains a', addTagPrefix(t), 'tag is a *describe* block,',
82+
addTagPrefix(t), 'tags are only allowed in jasmine *it* blocks.'
83+
].join(' '));
84+
}
85+
});
8186
});
8287
});
8388

test/jasmine/tests/select_test.js

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ var BOXEVENTS = [1, 2, 1];
109109
// assumes 5 points in the lasso path
110110
var LASSOEVENTS = [4, 2, 1];
111111

112-
describe('@flaky Test select box and lasso in general:', function() {
112+
describe('Test select box and lasso in general:', function() {
113113
var mock = require('@mocks/14.json');
114114
var selectPath = [[93, 193], [143, 193]];
115115
var lassoPath = [[316, 171], [318, 239], [335, 243], [328, 169]];
@@ -157,7 +157,7 @@ describe('@flaky Test select box and lasso in general:', function() {
157157
.then(done);
158158
});
159159

160-
it('should trigger selecting/selected/deselect events', function(done) {
160+
it('@flaky should trigger selecting/selected/deselect events', function(done) {
161161
resetEvents(gd);
162162

163163
drag(selectPath);
@@ -196,7 +196,7 @@ describe('@flaky Test select box and lasso in general:', function() {
196196
.then(done);
197197
});
198198

199-
it('should handle add/sub selection', function(done) {
199+
it('@flaky should handle add/sub selection', function(done) {
200200
resetEvents(gd);
201201

202202
drag(selectPath);
@@ -303,7 +303,7 @@ describe('@flaky Test select box and lasso in general:', function() {
303303
.then(done);
304304
});
305305

306-
it('should trigger selecting/selected/deselect events', function(done) {
306+
it('@flaky should trigger selecting/selected/deselect events', function(done) {
307307
resetEvents(gd);
308308

309309
drag(lassoPath);
@@ -342,7 +342,7 @@ describe('@flaky Test select box and lasso in general:', function() {
342342
.then(done);
343343
});
344344

345-
it('should set selected points in graph data', function(done) {
345+
it('@flaky should set selected points in graph data', function(done) {
346346
resetEvents(gd);
347347

348348
drag(lassoPath);
@@ -361,7 +361,7 @@ describe('@flaky Test select box and lasso in general:', function() {
361361
.then(done);
362362
});
363363

364-
it('should set selected points in full data', function(done) {
364+
it('@flaky should set selected points in full data', function(done) {
365365
resetEvents(gd);
366366

367367
drag(lassoPath);
@@ -380,7 +380,7 @@ describe('@flaky Test select box and lasso in general:', function() {
380380
.then(done);
381381
});
382382

383-
it('should trigger selecting/selected/deselect events for touches', function(done) {
383+
it('@flaky should trigger selecting/selected/deselect events for touches', function(done) {
384384
resetEvents(gd);
385385

386386
drag(lassoPath, {type: 'touch'});
@@ -415,7 +415,7 @@ describe('@flaky Test select box and lasso in general:', function() {
415415
});
416416
});
417417

418-
it('should skip over non-visible traces', function(done) {
418+
it('@flaky should skip over non-visible traces', function(done) {
419419
// note: this tests a mock with one or several invisible traces
420420
// the invisible traces in the other tests test for multiple
421421
// traces, with some visible and some not.
@@ -494,7 +494,7 @@ describe('@flaky Test select box and lasso in general:', function() {
494494
.then(done);
495495
});
496496

497-
it('should skip over BADNUM items', function(done) {
497+
it('@flaky should skip over BADNUM items', function(done) {
498498
var data = [{
499499
mode: 'markers',
500500
x: [null, undefined, NaN, 0, 'NA'],
@@ -533,7 +533,7 @@ describe('@flaky Test select box and lasso in general:', function() {
533533
.then(done);
534534
});
535535

536-
it('scroll zoom should clear selection regions', function(done) {
536+
it('@flaky scroll zoom should clear selection regions', function(done) {
537537
var gd = createGraphDiv();
538538
var mockCopy = Lib.extendDeep({}, mock);
539539
mockCopy.layout.dragmode = 'select';
@@ -566,7 +566,7 @@ describe('@flaky Test select box and lasso in general:', function() {
566566
.then(done);
567567
});
568568

569-
it('should select the right data with the corresponding select direction', function(done) {
569+
it('@flaky should select the right data with the corresponding select direction', function(done) {
570570

571571
var gd = createGraphDiv();
572572

@@ -627,7 +627,7 @@ describe('@flaky Test select box and lasso in general:', function() {
627627
.then(done);
628628
});
629629

630-
it('should clear selected points on double click only on pan/lasso modes', function(done) {
630+
it('@flaky should clear selected points on double click only on pan/lasso modes', function(done) {
631631
var gd = createGraphDiv();
632632
var fig = Lib.extendDeep({}, require('@mocks/0.json'));
633633
fig.data = [fig.data[0]];
@@ -735,7 +735,7 @@ describe('@flaky Test select box and lasso in general:', function() {
735735
.then(done);
736736
});
737737

738-
it('should remember selection polygons from previous select/lasso mode', function(done) {
738+
it('@flaky should remember selection polygons from previous select/lasso mode', function(done) {
739739
var gd = createGraphDiv();
740740
var path1 = [[150, 150], [170, 170]];
741741
var path2 = [[193, 193], [213, 193]];
@@ -872,7 +872,7 @@ describe('@flaky Test select box and lasso in general:', function() {
872872
});
873873
});
874874

875-
describe('@flaky Test select box and lasso per trace:', function() {
875+
describe('Test select box and lasso per trace:', function() {
876876
var gd;
877877

878878
beforeEach(function() {
@@ -999,7 +999,7 @@ describe('@flaky Test select box and lasso per trace:', function() {
999999
});
10001000
}
10011001

1002-
it('should work on scatterternary traces', function(done) {
1002+
it('@flaky should work on scatterternary traces', function(done) {
10031003
var assertPoints = makeAssertPoints(['a', 'b', 'c']);
10041004
var assertSelectedPoints = makeAssertSelectedPoints();
10051005

@@ -1052,7 +1052,7 @@ describe('@flaky Test select box and lasso per trace:', function() {
10521052
.then(done);
10531053
});
10541054

1055-
it('should work on scattercarpet traces', function(done) {
1055+
it('@flaky should work on scattercarpet traces', function(done) {
10561056
var assertPoints = makeAssertPoints(['a', 'b']);
10571057
var assertSelectedPoints = makeAssertSelectedPoints();
10581058

@@ -1088,7 +1088,7 @@ describe('@flaky Test select box and lasso per trace:', function() {
10881088
.then(done);
10891089
});
10901090

1091-
it('@noCI should work on scattermapbox traces', function(done) {
1091+
it('@noCI @flaky should work on scattermapbox traces', function(done) {
10921092
var assertPoints = makeAssertPoints(['lon', 'lat']);
10931093
var assertRanges = makeAssertRanges('mapbox');
10941094
var assertLassoPoints = makeAssertLassoPoints('mapbox');
@@ -1145,7 +1145,7 @@ describe('@flaky Test select box and lasso per trace:', function() {
11451145
.then(done);
11461146
}, LONG_TIMEOUT_INTERVAL);
11471147

1148-
it('should work on scattergeo traces', function(done) {
1148+
it('@flaky should work on scattergeo traces', function(done) {
11491149
var assertPoints = makeAssertPoints(['lon', 'lat']);
11501150
var assertSelectedPoints = makeAssertSelectedPoints();
11511151
var assertRanges = makeAssertRanges('geo');
@@ -1244,7 +1244,7 @@ describe('@flaky Test select box and lasso per trace:', function() {
12441244
.then(done);
12451245
}, LONG_TIMEOUT_INTERVAL);
12461246

1247-
it('should work on scatterpolar traces', function(done) {
1247+
it('@flaky should work on scatterpolar traces', function(done) {
12481248
var assertPoints = makeAssertPoints(['r', 'theta']);
12491249
var assertSelectedPoints = makeAssertSelectedPoints();
12501250

@@ -1282,7 +1282,7 @@ describe('@flaky Test select box and lasso per trace:', function() {
12821282
.then(done);
12831283
});
12841284

1285-
it('should work on choropleth traces', function(done) {
1285+
it('@flaky should work on choropleth traces', function(done) {
12861286
var assertPoints = makeAssertPoints(['location', 'z']);
12871287
var assertSelectedPoints = makeAssertSelectedPoints();
12881288
var assertRanges = makeAssertRanges('geo', -0.5);
@@ -1345,7 +1345,7 @@ describe('@flaky Test select box and lasso per trace:', function() {
13451345
.then(done);
13461346
}, LONG_TIMEOUT_INTERVAL);
13471347

1348-
it('should work for bar traces', function(done) {
1348+
it('@flaky should work for bar traces', function(done) {
13491349
var assertPoints = makeAssertPoints(['curveNumber', 'x', 'y']);
13501350
var assertSelectedPoints = makeAssertSelectedPoints();
13511351
var assertRanges = makeAssertRanges();
@@ -1418,7 +1418,7 @@ describe('@flaky Test select box and lasso per trace:', function() {
14181418
.then(done);
14191419
});
14201420

1421-
it('should work for date/category traces', function(done) {
1421+
it('@flaky should work for date/category traces', function(done) {
14221422
var assertPoints = makeAssertPoints(['curveNumber', 'x', 'y']);
14231423
var assertSelectedPoints = makeAssertSelectedPoints();
14241424

@@ -1478,7 +1478,7 @@ describe('@flaky Test select box and lasso per trace:', function() {
14781478
.then(done);
14791479
});
14801480

1481-
it('should work for histogram traces', function(done) {
1481+
it('@flaky should work for histogram traces', function(done) {
14821482
var assertPoints = makeAssertPoints(['curveNumber', 'x', 'y', 'pointIndices']);
14831483
var assertSelectedPoints = makeAssertSelectedPoints();
14841484
var assertRanges = makeAssertRanges();
@@ -1527,7 +1527,7 @@ describe('@flaky Test select box and lasso per trace:', function() {
15271527
.then(done);
15281528
});
15291529

1530-
it('should work for box traces', function(done) {
1530+
it('@flaky should work for box traces', function(done) {
15311531
var assertPoints = makeAssertPoints(['curveNumber', 'y', 'x']);
15321532
var assertSelectedPoints = makeAssertSelectedPoints();
15331533
var assertRanges = makeAssertRanges();
@@ -1591,7 +1591,7 @@ describe('@flaky Test select box and lasso per trace:', function() {
15911591
.then(done);
15921592
});
15931593

1594-
it('should work for violin traces', function(done) {
1594+
it('@flaky should work for violin traces', function(done) {
15951595
var assertPoints = makeAssertPoints(['curveNumber', 'y', 'x']);
15961596
var assertSelectedPoints = makeAssertSelectedPoints();
15971597
var assertRanges = makeAssertRanges();
@@ -1655,7 +1655,7 @@ describe('@flaky Test select box and lasso per trace:', function() {
16551655
});
16561656

16571657
['ohlc', 'candlestick'].forEach(function(type) {
1658-
it('should work for ' + type + ' traces', function(done) {
1658+
it('@flaky should work for ' + type + ' traces', function(done) {
16591659
var assertPoints = makeAssertPoints(['curveNumber', 'x', 'open', 'high', 'low', 'close']);
16601660
var assertSelectedPoints = makeAssertSelectedPoints();
16611661
var assertRanges = makeAssertRanges();
@@ -1731,7 +1731,7 @@ describe('@flaky Test select box and lasso per trace:', function() {
17311731
});
17321732
});
17331733

1734-
it('should work on traces with enabled transforms', function(done) {
1734+
it('@flaky should work on traces with enabled transforms', function(done) {
17351735
var assertSelectedPoints = makeAssertSelectedPoints();
17361736

17371737
Plotly.plot(gd, [{
@@ -1774,7 +1774,7 @@ describe('@flaky Test select box and lasso per trace:', function() {
17741774
.then(done);
17751775
});
17761776

1777-
it('should work on scatter/bar traces with text nodes', function(done) {
1777+
it('@flaky should work on scatter/bar traces with text nodes', function(done) {
17781778
var assertSelectedPoints = makeAssertSelectedPoints();
17791779

17801780
function assertFillOpacity(exp) {

test/jasmine/tests/shapes_test.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,9 +1072,9 @@ describe('A fixed size shape', function() {
10721072
// and (ii) line has a different resize behavior.
10731073
var shapeAndResizeTypes = combinations([{type: 'rect'}, {type: 'circle'}], resizeTypes);
10741074
shapeAndResizeTypes.forEach(function(testCase) {
1075-
describe('@flaky of type ' + testCase.type + ' can be ' + testCase.resizeDisplayName, function() {
1075+
describe('of type ' + testCase.type + ' can be ' + testCase.resizeDisplayName, function() {
10761076
resizeDirections.forEach(function(direction) {
1077-
it('over direction ' + direction, function(done) {
1077+
it('@flaky over direction ' + direction, function(done) {
10781078
layout.shapes[0].type = testCase.type;
10791079

10801080
Plotly.plot(gd, data, layout, {editable: true})
@@ -1102,14 +1102,14 @@ describe('A fixed size shape', function() {
11021102
});
11031103
});
11041104

1105-
describe('@flaky of type line', function() {
1105+
describe('of type line', function() {
11061106
beforeEach(function() {
11071107
layout.shapes[0].type = 'line';
11081108
layout.shapes[0].yanchor = 3;
11091109

11101110
});
11111111

1112-
it('can be moved by dragging the middle', function(done) {
1112+
it('@flaky can be moved by dragging the middle', function(done) {
11131113
Plotly.plot(gd, data, layout, {editable: true})
11141114
.then(function() {
11151115
var shapeNodeBeforeDrag = getFirstShapeNode();
@@ -1130,7 +1130,7 @@ describe('A fixed size shape', function() {
11301130
});
11311131
});
11321132

1133-
it('can be resized by dragging the start point', function(done) {
1133+
it('@flaky can be resized by dragging the start point', function(done) {
11341134
Plotly.plot(gd, data, layout, {editable: true})
11351135
.then(function() {
11361136
var shapeNodeBeforeDrag = getFirstShapeNode();
@@ -1153,7 +1153,7 @@ describe('A fixed size shape', function() {
11531153
});
11541154
});
11551155

1156-
it('can be resized by dragging the end point', function(done) {
1156+
it('@flaky can be resized by dragging the end point', function(done) {
11571157
Plotly.plot(gd, data, layout, {editable: true})
11581158
.then(function() {
11591159
var shapeNodeBeforeDrag = getFirstShapeNode();
@@ -1266,7 +1266,7 @@ describe('A fixed size shape', function() {
12661266
});
12671267
});
12681268

1269-
describe('@flaky Test shapes', function() {
1269+
describe('Test shapes', function() {
12701270
'use strict';
12711271

12721272
var gd, data, layout, config;
@@ -1308,7 +1308,7 @@ describe('@flaky Test shapes', function() {
13081308
];
13091309

13101310
testCases.forEach(function(testCase) {
1311-
it(testCase.title + ' should be draggable', function(done) {
1311+
it('@flaky ' + testCase.title + ' should be draggable', function(done) {
13121312
setupLayout(testCase, [{type: 'line'}, {type: 'rect'}, {type: 'circle'}, {type: 'path'}]);
13131313
testDragEachShape(done);
13141314
});
@@ -1319,7 +1319,7 @@ describe('@flaky Test shapes', function() {
13191319
var testTitle = testCase.title +
13201320
' should be resizeable over direction ' +
13211321
direction;
1322-
it(testTitle, function(done) {
1322+
it('@flaky ' + testTitle, function(done) {
13231323
// Exclude line because it has a different resize behavior
13241324
setupLayout(testCase, [{type: 'rect'}, {type: 'circle'}, {type: 'path'}]);
13251325
testResizeEachShape(direction, done);
@@ -1331,7 +1331,7 @@ describe('@flaky Test shapes', function() {
13311331
['start', 'end'].forEach(function(linePoint) {
13321332
var testTitle = 'Line shape ' + testCase.title +
13331333
' should be resizable by dragging the ' + linePoint + ' point';
1334-
it(testTitle, function(done) {
1334+
it('@flaky ' + testTitle, function(done) {
13351335
setupLayout(testCase, [{type: 'line'}]);
13361336
testLineResize(linePoint, done);
13371337
});

0 commit comments

Comments
 (0)