Skip to content

Better spec reporting on CI #4012

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/jasmine/assets/modebar_button.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = function selectButton(modeBar, name) {

button.click = function() {
var ev = new window.MouseEvent('click');
node.dispatchEvent(ev);
if(node) node.dispatchEvent(ev);
};

button.isActive = function() {
Expand Down
2 changes: 1 addition & 1 deletion test/jasmine/assets/mouse_event.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ module.exports = function(type, x, y, opts) {
ev = new window.MouseEvent(type, fullOpts);
}

el.dispatchEvent(ev);
if(el) el.dispatchEvent(ev);

return el;
};
3 changes: 1 addition & 2 deletions test/jasmine/assets/touch_event.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,9 @@ module.exports = function(type, x, y, opts) {
fullOpts.shiftKey = opts.shiftKey;
}


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

el.dispatchEvent(ev);
if(el) el.dispatchEvent(ev);

return el;
};
52 changes: 38 additions & 14 deletions test/jasmine/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ var argv = minimist(process.argv.slice(4), {
string: ['bundleTest', 'width', 'height'],
'boolean': [
'info',
'nowatch', 'failFast', 'verbose', 'randomize',
'Chrome', 'Firefox', 'IE11'
'nowatch', 'failFast', 'randomize',
'Chrome', 'Firefox', 'IE11',
'verbose', 'showSkipped', 'report-progress', 'report-spec', 'report-dots'
],
alias: {
'Chrome': 'chrome',
Expand All @@ -24,11 +25,12 @@ var argv = minimist(process.argv.slice(4), {
'default': {
info: false,
nowatch: isCI,
failFast: false,
verbose: false,
randomize: false,
failFast: false,
width: '1035',
height: '617'
height: '617',
verbose: false,
showSkipped: isCI
}
});

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

var reporters = ((isFullSuite && !argv.tags) || argv.showSkipped) ? ['dots', 'spec'] : ['progress'];
var reporters = [];
if(argv['report-progress'] || argv['report-spec'] || argv['report-dots']) {
if(argv['report-progress']) reporters.push('progress');
if(argv['report-spec']) reporters.push('spec');
if(argv['report-dots']) reporters.push('dots');
} else {
if(isCI) {
reporters.push('spec');
} else {
if(isFullSuite) {
reporters.push('dots');
} else {
reporters.push('progress');
}
}
}

var hasSpecReporter = reporters.indexOf('spec') !== -1;

if(!hasSpecReporter && argv.showSkipped) reporters.push('spec');
if(argv.verbose) reporters.push('verbose');

function func(config) {
Expand Down Expand Up @@ -259,13 +283,13 @@ func.defaultConfig = {
}
},

// use 'karma-spec-reporter' to log info about skipped specs
specReporter: {
suppressErrorSummary: true,
suppressFailed: true,
suppressPassed: true,
suppressSkipped: false,
showSpecTiming: false
suppressErrorSummary: false,
suppressFailed: !hasSpecReporter,
suppressPassed: !hasSpecReporter,
// use 'karma-spec-reporter' to log info about skipped specs
suppressSkipped: !argv.showSkipped,
showSpecTiming: true
}
};

Expand Down
4 changes: 3 additions & 1 deletion test/jasmine/tests/annotations_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1547,7 +1547,9 @@ describe('annotation effects', function() {

setTimeout(function() {
var input = d3.select('.plugin-editable.editable');
input.node().dispatchEvent(new KeyboardEvent('blur'));
if(input.node()) {
input.node().dispatchEvent(new KeyboardEvent('blur'));
}
}, DBLCLICKDELAY * 1.1);
});
}
Expand Down