Skip to content

Commit

Permalink
[BREAKING CHANGE] Helpers: Remove `collectSuite{Start,StartData,EndDa…
Browse files Browse the repository at this point in the history
…ta}` methods

No longer used.
  • Loading branch information
Krinkle committed Feb 14, 2021
1 parent cce0e4d commit 05fc407
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 66 deletions.
6 changes: 0 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ const TapReporter = require('./lib/reporters/TapReporter.js');
const ConsoleReporter = require('./lib/reporters/ConsoleReporter.js');
const SummaryReporter = require('./lib/reporters/SummaryReporter.js');
const {
collectSuiteStartData,
collectSuiteEndData,
createSuiteStart,
createTestStart
} = require('./lib/helpers.js');
const { autoRegister } = require('./lib/auto.js');
Expand All @@ -21,9 +18,6 @@ module.exports = {
ConsoleReporter,
SummaryReporter,
EventEmitter,
collectSuiteStartData,
collectSuiteEndData,
createSuiteStart,
createTestStart,
autoRegister
};
52 changes: 0 additions & 52 deletions lib/helpers.js
Original file line number Diff line number Diff line change
@@ -1,42 +1,3 @@
// TODO: Remove this function
function getAllTests (tests, childSuites) {
return tests
.concat(...childSuites.map(childSuite => getAllTests(childSuite.tests, childSuite.childSuites)));
}

// TODO: Remove this function
function collectSuiteStartData (tests, childSuites) {
return {
counts: {
total: getAllTests(tests, childSuites).length
}
};
}

// TODO: Remove this function
function collectSuiteEndData (childTests, childSuites = []) {
const all = getAllTests(childTests, childSuites);
const counts = {
passed: all.filter((test) => test.status === 'passed').length,
failed: all.filter((test) => test.status === 'failed').length,
skipped: all.filter((test) => test.status === 'skipped').length,
todo: all.filter((test) => test.status === 'todo').length,
total: all.length
};
const status = counts.failed > 0 ? 'failed' : 'passed';

let runtime = 0;
all.forEach((test) => {
runtime += (test.status === 'skipped' ? 0 : test.runtime);
});

return {
status,
counts,
runtime
};
}

function aggregateTests (all) {
const counts = {
passed: all.filter((test) => test.status === 'passed').length,
Expand All @@ -59,16 +20,6 @@ function aggregateTests (all) {
};
}

// TODO: Remove this function
function createSuiteStart (suiteEnd) {
const parentName = suiteEnd.fullName.slice(-2, -1)[0];
return {
name: suiteEnd.name,
parentName: parentName !== undefined ? parentName : null,
fullName: suiteEnd.fullName.slice()
};
}

function createTestStart (testEnd) {
return {
name: testEnd.name,
Expand All @@ -78,9 +29,6 @@ function createTestStart (testEnd) {
}

module.exports = {
collectSuiteStartData,
collectSuiteEndData,
aggregateTests,
createSuiteStart,
createTestStart
};
9 changes: 1 addition & 8 deletions test/unit/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,7 @@ QUnit.module('Helpers', function () {
});
});

QUnit.module('create functions', function () {
test('return a suite start', assert => {
assert.propEqual(
JsReporters.createSuiteStart(data.suiteEnd),
data.suiteStart
);
});

QUnit.module('create functions', () => {
test('return a test start', assert => {
assert.propEqual(
JsReporters.createTestStart(data.passingTest),
Expand Down

0 comments on commit 05fc407

Please sign in to comment.