diff --git a/bin/expresso b/bin/expresso index 5807f5a..5f31f9a 100755 --- a/bin/expresso +++ b/bin/expresso @@ -505,6 +505,17 @@ function rpad(str, width) { */ function reportCoverage(cov) { + // Source + for (var name in cov) { + if (name.match(/\.js$/)) { + var file = cov[name]; + if ((file.coverage < 100) || !quiet) { + print('\n [bold]{' + name + '}:'); + print(file.source); + sys.print('\n'); + } + } + } // Stats print('\n [bold]{Test Coverage}\n'); var sep = ' +------------------------------------------+----------+------+------+--------+', @@ -531,17 +542,6 @@ function reportCoverage(cov) { sys.print(' | ' + lpad(cov.totalMisses, 6)); sys.print(' |\n'); sys.puts(lastSep); - // Source - for (var name in cov) { - if (name.match(/\.js$/)) { - var file = cov[name]; - if ((file.coverage < 100) || !quiet) { - print('\n [bold]{' + name + '}:'); - print(file.source); - sys.print('\n'); - } - } - } } /** @@ -795,6 +795,12 @@ function runSuite(title, tests, fn) { function report() { cursor(true); process.emit('beforeExit'); + if (typeof _$jscoverage === 'object') { + populateCoverage(_$jscoverage); + if (!hasFullCoverage(_$jscoverage) || !quiet) { + reportCoverage(_$jscoverage); + } + } if (failures) { print('\n [bold]{Failures}: [red]{' + failures + '}\n\n'); notify('Failures: ' + failures); @@ -803,12 +809,6 @@ function report() { print('\n [green]{100%} ' + testcount + ' tests\n'); notify('100% ok'); } - if (typeof _$jscoverage === 'object') { - populateCoverage(_$jscoverage); - if (!hasFullCoverage(_$jscoverage) || !quiet) { - reportCoverage(_$jscoverage); - } - } } /**