mardi 10 novembre 2015

Karma Testing React with ES6/Babel

I am trying to test my project using karma as my test runner, using the webpack babel-loader. The code all builds successfully (i think? or the CLI says it does, but when i open the browser all files fail immedialey on the es6 imports. Any idea what i'm doing wrong?

var path = require('path');

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

    basePath: '',
    // frameworks: ['jasmine', 'karma-webpack'],

    files: [
        'lib/bundle.js'
    ],

    exclude: ['*.styl'],

    preprocessors: {
        'test/**/*.js': ['webpack'],
        'test/**/*.jsx': ['webpack'],
        'src/**/*.jsx': ['webpack'],
        'src/**/*.js': ['webpack']
    },

    plugins: [
        require("karma-webpack")
    ],

    webpack: {
        entry: './src/entry.js',
         module: {
             loaders: [
                {
                    test: path.join(__dirname, 'src'),  
                    loader: 'babel-loader?stage=0&optional=runtime',
                    excludes: /node_modules/,
                    options: {
                        optional: ['runtime']
                    }
                }, 
                {
                    test: /\.styl$/,
                    loaders: ['style-loader', 'css-loader', 'stylus-loader']
                }
            ]
        },
        webpackMiddleware: {
          noInfo: true
        }
    }
});

};

10 11 2015 13:16:47.156:INFO [karma]: Delaying execution, these browsers are not ready: Chrome 46.0.2490 (Windows 8.1 0.0.0) Chrome 46.0.2490 (Windows 8.1 0.0.0) ERROR You need to include some adapter that implements karma.start method!

Chrome 46.0.2490 (Windows 8.1 0.0.0) ERROR You need to include some adapter that implements karma.start method!

browser errors here

Aucun commentaire:

Enregistrer un commentaire