1
1
import { join } from 'path' ;
2
+ import process from 'process' ;
2
3
import { readFixture } from './sandbox/Fixture' ;
3
4
import { Sandbox , createSandbox } from './sandbox/Sandbox' ;
4
5
import {
8
9
} from './sandbox/WebpackDevServerDriver' ;
9
10
import { FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION } from './sandbox/Plugin' ;
10
11
12
+ const ignored = process . version . startsWith ( 'v10' ) ;
13
+
11
14
describe ( 'EsLint' , ( ) => {
12
15
let sandbox : Sandbox ;
13
16
@@ -24,17 +27,28 @@ describe('EsLint', () => {
24
27
} ) ;
25
28
26
29
it . each ( [
27
- { async : false , webpack : '4.0.0' , absolute : false } ,
28
- { async : true , webpack : '^4.0.0' , absolute : true } ,
29
- { async : false , webpack : '^5.0.0' , absolute : true } ,
30
- { async : true , webpack : '^5.0.0' , absolute : false } ,
31
- ] ) ( 'reports lint error for %p' , async ( { async, webpack, absolute } ) => {
30
+ { async : false , webpack : '4.0.0' , eslint : '^6.0.0' , absolute : false , ignored } ,
31
+ { async : true , webpack : '^4.0.0' , eslint : '^7.0.0' , absolute : true , ignored } ,
32
+ { async : false , webpack : '^5.0.0' , eslint : '^7.0.0' , absolute : true , ignored } ,
33
+ {
34
+ async : true ,
35
+ webpack : '^5.0.0' ,
36
+ eslint : '^8.0.0' ,
37
+ absolute : false ,
38
+ ignored,
39
+ } ,
40
+ ] ) ( 'reports lint error for %p' , async ( { async, webpack, eslint, absolute, ignored } ) => {
41
+ if ( ignored ) {
42
+ console . warn ( 'Ignoring test - incompatible node version' ) ;
43
+ return ;
44
+ }
32
45
await sandbox . load ( [
33
46
await readFixture ( join ( __dirname , 'fixtures/environment/eslint-basic.fixture' ) , {
34
47
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION : JSON . stringify (
35
48
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION
36
49
) ,
37
50
TS_LOADER_VERSION : JSON . stringify ( '^5.0.0' ) ,
51
+ ESLINT_VERSION : JSON . stringify ( eslint ) ,
38
52
TYPESCRIPT_VERSION : JSON . stringify ( '~3.8.0' ) ,
39
53
WEBPACK_VERSION : JSON . stringify ( webpack ) ,
40
54
WEBPACK_CLI_VERSION : JSON . stringify ( WEBPACK_CLI_VERSION ) ,
@@ -61,7 +75,7 @@ describe('EsLint', () => {
61
75
'WARNING in src/authenticate.ts:14:34' ,
62
76
'@typescript-eslint/no-explicit-any: Unexpected any. Specify a different type.' ,
63
77
' 12 | }' ,
64
- ' 13 | ' ,
78
+ ' 13 |' ,
65
79
' > 14 | async function logout(): Promise<any> {' ,
66
80
' | ^^^' ,
67
81
' 15 | const response = await fetch(' ,
@@ -76,7 +90,7 @@ describe('EsLint', () => {
76
90
" > 31 | loginForm.addEventListener('submit', async event => {" ,
77
91
' | ^^^^^' ,
78
92
' 32 | const user = await login(email, password);' ,
79
- ' 33 | ' ,
93
+ ' 33 |' ,
80
94
" 34 | if (user.role === 'admin') {" ,
81
95
] . join ( '\n' ) ,
82
96
] ) ;
@@ -127,22 +141,22 @@ describe('EsLint', () => {
127
141
'WARNING in src/model/User.ts:11:5' ,
128
142
"@typescript-eslint/no-unused-vars: 'temporary' is defined but never used." ,
129
143
' 9 | }' ,
130
- ' 10 | ' ,
144
+ ' 10 |' ,
131
145
' > 11 | let temporary: any;' ,
132
146
' | ^^^^^^^^^^^^^^' ,
133
- ' 12 | ' ,
134
- ' 13 | ' ,
147
+ ' 12 |' ,
148
+ ' 13 |' ,
135
149
' 14 | function getUserName(user: User): string {' ,
136
150
] . join ( '\n' ) ,
137
151
[
138
152
'WARNING in src/model/User.ts:11:16' ,
139
153
'@typescript-eslint/no-explicit-any: Unexpected any. Specify a different type.' ,
140
154
' 9 | }' ,
141
- ' 10 | ' ,
155
+ ' 10 |' ,
142
156
' > 11 | let temporary: any;' ,
143
157
' | ^^^' ,
144
- ' 12 | ' ,
145
- ' 13 | ' ,
158
+ ' 12 |' ,
159
+ ' 13 |' ,
146
160
' 14 | function getUserName(user: User): string {' ,
147
161
] . join ( '\n' ) ,
148
162
] ) ;
@@ -155,6 +169,7 @@ describe('EsLint', () => {
155
169
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION
156
170
) ,
157
171
TS_LOADER_VERSION : JSON . stringify ( '^5.0.0' ) ,
172
+ ESLINT_VERSION : JSON . stringify ( '~6.8.0' ) ,
158
173
TYPESCRIPT_VERSION : JSON . stringify ( '~3.8.0' ) ,
159
174
WEBPACK_VERSION : JSON . stringify ( '^4.0.0' ) ,
160
175
WEBPACK_CLI_VERSION : JSON . stringify ( WEBPACK_CLI_VERSION ) ,
@@ -210,13 +225,22 @@ describe('EsLint', () => {
210
225
await driver . waitForNoErrors ( ) ;
211
226
} ) ;
212
227
213
- it ( 'fixes errors with `fix: true` option' , async ( ) => {
228
+ it . each ( [
229
+ { eslint : '^6.0.0' , ignored } ,
230
+ { eslint : '^7.0.0' , ignored } ,
231
+ { eslint : '^8.0.0' , ignored } ,
232
+ ] ) ( 'fixes errors with `fix: true` option for %p' , async ( { eslint, ignored } ) => {
233
+ if ( ignored ) {
234
+ console . warn ( 'Ignoring test - incompatible node version' ) ;
235
+ return ;
236
+ }
214
237
await sandbox . load ( [
215
238
await readFixture ( join ( __dirname , 'fixtures/environment/eslint-basic.fixture' ) , {
216
239
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION : JSON . stringify (
217
240
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION
218
241
) ,
219
242
TS_LOADER_VERSION : JSON . stringify ( '^5.0.0' ) ,
243
+ ESLINT_VERSION : JSON . stringify ( eslint ) ,
220
244
TYPESCRIPT_VERSION : JSON . stringify ( '~3.8.0' ) ,
221
245
WEBPACK_VERSION : JSON . stringify ( '^4.0.0' ) ,
222
246
WEBPACK_CLI_VERSION : JSON . stringify ( WEBPACK_CLI_VERSION ) ,
0 commit comments