Skip to content

Commit

Permalink
fix: don't pass prerequire (#57)
Browse files Browse the repository at this point in the history
mocha will check arguments when there is no test files
  • Loading branch information
popomore committed Jun 1, 2017
1 parent c1520b5 commit e0d03d3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/cmd/cov.js
Expand Up @@ -55,6 +55,7 @@ class CovCommand extends Command {
if (argv.prerequire) {
process.env.EGG_BIN_PREREQUIRE = 'true';
}
delete argv.prerequire;

// istanbul coverage ignore
if (argv.x) {
Expand Down
10 changes: 10 additions & 0 deletions test/lib/cmd/cov.test.js
Expand Up @@ -131,6 +131,16 @@ describe('test/lib/cmd/cov.test.js', () => {
.expect('code', 0)
.end();
});

it('should run cov when no test files', function* () {
mm(process.env, 'TESTS', 'noexist.js');
const cwd = path.join(__dirname, '../../fixtures/prerequire');
yield coffee.fork(eggBin, [ 'cov' ], { cwd })
.debug()
.coverage(false)
.expect('code', 0)
.end();
});
});
} else {
it('should exec test instead of cov in win32', done => {
Expand Down

0 comments on commit e0d03d3

Please sign in to comment.