我意识到还有关于这个问题的其他帖子,但我一整天都找不到任何有助于解决我的问题的内容,我想知道是否有人知道修复或能够指出我正确的方向基于我的特定包版本。
我正在运行gulp来构建我的项目,当它到达karma / karma-coverage.conf.js文件时,它出错了我在标题中注意到的警告 - > PhantomJS没有在60000毫秒内捕获,杀死..
我正在运行NPM v 3.3.7,Node v 6.10.1
我的package.json:
{
"engines": {
"node": ">=4.2.4",
"npm": ">=2.1.6"
},
"dependencies": {},
"devDependencies": {
"browser-sync": "1.9.0",
"date-format": "0.0.2",
"del": "1.1.1",
"dgeni": "^0.4.1",
"dgeni-packages": "^0.10.13",
"glob": "^6.0.4",
"gulp": "3.8.10",
"gulp-angular-filesort": "1.0.4",
"gulp-batch": "1.0.4",
"gulp-bump": "0.3.0",
"gulp-concat": "2.4.3",
"gulp-copy": "0.0.2",
"gulp-filelist": "0.1.0",
"gulp-filter": "2.0.0",
"gulp-header": "1.2.2",
"gulp-help": "1.3.1",
"gulp-if": "1.2.5",
"gulp-ignore": "1.2.1",
"gulp-inject": "1.1.1",
"gulp-load-plugins": "0.8.0",
"gulp-minify-css": "^0.4.4",
"gulp-minify-html": "0.1.8",
"gulp-ng-html2js": "0.1.8",
"gulp-rename": "1.2.0",
"gulp-replace": "0.5.2",
"gulp-ruby-sass": "0.7.1",
"gulp-sourcemaps": "1.3.0",
"gulp-strip-debug": "1.0.2",
"gulp-tap": "0.1.3",
"gulp-tslint": "4.3.3",
"gulp-typescript": "2.10.0",
"gulp-uglify": "^1.1.0",
"gulp-useref": "^1.1.2",
"gulp-util": "3.0.2",
"gulp-watch": "^4.1.0",
"gulp-zip": "^3.0.2",
"jshint-stylish": "1.0.0",
"karma": "0.12.25",
"karma-as-promised": "1.0.0",
"karma-chrome-launcher": "0.1.5",
"karma-coverage": "0.2.6",
"karma-firefox-launcher": "0.1.3",
"karma-ie-launcher": "^0.1.5",
"karma-jasmine": "0.2.3",
"karma-junit-reporter": "0.2.2",
"karma-ng-html2js-preprocessor": "0.1.2",
"karma-phantomjs-launcher": "^1.0.0",
"license-collector": "^0.1.1",
"lodash": "^3.7.0",
"main-bower-files": "2.1.0",
"merge-stream": "^1.0.0",
"phantomjs": "1.9.19",
"phantomjs-polyfill": "0.0.1",
"request": "2.53.0",
"require-dir": "0.1.0",
"run-sequence": "1.0.2",
"shelljs": "0.3.0",
"tslint": "3.5.0",
"typedoc": "0.3.12",
"typescript": "1.7.3",
"yargs": "1.3.3"
}
}
我的karma-coverage.conf.js
/**
* Run Karma using this configuration file in order to have code coverage
*/
var baseConfig = require('./karma-debug.conf.js');
module.exports = function (config) {
baseConfig(config);
var path = require("path");
var JS_AND_CSS_REGEXP = /(.js|.css)$/i;
// Adds 'coverage' pre-processing on JS files
config.preprocessors['build/debug/components/**/*.js'] = ['coverage'];
// Adds a plugin dependency on karma-coverage
config.plugins.push('karma-coverage');
// Registers reporter
config.reporters.push('coverage');
// Browsers options : PhantomJS, Chrome ...
config.browsers = ['PhantomJS'];
// !!!! : Comment code below if you don't choose PhantomJS Browser : It adds the bind polyfill to phantomJS.
config.files.push({
pattern: 'node_modules/phantomjs-polyfill/bind-polyfill.js',
served: true,
included: true,
watched: false
});
config.autoWatch = false;
config.singleRun = true;
// Configure Reporter
config.coverageReporter = {
reporters: [{type: 'cobertura', dir: 'build/reports/coverage/'}, {type: 'html', dir: 'build/reports/coverage/'}]
}
// override development configuration!
config.browserNoActivityTimeout = 30000;
};
任何帮助表示赞赏!
答案 0 :(得分:0)
请尝试添加环境变量
PHANTOMJS_BIN
有价值
C:\Program Files\nodejs\phantomjs.cmd
我陷入了类似的问题,它解决了。您的安装中的值可能会有所不同。 (我不得不重启我的操作系统,赢得10)