Skip to content

Commit

Permalink
πŸ— Replace dots-style test reporters with the default Spec reporter (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
danielrozenberg authored Oct 4, 2023
1 parent 57d09a2 commit ecf5bcc
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 371 deletions.
13 changes: 2 additions & 11 deletions build-system/tasks/e2e/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
'use strict';

const argv = require('minimist')(process.argv.slice(2));
const ciReporter = require('./mocha-ci-reporter');
const CiReporter = require('./mocha-ci-reporter');
const config = require('../../test-configs/config');
const dotsReporter = require('./mocha-dots-reporter');
const fs = require('fs');
const glob = require('glob');
const http = require('http');
Expand Down Expand Up @@ -63,15 +62,7 @@ async function setUpTesting_() {
* @return {!Mocha}
*/
function createMocha_() {
let reporter;
if (argv.testnames || argv.watch) {
reporter = '';
} else if (isCircleciBuild()) {
// TODO(#28387) clean up this typing.
reporter = /** @type {*} */ (ciReporter);
} else {
reporter = dotsReporter;
}
const reporter = isCircleciBuild() ? CiReporter : undefined;

return new Mocha({
// e2e tests have a different standard for when a test is too slow,
Expand Down
30 changes: 13 additions & 17 deletions build-system/tasks/e2e/mocha-ci-reporter.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
const {reporters} = require('mocha');
const JsonReporter = require('./mocha-custom-json-reporter');
const mocha = require('mocha');
const MochaDotsReporter = require('./mocha-dots-reporter');
const MochaJUnitReporter = require('mocha-junit-reporter');
const {Base} = mocha.reporters;

/**
* @param {*} runner
* @param {*} options
* @return {MochaDotsReporter}
*/
function ciReporter(runner, options) {
Base.call(this, runner, options);
this._mochaDotsReporter = new MochaDotsReporter(runner);
this._jsonReporter = new JsonReporter(runner);
this._mochaJunitReporter = new MochaJUnitReporter(runner, options);
// TODO(#28387) clean up this typing.
return /** @type {*} */ (this);
class CiReporter extends reporters.Base {
/**
* @param {import('mocha').Runner} runner
* @param {import('mocha').MochaOptions} options
*/
constructor(runner, options) {
super(runner, options);
this._mochaSpecReporter = new reporters.Spec(runner);
this._jsonReporter = new JsonReporter(runner);
this._mochaJunitReporter = new MochaJUnitReporter(runner, options);
}
}
ciReporter.prototype.__proto__ = Base.prototype;

module.exports = ciReporter;
module.exports = CiReporter;
63 changes: 0 additions & 63 deletions build-system/tasks/e2e/mocha-dots-reporter.js

This file was deleted.

32 changes: 1 addition & 31 deletions build-system/test-configs/karma.conf.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

const {dotWrappingWidth} = require('../common/logging');
const {isCiBuild} = require('../common/ci');

const TEST_SERVER_PORT = 8081;
Expand All @@ -12,43 +11,15 @@ module.exports = {

hostname: 'localhost',

reporters: ['super-dots', 'spec'],

superDotsReporter: {
nbDotsPerLine: dotWrappingWidth,
color: {
success: 'green',
failure: 'red',
ignore: 'yellow',
},
icon: {
success: '●',
failure: '●',
ignore: 'β—‹',
},
},
reporters: ['spec'],

specReporter: {
suppressPassed: true,
suppressSkipped: true,
suppressFailed: false,
suppressErrorSummary: true,
maxLogLines: 20,
},

mochaReporter: {
output: 'full',
divider: false,
colors: {
success: 'green',
error: 'red',
info: 'yellow',
},
symbols: {
success: '●',
error: '●',
info: 'β—‹',
},
},

port: 9876,
Expand Down Expand Up @@ -114,6 +85,5 @@ module.exports = {
'karma-safarinative-launcher',
'karma-source-map-support',
'karma-spec-reporter',
'karma-super-dots-reporter',
],
};
Loading

0 comments on commit ecf5bcc

Please sign in to comment.