diff --git a/lib/cmd/cov.js b/lib/cmd/cov.js index 89b3a370..254e895f 100644 --- a/lib/cmd/cov.js +++ b/lib/cmd/cov.js @@ -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) { diff --git a/test/lib/cmd/cov.test.js b/test/lib/cmd/cov.test.js index 7e12fe67..6aa3f6bb 100644 --- a/test/lib/cmd/cov.test.js +++ b/test/lib/cmd/cov.test.js @@ -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 => {