Created
December 6, 2015 16:40
-
-
Save xseignard/c1c0a0d38ca762b45bec to your computer and use it in GitHub Desktop.
karma config for react+webpack+mocha
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import webpack from 'karma-webpack'; | |
| module.exports = function (config) { | |
| config.set({ | |
| frameworks: [ 'mocha', 'chai' ], | |
| files: [ | |
| './node_modules/phantomjs-polyfill/bind-polyfill.js', | |
| 'test/**/*.test.jsx' | |
| ], | |
| plugins: [ webpack, 'karma-mocha', 'karma-chai', 'karma-phantomjs-launcher', 'karma-spec-reporter'], | |
| browsers: [ 'PhantomJS' ], | |
| preprocessors: { | |
| 'test/**/*.test.jsx': [ 'webpack' ], | |
| 'src/**/*.jsx': [ 'webpack' ] | |
| }, | |
| reporters: [ 'spec' ], | |
| webpack: { | |
| resolve: { | |
| extensions: ['', '.js', '.jsx', '.css'] | |
| }, | |
| module: { | |
| loaders: [ | |
| { | |
| test: /\.js|\.jsx$/, | |
| exclude: ['node_modules'], | |
| loader: 'babel' | |
| }, | |
| { | |
| test: /\.woff$/, | |
| loader: 'file-loader?name=[name].[ext]' | |
| }, | |
| { | |
| test: /\.png|\.jpg$/, | |
| loader: 'file-loader?name=img/[name].[ext]' | |
| }, | |
| { | |
| test: /\.css$/, | |
| loader: 'style-loader!css-loader?modules' | |
| }, | |
| { | |
| test: /\.md$/, | |
| loader: 'html!markdown' | |
| } | |
| ] | |
| } | |
| }, | |
| webpackMiddleware: { noInfo: true } | |
| }); | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment