feat: 增加单元测试功能

This commit is contained in:
chenj
2022-12-06 17:01:46 +08:00
parent 1154ec3099
commit 0ffe414725
7 changed files with 105 additions and 51 deletions

28
src/Test.vue Normal file
View File

@@ -0,0 +1,28 @@
<template>
<span data-test="count">{{count}}</span>
<button data-test="button" @click="click">click</button>
</template>
<script>
/* vue-jest的测试示例 */
import VueRouter from 'vue-router'
export default {
name: 'Test',
data () {
return {
count: 0
}
},
methods: {
click () {
this.count++
}
},
created () {
const { currentRoute } = VueRouter.useRouter()
return {
currentRoute
}
}
}
</script>