Last active
October 10, 2015 21:03
-
-
Save KidkArolis/4df1b5096ac3b09b4020 to your computer and use it in GitHub Desktop.
karma start --grep tests/someTest.js
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 webpack = require('webpack') | |
var webpackConfig = require('./webpack.config') | |
module.exports = function (config) { | |
// prep your webpack config for karma | |
delete webpackConfig.entry | |
webpackConfig.devtool = 'cheap-inline-source-map' | |
// karma --grep | |
if (config.grep) { | |
var pattern = config.grep | |
.replace(/\.js$/, '') | |
.replace(/Test$/, '') | |
var testContext = './tests' | |
webpackConfig.plugins = (webpackConfig.plugins || []).concat([ | |
new webpack.ContextReplacementPlugin(new RegExp(testContext), function (result) { | |
if (result.request === testContext) { | |
result.regExp = new RegExp('.*' + pattern + '.*Test$') | |
} | |
}) | |
]) | |
} | |
config.set({ | |
// ... | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment