Skip to content

Commit

Permalink
Merge branch 'integration'
Browse files Browse the repository at this point in the history
  • Loading branch information
tj committed Dec 8, 2010
2 parents da39f13 + 58e8030 commit 20ca881
Showing 1 changed file with 34 additions and 2 deletions.
36 changes: 34 additions & 2 deletions bin/expresso
Expand Up @@ -80,6 +80,12 @@ var serial = false;

var timeout = 2000;

/**
* Quiet output.
*/

var quiet = false;

/**
* Usage documentation.
*/
Expand All @@ -91,6 +97,7 @@ var usage = ''
+ '\n -w, --watch Watch for modifications and re-execute tests'
+ '\n -g, --growl Enable growl notifications'
+ '\n -c, --coverage Generate and report test coverage'
+ '\n -q, --quiet Suprress coverage report if 100%'
+ '\n -t, --timeout MS Timeout in milliseconds, defaults to 2000'
+ '\n -r, --require PATH Require the given module path'
+ '\n -o, --only TESTS Execute only the comma sperated TESTS (can be set several times)'
Expand Down Expand Up @@ -171,6 +178,10 @@ while (args.length) {
run(files);
})
break;
case '-q':
case '--quiet':
quiet = true;
break;
case '-b':
case '--boring':
boring = true;
Expand Down Expand Up @@ -478,7 +489,6 @@ function rpad(str, width) {
*/

function reportCoverage(cov) {
populateCoverage(cov);
// Stats
print('\n [bold]{Test Coverage}\n');
var sep = ' +------------------------------------------+----------+------+------+--------+',
Expand Down Expand Up @@ -576,6 +586,25 @@ function coverage(data, val) {
return n;
}

/**
* Test if all files have 100% coverage
*
* @param {Object} cov
* @return {Boolean}
*/

function hasFullCoverage(cov) {
for (var name in cov) {
var file = cov[name];
if (file instanceof Array) {
if (file.coverage !== 100) {
return false;
}
}
}
return true;
}

/**
* Run the given test `files`, or try _test/*_.
*
Expand Down Expand Up @@ -802,7 +831,10 @@ function report() {
notify('100% ok');
}
if (typeof _$jscoverage === 'object') {
reportCoverage(_$jscoverage);
populateCoverage(_$jscoverage);
if (!hasFullCoverage(_$jscoverage) || !quiet) {
reportCoverage(_$jscoverage);
}
}
}

Expand Down

0 comments on commit 20ca881

Please sign in to comment.