diff --git a/packages/@vue/cli-plugin-unit-mocha/ui.js b/packages/@vue/cli-plugin-unit-mocha/ui.js new file mode 100644 index 0000000000..3101db6d96 --- /dev/null +++ b/packages/@vue/cli-plugin-unit-mocha/ui.js @@ -0,0 +1,18 @@ +module.exports = api => { + api.describeTask({ + match: /vue-cli-service test:unit/, + description: 'mocha.tasks.test.description', + link: 'https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-unit-mocha#injected-commands', + prompts: [ + { + name: 'watch', + type: 'confirm', + default: false, + description: 'mocha.tasks.test.watch' + } + ], + onBeforeRun: ({ answers, args }) => { + if (answers.watch) args.push('--watch') + } + }) +} diff --git a/packages/@vue/cli-ui/locales/en.json b/packages/@vue/cli-ui/locales/en.json index 9beefce849..8cd7fe538b 100644 --- a/packages/@vue/cli-ui/locales/en.json +++ b/packages/@vue/cli-ui/locales/en.json @@ -543,5 +543,13 @@ "update": "Re-record every snapshot that fails during this test run" } } + }, + "mocha": { + "tasks": { + "test": { + "description": "Run unit tests with Mocha", + "watch": "Watch files for changes and rerun tests related to changed files" + } + } } }