From 692d4638d89cf73791c77490384539755182b78f Mon Sep 17 00:00:00 2001 From: Guillaume Chau Date: Mon, 11 Jun 2018 20:43:53 +0200 Subject: [PATCH] feat(ui): jest task --- packages/@vue/cli-plugin-unit-jest/ui.js | 30 +++++++++++++++++++ packages/@vue/cli-ui/locales/en.json | 10 +++++++ packages/@vue/cli-ui/src/style/main.styl | 6 ++++ .../cli-ui/src/views/ProjectTaskDetails.vue | 2 +- 4 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 packages/@vue/cli-plugin-unit-jest/ui.js diff --git a/packages/@vue/cli-plugin-unit-jest/ui.js b/packages/@vue/cli-plugin-unit-jest/ui.js new file mode 100644 index 000000000..34ab1612a --- /dev/null +++ b/packages/@vue/cli-plugin-unit-jest/ui.js @@ -0,0 +1,30 @@ +module.exports = api => { + api.describeTask({ + match: /vue-cli-service test:unit/, + description: 'jest.tasks.test.description', + link: 'https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-unit-jest#injected-commands', + prompts: [ + { + name: 'watch', + type: 'confirm', + description: 'jest.tasks.test.watch' + }, + { + name: 'notify', + type: 'confirm', + description: 'jest.tasks.test.notify', + when: answers => answers.watch + }, + { + name: 'update', + type: 'confirm', + description: 'jest.tasks.test.update' + } + ], + onBeforeRun: ({ answers, args }) => { + if (answers.watch) args.push('--watch') + if (answers.notify) args.push('--notify') + if (answers.update) args.push('--updateSnapshot') + } + }) +} diff --git a/packages/@vue/cli-ui/locales/en.json b/packages/@vue/cli-ui/locales/en.json index a184adc9f..89cf5816e 100644 --- a/packages/@vue/cli-ui/locales/en.json +++ b/packages/@vue/cli-ui/locales/en.json @@ -511,5 +511,15 @@ "url": "Run e2e tests against given url instead of auto-starting dev server" } } + }, + "jest": { + "tasks": { + "test": { + "description": "Run unit tests with Jestks", + "watch": "Watch files for changes and rerun tests related to changed files", + "notify": "Display a notification after each run", + "update": "Re-record every snapshot that fails during this test run" + } + } } } diff --git a/packages/@vue/cli-ui/src/style/main.styl b/packages/@vue/cli-ui/src/style/main.styl index bfd1cceef..177a0a41c 100644 --- a/packages/@vue/cli-ui/src/style/main.styl +++ b/packages/@vue/cli-ui/src/style/main.styl @@ -152,3 +152,9 @@ ansi-colors('white', $vue-ui-color-light) height 1px background rgba($vue-ui-color-dark, .1) margin ($padding-item / 2) 0 + +.vue-ui-modal + &.anchor + align-items flex-start + .shell + margin-top 42px \ No newline at end of file diff --git a/packages/@vue/cli-ui/src/views/ProjectTaskDetails.vue b/packages/@vue/cli-ui/src/views/ProjectTaskDetails.vue index 72fc27c6d..d95cb4310 100644 --- a/packages/@vue/cli-ui/src/views/ProjectTaskDetails.vue +++ b/packages/@vue/cli-ui/src/views/ProjectTaskDetails.vue @@ -106,7 +106,7 @@