-
-
Notifications
You must be signed in to change notification settings - Fork 6.3k
/
Copy patheslintVue3.spec.js
53 lines (46 loc) · 1.18 KB
/
eslintVue3.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
jest.setTimeout(300000)
const generateWithPlugin = require('@vue/cli-test-utils/generateWithPlugin')
const createOutside = require('@vue/cli-test-utils/createUpgradableProject')
test('Vue 3 base', async () => {
const { pkg } = await generateWithPlugin([
{
id: '@vue/cli-service',
apply: require('@vue/cli-service/generator'),
options: {
vueVersion: '3'
}
},
{
id: '@vue/cli-plugineslint',
apply: require('../generator'),
options: {}
}
])
expect(pkg.scripts.lint).toBeTruthy()
expect(pkg.eslintConfig.extends).toEqual([
'plugin:vue/vue3-essential', 'eslint:recommended'
])
})
test('Should allow fragments in Vue 3 projects', async () => {
const { write, run } = await createOutside('eslint-vue3-fragment', {
vueVersion: '3',
plugins: {
'@vue/cli-plugin-eslint': {}
}
})
await write('src/App.vue', `<template>
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
</template>
<script>
import HelloWorld from './components/HelloWorld.vue'
export default {
name: 'App',
components: {
HelloWorld
}
}
</script>
`)
await run('vue-cli-service lint')
})