|
|
@ -2,10 +2,9 @@ const { Server } = require('karma'); |
|
|
|
const merge = require('deepmerge'); |
|
|
|
const { join } = require('path'); |
|
|
|
|
|
|
|
module.exports = (neutrino) => { |
|
|
|
neutrino.on('test', ({ files, watch }) => { |
|
|
|
module.exports = (neutrino, tap) => { |
|
|
|
const tests = join(neutrino.options.tests, '**/*_test.js'); |
|
|
|
const sources = join(neutrino.options.source, '**/*.js'); |
|
|
|
const sources = join(neutrino.options.source, '**/*.js*'); |
|
|
|
const defaults = { |
|
|
|
plugins: [ |
|
|
|
require.resolve('karma-webpack'), |
|
|
@ -38,15 +37,20 @@ module.exports = (neutrino) => { |
|
|
|
] |
|
|
|
} |
|
|
|
}; |
|
|
|
const karma = merge.all([ |
|
|
|
defaults, |
|
|
|
neutrino.options.karma || {}, |
|
|
|
{ |
|
|
|
|
|
|
|
Object.assign(neutrino.options, { |
|
|
|
karma: merge(defaults, neutrino.options.karma || {}) |
|
|
|
}); |
|
|
|
|
|
|
|
neutrino.on('test', ({ files, watch }) => { |
|
|
|
const base = typeof tap === 'function' ? |
|
|
|
tap(neutrino.options.karma) : |
|
|
|
neutrino.options.karma; |
|
|
|
const karma = merge(base, { |
|
|
|
singleRun: !watch, |
|
|
|
autoWatch: watch, |
|
|
|
webpack: neutrino.config.toConfig() |
|
|
|
} |
|
|
|
]); |
|
|
|
}); |
|
|
|
|
|
|
|
delete karma.webpack.plugins; |
|
|
|
|
|
|
|