Browse files

Add debugging for flaky tests

  • Loading branch information...
1 parent fd9034d commit 0fa62875bb0955944235a78327352f80bc828ad6 @gotwarlost committed Dec 10, 2012
Showing with 17 additions and 11 deletions.
  1. +6 −0 test/cli-helper.js
  2. +11 −11 test/cli/test-check-coverage-command.js
View
6 test/cli-helper.js
@@ -75,6 +75,12 @@ function runCommand(command, args, envVars, callback) {
var filtered = array.filter(function (item) {
return item.match(pat);
});
+ if (filtered.length === 0) {
+ console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
+ console.log('Could not find: ' + pat + ' in:');
+ console.log(array.join('\n'));
+ console.log('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
+ }
return filtered.length > 0;
};
};
View
22 test/cli/test-check-coverage-command.js
@@ -29,50 +29,50 @@ module.exports = {
test.ok(existsSync(path.resolve(OUTPUT_DIR, 'coverage.json')));
run([ '--statements', '72' ], function (results) {
test.ok(!results.succeeded());
- //test.ok(results.grepError(/Coverage for statements/));
+ test.ok(results.grepError(/Coverage for statements/));
test.done();
});
},
"should fail on inadequate branch coverage": function (test) {
test.ok(existsSync(path.resolve(OUTPUT_DIR, 'coverage.json')));
run([ '--branches', '72' ], function (results) {
test.ok(!results.succeeded());
- //test.ok(results.grepError(/Coverage for branches/));
+ test.ok(results.grepError(/Coverage for branches/));
test.done();
});
},
"should fail on inadequate function coverage": function (test) {
test.ok(existsSync(path.resolve(OUTPUT_DIR, 'coverage.json')));
run([ '--functions', '72' ], function (results) {
test.ok(!results.succeeded());
- //test.ok(results.grepError(/Coverage for functions/));
+ test.ok(results.grepError(/Coverage for functions/));
test.done();
});
},
"should fail on inadequate line coverage": function (test) {
test.ok(existsSync(path.resolve(OUTPUT_DIR, 'coverage.json')));
run([ '--lines', '72' ], function (results) {
test.ok(!results.succeeded());
- //test.ok(results.grepError(/Coverage for lines/));
+ test.ok(results.grepError(/Coverage for lines/));
test.done();
});
},
"should fail with multiple reasons when multiple thresholds violated": function (test) {
test.ok(existsSync(path.resolve(OUTPUT_DIR, 'coverage.json')));
- run([ '--statements=72','--functions=50','--branches=72','--lines=72' ], function (results) {
+ run([ '--statements=72', '--functions=50', '--branches=72', '--lines=72' ], function (results) {
test.ok(!results.succeeded());
- //test.ok(results.grepError(/Coverage for lines/));
- //test.ok(results.grepError(/Coverage for statements/));
- //test.ok(results.grepError(/Coverage for branches/));
- //test.ok(!results.grepError(/Coverage for functions/));
+ test.ok(results.grepError(/Coverage for lines/));
+ test.ok(results.grepError(/Coverage for statements/));
+ test.ok(results.grepError(/Coverage for branches/));
+ test.ok(!results.grepError(/Coverage for functions/));
test.done();
});
},
"should pass with multiple reasons when all thresholds in check": function (test) {
test.ok(existsSync(path.resolve(OUTPUT_DIR, 'coverage.json')));
- run([ '--statements=60','--functions=50','--branches=50','--lines=60', '-v' ], function (results) {
+ run([ '--statements=60', '--functions=50', '--branches=50', '--lines=60', '-v' ], function (results) {
test.ok(results.succeeded());
- //test.ok(!results.grepOutput(/\\"actuals\\"/), "Verbose message not printed as expected");
+ test.ok(!results.grepOutput(/\\"actuals\\"/), "Verbose message not printed as expected");
test.done();
});
},

0 comments on commit 0fa6287

Please sign in to comment.