Skip to content

Commit af0a3cf

Browse files
committed
test: add tests for ESLint + Vue 3
1 parent 55b87ac commit af0a3cf

File tree

1 file changed

+53
-0
lines changed

1 file changed

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

0 commit comments

Comments
 (0)