1

When running tests with coverage unabled I get the following error:

PhantomJS 1.9.8 (Mac OS X 0.0.0) ERROR
  TypeError: 'undefined' is not an object (evaluating '__cov_D1A7MlvwxOn0_pa5rDu2WA.b['1'][0]')  
  at  
  http://localhost:9877/__karma__/var/folders/z5/sy272dds6z16v7cxmhnj9fkc0000gq/T/780b17f08376c0b3a4a0622d91a1b48c.browserify:32 <- project/project/app/modules/app.js:9:0

However, removing the coverage options everything work as expected (without coverage that is)
Version of relevant libs after the karma config


Here's my _karma.conf.js file:

'use strict';
var path = require('path');
var preprocessors = {};
preprocessors[__dirname.concat('/app/**/*.js')] = ['browserify', 'coverage'];

module.exports = function(config) {
  config.set({

    basePath: '../',
    frameworks: ['browserify', 'jasmine'],
    preprocessors: preprocessors,
    browsers: ['PhantomJS'],
    reporters: ['progress', 'coverage'],

    plugins : [
      'karma-chrome-launcher',
      'karma-firefox-launcher',
      'karma-phantomjs-launcher',
      'karma-jasmine',
      'karma-browserify',
      'karma-coverage'
    ],
    browserify: {
      debug: true,
      transform: [
        require('bulkify'),
        require('browserify-shim'),
        require('browserify-istanbul')
      ]
    },
    "coverageReporter": {
      "reporters": [
        {"type": "html"},
        {"type": "text-summary"}
      ]
    },
    singleRun: false,

    proxies: {
      '/': 'http://localhost:9876/'
    },

    colors: true,
    urlRoot: '/__karma__/',

    files: [
      // app-specific code
      path.resolve('app/modules/app.js'),

      // test files
      path.resolve('app/modules/**/*.spec.js')
    ]

  });

};

"browserify": "^11.0.1"
"browserify-istanbul": "^0.2.1"
"karma": "^0.13.9"
"karma-browserify": "^4.3.0"
"karma-jasmine": "^0.3.6"
"phantomjs": "^1.9.18"

Olivier Clément
  • 764
  • 1
  • 8
  • 27
  • Any one any solution to this, I'm hitting the same problem, but I'm using browserify 13.0.0. I even tried cloning the project and updating the dependancies but no joy. Tried following this example too https://github.com/jotaoncode/web-istanbul-browserify/blob/master/karma.local.conf.js – DJ Forth Feb 12 '16 at 11:32
  • 1
    look at this answer, it helped me: http://stackoverflow.com/a/36272887 – nicopace Oct 04 '16 at 04:46
  • Possible duplicate of [Istanbul gives me coverage but ends output with an error](https://stackoverflow.com/questions/33356347/istanbul-gives-me-coverage-but-ends-output-with-an-error) – Paul Sweatte Aug 25 '17 at 16:25

0 Answers0