From b0ed1e2f115350111d1718f0a1641251df968911 Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Thu, 14 Jun 2018 17:21:50 +0200 Subject: [PATCH] feat(ui): mocha task --- packages/@vue/cli-plugin-unit-mocha/ui.js | 18 ++++++++++++++++++ packages/@vue/cli-ui/locales/en.json | 8 ++++++++ 2 files changed, 26 insertions(+) create mode 100644 packages/@vue/cli-plugin-unit-mocha/ui.js 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" + } + } } }