mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-04-21 03:48:36 -05:00
22 lines
566 B
JavaScript
22 lines
566 B
JavaScript
module.exports = api => {
|
|
api.registerCommand('test', {
|
|
description: 'run unit tests'
|
|
}, args => {
|
|
api.setEnv('test')
|
|
require('./runner')(api.resolveWebpackConfig(), args)
|
|
})
|
|
|
|
api.configureWebpack(webpackConfig => {
|
|
if (process.env.NODE_ENV === 'test') {
|
|
if (!webpackConfig.externals) {
|
|
webpackConfig.externals = []
|
|
}
|
|
webpackConfig.externals = [].conact(
|
|
webpackConfig.externals,
|
|
require('webpack-node-externals')()
|
|
)
|
|
webpackConfig.devtool = 'inline-cheap-module-source-map'
|
|
}
|
|
})
|
|
}
|