Created
September 8, 2016 20:24
-
-
Save JSila/268581a419d324ee557cfdf32c3b2e7e to your computer and use it in GitHub Desktop.
karma test runner example (with webpack)
This file contains 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
var webpackConfig = require('./webpack.config') | |
webpackConfig.entry = undefined | |
module.exports = function (config) { | |
config.set({ | |
browsers: ['Chrome'], | |
files: [ | |
'tests.webpack.js' // karma only needs to know where test files are. if you include source files, you are gonna have a bad time. | |
], | |
frameworks: ['mocha'], | |
preprocessors: { | |
'tests.webpack.js': ['webpack'] | |
}, | |
reporters: ['progress'], | |
singleRun: true, | |
webpack: webpackConfig, | |
webpackMiddleware: { | |
noInfo: true, | |
} | |
}); | |
}; |
This file contains 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
// tells karma where test files are located | |
// test files live in src and end with .spec.js | |
var testsContext = require.context("./src", true, /\.spec\.js$/); | |
testsContext.keys().forEach(testsContext); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment