Skip to content

Commit

Permalink
also check for asserts.length
Browse files Browse the repository at this point in the history
Fixed invalid behavoir: on `output` when `results.tests` are empty, but `results.asserts` are not , `process.exit(1);` triggers.
Should trigger only when both are empty.
  • Loading branch information
Maxim Lutay committed May 26, 2018
1 parent 90cb1b8 commit 484f694
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions index.js
Expand Up @@ -89,9 +89,10 @@ module.exports = function (spec) {
output.push('\n\n\n');

// Exit if no tests run. This is a result of 1 of 2 things:
// 1. No tests were written
// 1. No tests and asserts were written
// 2. There was some error before the TAP got to the parser
if (results.tests.length === 0) {
if (results.tests.length === 0 &&
results.asserts.length === 0) {
process.exit(1);
}
});
Expand Down Expand Up @@ -120,7 +121,8 @@ module.exports = function (spec) {

function formatTotals (results) {

if (results.tests.length === 0) {
if (results.tests.length === 0 &&
results.asserts.length === 0) {
return pad(format.red(symbols.cross + ' No tests found'));
}

Expand Down

0 comments on commit 484f694

Please sign in to comment.