首先,这可能是PhantomJS has crashed - Fatal Windows exception, code 0xc0000005中的重复问题。我尝试了那里提供的解决方案,但仍然对我不起作用
我使用webpack 4 (4.16.5)
设置了一个karma 4.0.0
项目(在我使用karma 1.x.x
之前,但错误仍然相同)。由于我在项目中添加了更多的单元测试(尽管没有太多的测试用例),所以它开始发生。
这就是我运行测试时得到的结果(并非每次都运行,例如,如果我运行10次,通常可以运行2-3次)
PhantomJS 2.1.1 (Windows 8.0.0): Executed 0 of 37 SUCCESS (0 secs / 0 secs)
12 02 2019 14:01:09.798: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.
12 02 2019 14:01:09.910:ERROR [launcher]: PhantomJS crashed.
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.
12 02 2019 14:01:09.910:ERROR [launcher]: PhantomJS stdout:
12 02 2019 14:01:09.911:ERROR [launcher]: PhantomJS stderr: 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.
12 02 2019 14:01:09.915:INFO [launcher]: Trying to start PhantomJS again (1/2).
PhantomJS 2.1.1 (Windows 8.0.0) ERROR
Disconnectedreconnect failed before timeout of 2000ms (transport error)
PhantomJS 2.1.1 (Windows 8.0.0): Executed 0 of 37 DISCONNECTED (5.91 secs / 0 secs)
我点击了http://phantomjs.org/bug-reporting.html链接,但是找不到任何有价值的信息。
这是我的karma.conf.ts
module.exports = function karmaConfig(config) {
config.set({
singleRun: true,
frameworks: [
'jasmine'
],
files: [
'sdk/**/*.spec.ts'
],
preprocessors: {
'sdk/**/*.spec.ts': ['webpack', 'sourcemap'],
'sdk/**/!(*.spec).ts': ['coverage']
},
browsers: [
'PhantomJS'
],
reporters: [
'progress',
'coverage',
'junit'
],
coverageReporter: {
dir: 'coverage/',
reporters: [
{ type: 'text-summary' },
{ type: 'html' },
{
type: 'lcov',
dir: 'reports',
subdir: 'coverage'
}
]
},
junitReporter: {
outputFile: 'reports/junit/TEST-karma.xml',
useBrowserName: false
},
transports: ['polling'],
webpack: require('./webpack.config'),
webpackMiddleware: {
stats: 'errors-only'
},
logLevel: config.LOG_INFO,
});
};
非常感谢您提供有关如何解决此问题的建议,真的很烦人