Error with Karma test runner and PhantomJS
Answered
I've included "karma-phantomjs-launcher" and "karma-teamcity-reporter" plugins.
I'm using the command line runner in my build step with the following command. (The build agent is running Windows, so need to call it via node):
node ./node_modules/karma/bin/karma start --reporters teamcity --single-run --browsers PhantomJS --colors false
Here's the resulting build log:
[13:03:54][Step 3/3] JavaScript Unit Tests (3s)
[13:03:54][JavaScript Unit Tests] 01 07 2016 12:50:28.950:INFO [karma]: Karma v0.13.22 server started at http://localhost:9876/
[13:03:54][JavaScript Unit Tests] 01 07 2016 12:50:28.991:INFO [launcher]: Starting browser PhantomJS
[13:03:58][JavaScript Unit Tests] 01 07 2016 12:50:32.086:INFO [PhantomJS 2.1.1 (Windows 7 0.0.0)]: Connected on socket /#RFdOZ6lVviwjiuhzAAAA with id 3312090
[13:03:58][JavaScript Unit Tests] PhantomJS 2.1.1 (Windows 7 0.0.0) ERROR
[13:03:58][JavaScript Unit Tests] You need to include some adapter that implements __karma__.start method!
[13:03:58][Step 3/3] Process exited with code 1
[13:03:58][Step 3/3] Step run jasmine unit tests via karma (Command Line) failed
How do I get an adapter that implements __karma__.start method?
Please sign in to leave a comment.
Seems like this is an issue with Karma itself.
http://stackoverflow.com/questions/24220888/error-you-need-to-include-some-adapter-that-implements-karma-start-method
https://github.com/karma-runner/karma-jasmine/issues/123
I was able to create a TeamCity specific configuration. For some reason I hadn't seen documentation on how to specify a config file, but just passing the name of the file is what worked. I'm now using this and it works:
node ./node_modules/karma/bin/karma start "config/karma-teamcity.conf.js"
Within that config file I'm specifically listing the plugins and setting browsers, colors and singeRun properties to what I had been trying to do from the command line arguments.
Hi Dennis,
Thank you for the update and posting the solution. Glad that issue was resolved!