From ce8f14195d2e91085966dcf88825eb4570718a38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?TZ=20=7C=20=E5=A4=A9=E7=8C=AA?= Date: Tue, 21 Mar 2017 15:26:06 +0800 Subject: [PATCH] fix(cov): istanbul path env (#44) --- lib/cmd/cov.js | 16 ++++++++-------- package.json | 1 + 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/cmd/cov.js b/lib/cmd/cov.js index 489fe822..7fc73548 100644 --- a/lib/cmd/cov.js +++ b/lib/cmd/cov.js @@ -41,11 +41,6 @@ class CovCommand extends Command { process.env.NODE_ENV = 'test'; process.env.TMPDIR = tmpDir; - const opt = { - env: Object.assign({}, process.env), - execArgv, - }; - // istanbul coverage ignore const excludes = argv.x || (process.env.COV_EXCLUDES && process.env.COV_EXCLUDES.split(',')) || []; for (const exclude of excludes) { @@ -54,12 +49,17 @@ class CovCommand extends Command { argv.x = undefined; const covFile = require.resolve('istanbul/lib/cli.js'); - // resolve istanbul path for coffee - /* istanbul ignore next */ - process.env.istanbul_bin_path = covFile; const coverageDir = path.join(cwd, 'coverage'); yield rimraf(coverageDir); + const opt = { + execArgv, + // resolve istanbul path for coffee + env: Object.assign({ + istanbul_bin_path: covFile, + }, process.env), + }; + // save coverage-xxxx.json to $PWD/coverage const covArgs = this.getCovArgs(argv); debug('covArgs: %j', covArgs); diff --git a/package.json b/package.json index 245b3a60..2069d067 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "glob": "^7.1.1", "globby": "^6.1.0", "intelli-espower-loader": "^1.0.1", + "is-type-of": "^1.0.0", "istanbul": "^1.1.0-alpha.1", "mocha": "^3.2.0", "mz-modules": "^1.0.0",