nikku/karma-browserify

Cannot read property 'bundleFile' of undefined

waitingduck opened this issue · 2 comments

Hi,

I recently want to use karma-broswerify. However, after I add karma-broswerify to preprocessor it return following error message

TypeError: Cannot read property 'bundleFile' of undefined
    at /Users/weiting.cheng/git/a-project/node_modules/karma-browserify/lib/bro.js:358:8
    at nextPreprocessor (/Users/weiting.cheng/git/a-project/node_modules/karma/lib/preprocessor.js:36:26)
    at /Users/weiting.cheng/git/a-project/node_modules/karma/lib/preprocessor.js:122:9
    at module.exports (/Users/weiting.cheng/git/a-project/node_modules/isbinaryfile/index.js:28:12)
    at /Users/weiting.cheng/git/a-project/node_modules/karma/lib/preprocessor.js:84:7
    at /Users/weiting.cheng/git/a-project/node_modules/graceful-fs/graceful-fs.js:78:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:404:3)

Here is my karma.conf.js

// Karma configuration
// Generated on Mon Feb 27 2017 16:36:18 GMT-0800 (PST)

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

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',


    // frameworks to use
    // available frameworks: https://npmjs.org/browse/keyword/karma-adapter
    frameworks: ['jasmine'],


    // list of files / patterns to load in the browser
    files: [
      './dist/bundle.js',
      './node_modules/angular-mocks/angular-mocks.js',
      'panel/**/*.spec.js'
    ],


    // list of files to exclude
    exclude: [
    ],


    // preprocess matching files before serving them to the browser
    // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
    preprocessors: {
      'panel/**/*.spec.js': [ 'browserify' ]
    },


    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress'],


    // web server port
    port: 9876,


    // enable / disable colors in the output (reporters and logs)
    colors: true,


    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,


    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,


    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['Chrome'],


    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: true,

    // Concurrency level
    // how many browser should be started simultaneous
    concurrency: Infinity,

    // browserify configuration
    browserify: {
      debug: true,
      transform: []
    }
  });
};

Karma version: 1.5.0
karma-browserify version: 5.1.1

Any though or suggestion that how this happen and how to fix it?
Thanks!

@waitingduck Have you tried setting browserify as a framework? e.g. frameworks: ['jasmine', 'browserify']

nikku commented

@JustinBeaudry Thanks for helping out! Your suggested fix should do it.

Closing this issue due to inactivity.