Skip to content

Commit

Permalink
unit test for instrumentation of multiple files
Browse files Browse the repository at this point in the history
  • Loading branch information
bjouhier committed Feb 2, 2016
1 parent 164a617 commit afc4bec
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/fixtures/coverage-multiple-code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = require('./coverage-code')
34 changes: 34 additions & 0 deletions test/testrunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,40 @@ chain.add('coverage', function() {
});
});

chain.add('coverage-multiple', function() {
tr.options.coverage = true;
tr.run({
code: fixtures + '/coverage-multiple-code.js',
tests: fixtures + '/coverage-test.js',
coverage: {
files: [
fixtures + '/coverage-multiple-code.js',
fixtures + '/coverage-code.js'
],
},
}, function(err, res) {
var stat = {
files: 1,
tests: 2,
assertions: 3,
failed: 0,
passed: 3,
coverage: {
files: 1,
statements: { covered: 7, total: 8 },
branches: { covered: 0, total: 0 },
functions: { covered: 3, total: 4 },
lines: { covered: 7, total: 8 }
}
};
delete res.runtime;
a.equal(err, null, 'no errors');
a.deepEqual(stat, res, 'coverage multiple code testing works');
tr.options.coverage = false;
chain.next();
});
});

if (generators.support) {
chain.add('generators', function() {
tr.run({
Expand Down

0 comments on commit afc4bec

Please sign in to comment.