feat(ui): jest task

This commit is contained in:
Guillaume Chau
2018-06-11 20:43:53 +02:00
parent bc59637308
commit 692d4638d8
4 changed files with 47 additions and 1 deletions

View File

@@ -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')
}
})
}

View File

@@ -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"
}
}
}
}

View File

@@ -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

View File

@@ -106,7 +106,7 @@
<VueModal
v-if="showParameters"
:title="$t('views.project-task-details.parameters')"
class="medium"
class="medium anchor"
@close="showParameters = false"
>
<div class="default-body">