Skip to content

Commit b882de9

Browse files
authored
Merge pull request #4012 from plotly/try-spec-reporter
Better spec reporting on CI
2 parents dd7eb69 + 241a9c6 commit b882de9

File tree

5 files changed

+44
-19
lines changed

5 files changed

+44
-19
lines changed

test/jasmine/assets/modebar_button.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = function selectButton(modeBar, name) {
1818

1919
button.click = function() {
2020
var ev = new window.MouseEvent('click');
21-
node.dispatchEvent(ev);
21+
if(node) node.dispatchEvent(ev);
2222
};
2323

2424
button.isActive = function() {

test/jasmine/assets/mouse_event.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ module.exports = function(type, x, y, opts) {
4545
ev = new window.MouseEvent(type, fullOpts);
4646
}
4747

48-
el.dispatchEvent(ev);
48+
if(el) el.dispatchEvent(ev);
4949

5050
return el;
5151
};

test/jasmine/assets/touch_event.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,9 @@ module.exports = function(type, x, y, opts) {
3636
fullOpts.shiftKey = opts.shiftKey;
3737
}
3838

39-
4039
ev = new window.TouchEvent(type, Lib.extendFlat({}, fullOpts, opts));
4140

42-
el.dispatchEvent(ev);
41+
if(el) el.dispatchEvent(ev);
4342

4443
return el;
4544
};

test/jasmine/karma.conf.js

+38-14
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@ var argv = minimist(process.argv.slice(4), {
1010
string: ['bundleTest', 'width', 'height'],
1111
'boolean': [
1212
'info',
13-
'nowatch', 'failFast', 'verbose', 'randomize',
14-
'Chrome', 'Firefox', 'IE11'
13+
'nowatch', 'failFast', 'randomize',
14+
'Chrome', 'Firefox', 'IE11',
15+
'verbose', 'showSkipped', 'report-progress', 'report-spec', 'report-dots'
1516
],
1617
alias: {
1718
'Chrome': 'chrome',
@@ -24,11 +25,12 @@ var argv = minimist(process.argv.slice(4), {
2425
'default': {
2526
info: false,
2627
nowatch: isCI,
27-
failFast: false,
28-
verbose: false,
2928
randomize: false,
29+
failFast: false,
3030
width: '1035',
31-
height: '617'
31+
height: '617',
32+
verbose: false,
33+
showSkipped: isCI
3234
}
3335
});
3436

@@ -64,12 +66,15 @@ if(argv.info) {
6466
' - `--IE11` (alias -- `ie11`)`: run test in IE11 browser',
6567
' - `--nowatch (dflt: `false`, `true` on CI)`: run karma w/o `autoWatch` / multiple run mode',
6668
' - `--failFast` (dflt: `false`): exit karma upon first test failure',
67-
' - `--verbose` (dflt: `false`): show test result using verbose reporter',
68-
' - `--showSkipped` (dflt: `false`): show tests that are skipped',
6969
' - `--randomize` (dflt: `false`): randomize test ordering (useful to detect bad test teardown)',
7070
' - `--tags`: run only test with given tags (using the `jasmine-spec-tags` framework)',
7171
' - `--width`(dflt: 1035): set width of the browser window',
7272
' - `--height` (dflt: 617): set height of the browser window',
73+
' - `--verbose` (dflt: `false`): show test result using verbose reporter',
74+
' - `--showSkipped` show tests that are skipped',
75+
' - `--report-progress`: use *progress* reporter',
76+
' - `--report-spec`: use *spec* reporter',
77+
' - `--report-dots`: use *dots* reporter',
7378
'',
7479
'For info on the karma CLI options run `npm run test-jasmine -- --help`'
7580
].join('\n'));
@@ -119,7 +124,26 @@ var pathToCustomMatchers = path.join(__dirname, 'assets', 'custom_matchers.js');
119124
var pathToUnpolyfill = path.join(__dirname, 'assets', 'unpolyfill.js');
120125
var pathToMathJax = path.join(constants.pathToDist, 'extras', 'mathjax');
121126

122-
var reporters = ((isFullSuite && !argv.tags) || argv.showSkipped) ? ['dots', 'spec'] : ['progress'];
127+
var reporters = [];
128+
if(argv['report-progress'] || argv['report-spec'] || argv['report-dots']) {
129+
if(argv['report-progress']) reporters.push('progress');
130+
if(argv['report-spec']) reporters.push('spec');
131+
if(argv['report-dots']) reporters.push('dots');
132+
} else {
133+
if(isCI) {
134+
reporters.push('spec');
135+
} else {
136+
if(isFullSuite) {
137+
reporters.push('dots');
138+
} else {
139+
reporters.push('progress');
140+
}
141+
}
142+
}
143+
144+
var hasSpecReporter = reporters.indexOf('spec') !== -1;
145+
146+
if(!hasSpecReporter && argv.showSkipped) reporters.push('spec');
123147
if(argv.verbose) reporters.push('verbose');
124148

125149
function func(config) {
@@ -259,13 +283,13 @@ func.defaultConfig = {
259283
}
260284
},
261285

262-
// use 'karma-spec-reporter' to log info about skipped specs
263286
specReporter: {
264-
suppressErrorSummary: true,
265-
suppressFailed: true,
266-
suppressPassed: true,
267-
suppressSkipped: false,
268-
showSpecTiming: false
287+
suppressErrorSummary: false,
288+
suppressFailed: !hasSpecReporter,
289+
suppressPassed: !hasSpecReporter,
290+
// use 'karma-spec-reporter' to log info about skipped specs
291+
suppressSkipped: !argv.showSkipped,
292+
showSpecTiming: true
269293
}
270294
};
271295

test/jasmine/tests/annotations_test.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1547,7 +1547,9 @@ describe('annotation effects', function() {
15471547

15481548
setTimeout(function() {
15491549
var input = d3.select('.plugin-editable.editable');
1550-
input.node().dispatchEvent(new KeyboardEvent('blur'));
1550+
if(input.node()) {
1551+
input.node().dispatchEvent(new KeyboardEvent('blur'));
1552+
}
15511553
}, DBLCLICKDELAY * 1.1);
15521554
});
15531555
}

0 commit comments

Comments
 (0)