From 611027f470c6adcae6cd4454d6920874f931983e Mon Sep 17 00:00:00 2001 From: Haoliang Gao Date: Fri, 28 Oct 2016 18:09:41 +0800 Subject: [PATCH] feat: use test when run cov on Windows (#18) it is wired to generate coverage on Windows https://github.com/eggjs/egg/pull/133#issuecomment-256827488 --- lib/cov_command.js | 6 ------ lib/program.js | 6 +++++- package.json | 1 - 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/lib/cov_command.js b/lib/cov_command.js index b19afc9e..ea2118f6 100644 --- a/lib/cov_command.js +++ b/lib/cov_command.js @@ -3,7 +3,6 @@ const path = require('path'); const mkdirp = require('mkdirp'); const rimraf = require('rimraf'); -const sleep = require('ko-sleep'); const Command = require('./command'); class CovCommand extends Command { @@ -44,11 +43,6 @@ class CovCommand extends Command { yield this.helper.forkNode(covFile, covArgs, opt); rimraf.sync(process.env.TMPDIR); - // wait 5 second for Windows - if (process.platform === 'win32') { - yield sleep(5000); - } - // create coverage report const reportArgs = this.getReportArgs(coverageDir); yield this.helper.forkNode(covFile, reportArgs, opt); diff --git a/lib/program.js b/lib/program.js index 8b289ec7..4e3b9104 100644 --- a/lib/program.js +++ b/lib/program.js @@ -10,7 +10,11 @@ class Program extends BaseProgram { this.addCommand('dev', path.join(__dirname, 'dev_command.js')); this.addCommand('debug', path.join(__dirname, 'debug_command.js')); this.addCommand('test', path.join(__dirname, 'test_command.js')); - this.addCommand('cov', path.join(__dirname, 'cov_command.js')); + if (process.platform === 'win32') { + this.addCommand('cov', path.join(__dirname, 'test_command.js')); + } else { + this.addCommand('cov', path.join(__dirname, 'cov_command.js')); + } } } diff --git a/package.json b/package.json index bbc15e99..dbb10661 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,6 @@ "egg-utils": "^1.0.0", "glob": "^7.1.1", "istanbul": "^0.4.0", - "ko-sleep": "^1.0.2", "mkdirp": "^0.5.1", "mocha": "^3.0.0", "rimraf": "^2.5.4",