I am having issues running karma tests through gulp.
I am using the phantomjs launcher plugin, and when it attempts to launch I see the following:
[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)
I am using the latest versions of karma and phantomjs launcher, with the following entries in my package.json:
"karma": "^1.4.0",
"karma-phantomjs-launcher": "^1.0.2"
Plus I have Phantomjs 2.1.1 installed globally
The nature of the error seems to suggest this is Windows related, I am running on a windows 10 64 bit platform.
The project I am running is actually installed on some other machines which are a mix of windows 7, windows 10 and linux. I have seen this issue on the other win 10 machines, the rest of the platforms seem fine. Up until recently (past couple of weeks approx) I havent seen this issue on win 10, so I am wondering if some sort of windows update has caused an unforeseen side effect.
I did by chance change the port number in my karma config file and it managed to run the tests, but on a further run it failed again with the same error. Changing the port again made no difference.
My karma config looks as follows:
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']
}
});
};
Has anyone out there encountered this issue and if so have you managed to find a solution?
Let me know if you require further details.
Thanks