mercredi 24 février 2016

Angular unit tests with Karma/Jasmine - browser not defined

Whenever I run a unit test I get the error:

browser is not defined.

My config file is below - can anyone suggest the issue

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: http://ift.tt/1ft83uu
    frameworks: ['jasmine'],


    // list of files / patterns to load in the browser
    files: [
        'www-dev/js/ionic.bundle.js',
        'node_modules/angular-mocks/angular-mocks.js',
        'www-dev/js/app.js',
        'www-dev/js/templates.js',
        'www-dev/css/*.css',
        {pattern: 'tests/unit/unit.js', nocache: true, watched: true}
    ],


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


    // preprocess matching files before serving them to the browser
    // available preprocessors: http://ift.tt/1gyw6MG

    preprocessors: {
        './www-dev/js/app.js': ['coverage']
    },



    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: http://ift.tt/1ft83KQ

    reporters: ['progress','coverage'],
    coverageReporter: {
        type : 'html',
        dir : './tests/unit/'
    },

    // 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: http://ift.tt/1ft83KU
    browsers: ['Chrome', 'Firefox', 'IE'],


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

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

Aucun commentaire:

Enregistrer un commentaire