我在通过 gulp 运行业力测试时遇到问题。
我正在使用 phantomjs 启动器插件,当它尝试启动时,我看到以下内容:
[09:27:02] Starting 'karma-tests'...
DEPRECATED: use your own version of lodash, this will go away in karma@2.0
DEPRECATED: use your own version of lodash, this will go away in karma@2.0
28 01 2017 09:27:04.817:INFO [karma]: Karma v1.4.0 server started at http://0.0.0.0:9876/
28 01 2017 09:27:04.817:INFO [launcher]: Launching browser PhantomJS with unlimited concurrency
28 01 2017 09:27:04.817:INFO [launcher]: Starting browser PhantomJS
28 01 2017 09:27:07.882:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on socket VwHY_WyYXMEj3RvZAAAA with id 284
68634
28 01 2017 09:27:08.436:ERROR [phantomjs.launcher]: Fatal Windows exception, code 0xc0000005.
PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.
28 01 2017 09:27:08.471:ERROR [launcher]: PhantomJS crashed.
28 01 2017 09:27:08.475:INFO [launcher]: Trying to start PhantomJS again (1/2).
28 01 2017 09:27:10.457:WARN [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Disconnected (1 times)
PhantomJS 2.1.1 (Windows 8 0.0.0) ERROR
Disconnectedundefined
[09:27:10] 'karma-tests' errored after 7.9 s
[09:27:10] Error: 1
at formatError (C:\Users\asus\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:169:10)
at Gulp.<anonymous> (C:\Users\asus\AppData\Roaming\npm\node_modules\gulp\bin\gulp.js:195:15)
at emitOne (events.js:101:20)
at Gulp.emit (events.js:188:7)
at Gulp.Orchestrator._emitTaskDone (C:\Users\asus\Documents\Github\interACT\node_modules\orchestrator\index.js:264
:8)
at C:\Users\asus\Documents\Github\interACT\node_modules\orchestrator\index.js:275:23
at finish (C:\Users\asus\Documents\Github\interACT\node_modules\orchestrator\lib\runTask.js:21:8)
at cb (C:\Users\asus\Documents\Github\interACT\node_modules\orchestrator\lib\runTask.js:29:3)
at removeAllListeners (C:\Users\asus\Documents\Github\interACT\node_modules\karma\lib\server.js:380:7)
at Server.<anonymous> (C:\Users\asus\Documents\Github\interACT\node_modules\karma\lib\server.js:391:9)
at Server.g (events.js:291:16)
at emitNone (events.js:91:20)
at Server.emit (events.js:185:7)
at emitCloseNT (net.js:1555:8)
at _combinedTickCallback (internal/process/next_tick.js:71:11)
at process._tickDomainCallback (internal/process/next_tick.js:122:9)
我正在使用最新版本的 karma 和 phantomjs 启动器,我的 package.json 中有以下条目:
"karma": "^1.4.0",
"karma-phantomjs-launcher": "^1.0.2"
另外,我在全球范围内安装了 Phantomjs 2.1.1
错误的性质似乎表明这是与 Windows 相关的,我在 Windows 10 64 位平台上运行。
我正在运行的项目实际上安装在其他一些混合了 windows 7、windows 10 和 linux 的机器上。我在其他win 10机器上看到过这个问题,其余平台似乎都很好。直到最近(大约过去几周)我还没有在 win 10 上看到这个问题,所以我想知道某种 Windows 更新是否导致了无法预料的副作用。
我偶然更改了我的 karma 配置文件中的端口号,它设法运行了测试,但在进一步运行时它再次失败并出现相同的错误。再次更改端口没有任何区别。
我的业力配置如下所示:
module.exports = function(config) {
config.set({
logLevel : config.LOG_INFO,
colors: true,
browsers: ['PhantomJS'],
singleRun: true,
port: 9876,
autoWatch: false,
basePath: '../',
reporters: ['progress', 'coverage'],
coverageReporter: {
dir : 'test/coverage/',
reporters: [{
type: 'lcovonly',
subdir: '.',
file: 'karma-coverage.dat'
}, {
type : 'json',
subdir: '.',
file : 'karma-results.json'
}]
},
frameworks: ['jasmine'],
exclude: ['../dist/client/assets/scripts/angular_app.js'],
files: [
'dist/client/assets/scripts/jquery.js',
'dist/client/assets/scripts/bootstrap.js',
'dist/client/assets/scripts/bower_libs.js',
'dist/client/assets/scripts/d3.min.js',
'dist/client/assets/scripts/main.js',
'test/mocks/mocks.config.js',
'test/mocks/**/*.mock.js',
'src/client/app/**/*.module.js',
'src/client/app/**/!(*spec).js',
'src/client/app/**/*.spec.js'
],
preprocessors: {
'src/client/app/**/!(*spec).js': ['coverage']
}
});
};
有没有人遇到过这个问题,如果有,您是否设法找到解决方案?
如果您需要更多详细信息,请告诉我。
谢谢