mirror of
https://github.com/vuejs/vue-cli.git
synced 2026-01-16 20:30:19 -06:00
35 lines
731 B
JavaScript
35 lines
731 B
JavaScript
module.exports = cli => {
|
|
cli.injectFeature({
|
|
name: 'Unit Testing',
|
|
value: 'unit',
|
|
short: 'Unit'
|
|
})
|
|
|
|
cli.injectPrompt({
|
|
name: 'unit',
|
|
when: answers => answers.features.includes('unit'),
|
|
type: 'list',
|
|
message: 'Pick a unit testing solution:',
|
|
choices: [
|
|
{
|
|
name: 'Mocha + Chai',
|
|
value: 'mocha',
|
|
short: 'Mocha'
|
|
},
|
|
{
|
|
name: 'Jest',
|
|
value: 'jest',
|
|
short: 'Jest'
|
|
}
|
|
]
|
|
})
|
|
|
|
cli.onPromptComplete((answers, options) => {
|
|
if (answers.unit === 'mocha') {
|
|
options.plugins['@vue/cli-plugin-unit-mocha'] = {}
|
|
} else if (answers.unit === 'jest') {
|
|
options.plugins['@vue/cli-plugin-unit-jest'] = {}
|
|
}
|
|
})
|
|
}
|