karma-runner / grunt-karma

Grunt plugin for Karma.
MIT License
468 stars 116 forks source link

grunt-karma failing with phantomjs #137

Closed michaelBenin closed 9 years ago

michaelBenin commented 9 years ago

I have tests that pass in Google Chrome and Mozilla Firefox.

When running these tests in PhantomJS they fail.

Error message:

Running "karma:ci" (karma) task
WARN [launcher]: Can not load "PhantomJS", it is not registered!
  Perhaps you are missing some plugin?

After installing phantom globally with:

npm i -g phantomjs

Still get the same error:

Running "karma:ci" (karma) task
WARN [launcher]: Can not load "PhantomJS", it is not registered!
  Perhaps you are missing some plugin?

Here is my config:


// This is in the Gruntfile:
 karma: {
      options: {
        configFile: 'karma.conf.js'
      },
      dev: {
        browsers: ['Chrome', 'Firefox']
      },
      ci: {
        browsers: ['PhantomJS'],
        files: {
          src: [
            'browser_modules/modernizr/modernizr.js',
            'browser_modules/es5-shim/es5-shim.js',
            'browser/js/utils/namespace.js',
            'test/browser/**/*_test.js'
          ]
        }
      }
    },
// This is the karma.conf
'use strict';

var exposify = require('exposify');

module.exports = function (config) {
  exposify.config = {
    foundation: 'Foundation'
  };

  config.set({
    frameworks: ['mocha', 'browserify', 'chai', 'sinon-chai', 'chai-as-promised'],

    client: {
      mocha: {
        reporter: 'html', // change Karma's debug.html to the mocha web reporter
        ui: 'bdd'
      }
    },

    files: [
      'browser_modules/modernizr/modernizr.js',
      'browser/js/utils/namespace.js',
      'test/browser/**/*_test.js'
    ],

    preprocessors: {
      'browser/**': ['browserify'],
      'test/browser/**/*_test.js': ['browserify']
    },

    reporters: ['spec'],

    singleRun: true,
    autoWatch: false,

    logLevel: config.LOG_WARN,

    browserify: {
      debug: true,
      transform: [
        'brfs',
        'hbsfy',
        'exposify'
      ]
    }
  });

};
michaelBenin commented 9 years ago

fixed with karma-phantomjs-launcher