Failed to capture PhantomJS when running through build server

I use Karma and PhantomJS with Jasmine to test my AngularJS. When I run my gulp test locally, it works fine, launches PhantomJS and runs all my tests, but when the tests run on the build server, it fails with the following errors:

Please note that I use VSTS and use their built-in cloud building system (hosted agent). Having said that this is quite a lot of tasks, and I use it only for gulp tasks (assembly, testing, etc.) When checking

[32m13 07 2016 15:21:32.260:INFO [karma]: [39mKarma v1.1.1 server started at http://localhost:9876/ [32m13 07 2016 15:21:32.262:INFO [launcher]: [39mLaunching browser PhantomJS with unlimited concurrency [32m13 07 2016 15:21:32.284:INFO [launcher]: [39mStarting browser PhantomJS [33m13 07 2016 15:22:32.285:WARN [launcher]: [39mPhantomJS have not captured in 60000 ms, killing. [33m13 07 2016 15:22:34.287:WARN [launcher]: [39mPhantomJS was not killed in 2000 ms, sending SIGKILL. [33m13 07 2016 15:22:36.288:WARN [launcher]: [39mPhantomJS was not killed by SIGKILL in 2000 ms, continuing. 

My Karma Configuration:

 var configuration = { basePath: "", files: listFiles(), singleRun: true, autoWatch: false, //usePolling: true, //transports: ["xhr-polling", "jsonp-polling"], frameworks: ["jasmine", "angular-filesort"], angularFilesort: { whitelist: [path.join(conf.paths.src, "/**/!(*.html|*.spec|*.mock).js")] }, ngHtml2JsPreprocessor: { stripPrefix: "src/", moduleName: "veriApp" }, browsers: ["PhantomJS"], //browsers: ["Chrome"], plugins: [ "karma-chrome-launcher", "karma-phantomjs-launcher", "karma-angular-filesort", "karma-jasmine", "karma-ng-html2js-preprocessor" ], preprocessors: { "src/**/*.html": ["ng-html2js"] } }; 

Here are the relevant parts of my package.json. Please note that NPM is installed before running the test.

 "karma": "1.1.1", "karma-angular-filesort": "1.0.0", "karma-jasmine": "1.0.2", "karma-ng-html2js-preprocessor": "1.0.0", "phantomjs-prebuilt": "2.1.4", "karma-phantomjs-launcher": "1.0.0", "karma-chrome-launcher": "1.0.1", 

I tried following the tips on the various answers, but none of them work! Perhaps I missed something?

+7
angularjs phantomjs karma-runner vsts vsts-build-task
source share
1 answer

So ... the solution is pretty simple, but it took a while to find:

On the Variables tab in the build setup, add an environment variable:

PHANTOMJS_BIN C: \ NPM \ Modules \ PhantomJS.cmd

Thanks to this link and this link .

+16
source share

All Articles