Skip to content

Commit 0468022

Browse files
committed
test: fix eslint related tests
1 parent c2e3228 commit 0468022

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

packages/@vue/cli-plugin-eslint/__tests__/eslintGenerator.spec.js

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ test('base', async () => {
99

1010
expect(pkg.scripts.lint).toBeTruthy()
1111
expect(pkg.eslintConfig).toEqual({
12+
root: true,
1213
extends: ['plugin:vue/essential', 'eslint:recommended']
1314
})
1415
})
@@ -24,6 +25,7 @@ test('airbnb', async () => {
2425

2526
expect(pkg.scripts.lint).toBeTruthy()
2627
expect(pkg.eslintConfig).toEqual({
28+
root: true,
2729
extends: ['plugin:vue/essential', '@vue/airbnb']
2830
})
2931
expect(pkg.devDependencies).toHaveProperty('@vue/eslint-config-airbnb')
@@ -40,6 +42,7 @@ test('standard', async () => {
4042

4143
expect(pkg.scripts.lint).toBeTruthy()
4244
expect(pkg.eslintConfig).toEqual({
45+
root: true,
4346
extends: ['plugin:vue/essential', '@vue/standard']
4447
})
4548
expect(pkg.devDependencies).toHaveProperty('@vue/eslint-config-standard')
@@ -56,6 +59,7 @@ test('prettier', async () => {
5659

5760
expect(pkg.scripts.lint).toBeTruthy()
5861
expect(pkg.eslintConfig).toEqual({
62+
root: true,
5963
extends: ['plugin:vue/essential', '@vue/prettier']
6064
})
6165
expect(pkg.devDependencies).toHaveProperty('@vue/eslint-config-prettier')
@@ -79,6 +83,7 @@ test('typescript', async () => {
7983

8084
expect(pkg.scripts.lint).toBeTruthy()
8185
expect(pkg.eslintConfig).toEqual({
86+
root: true,
8287
extends: ['plugin:vue/essential', '@vue/prettier', '@vue/typescript']
8388
})
8489
expect(pkg.devDependencies).toHaveProperty('@vue/eslint-config-prettier')

packages/@vue/cli/__tests__/invoke.spec.js

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ async function assertUpdates (project) {
2828

2929
const eslintrc = JSON.parse(await project.read('.eslintrc'))
3030
expect(eslintrc).toEqual({
31+
root: true,
3132
extends: ['plugin:vue/essential', '@vue/airbnb']
3233
})
3334

@@ -79,6 +80,7 @@ test('invoke with existing files', async () => {
7980

8081
const eslintrc = JSON.parse(await project.read('.eslintrc'))
8182
expect(eslintrc).toEqual({
83+
root: true,
8284
extends: ['plugin:vue/essential', 'eslint:recommended']
8385
})
8486

@@ -104,11 +106,13 @@ test('invoke with existing files (yaml)', async () => {
104106

105107
const eslintrc = JSON.parse(await project.read('.eslintrc'))
106108
expect(eslintrc).toEqual({
109+
root: true,
107110
extends: ['plugin:vue/essential', 'eslint:recommended']
108111
})
109112

110113
await project.rm(`.eslintrc`)
111114
await project.write(`.eslintrc.yml`, `
115+
root: true
112116
extends:
113117
- 'plugin:vue/essential'
114118
- 'eslint:recommended'
@@ -118,6 +122,7 @@ extends:
118122

119123
const updated = await project.read('.eslintrc.yml')
120124
expect(updated).toMatch(`
125+
root: true
121126
extends:
122127
- 'plugin:vue/essential'
123128
- '@vue/airbnb'

0 commit comments

Comments
 (0)