@@ -23,11 +23,11 @@ describe('EsLint', () => {
23
23
} ) ;
24
24
25
25
it . each ( [
26
- { async : false , webpack : '4.0.0' } ,
27
- { async : true , webpack : '^4.0.0' } ,
28
- { async : false , webpack : '^5.0.0-beta.16' } ,
29
- { async : true , webpack : '^5.0.0-beta.16' } ,
30
- ] ) ( 'reports lint error for %p' , async ( { async, webpack } ) => {
26
+ { async : false , webpack : '4.0.0' , absolute : false } ,
27
+ { async : true , webpack : '^4.0.0' , absolute : true } ,
28
+ { async : false , webpack : '^5.0.0-beta.16' , absolute : true } ,
29
+ { async : true , webpack : '^5.0.0-beta.16' , absolute : false } ,
30
+ ] ) ( 'reports lint error for %p' , async ( { async, webpack, absolute } ) => {
31
31
await sandbox . load ( [
32
32
await readFixture ( join ( __dirname , 'fixtures/environment/eslint-basic.fixture' ) , {
33
33
FORK_TS_CHECKER_WEBPACK_PLUGIN_VERSION : JSON . stringify (
@@ -43,6 +43,15 @@ describe('EsLint', () => {
43
43
await readFixture ( join ( __dirname , 'fixtures/implementation/typescript-basic.fixture' ) ) ,
44
44
] ) ;
45
45
46
+ if ( absolute ) {
47
+ // test case for providing absolute path to files
48
+ await sandbox . patch (
49
+ 'webpack.config.js' ,
50
+ "files: './src/**/*.ts'" ,
51
+ "files: path.resolve(__dirname, './src/**/*.ts')"
52
+ ) ;
53
+ }
54
+
46
55
const driver = createWebpackDevServerDriver ( sandbox . spawn ( 'npm run webpack-dev-server' ) , async ) ;
47
56
let errors : string [ ] ;
48
57
@@ -92,34 +101,34 @@ describe('EsLint', () => {
92
101
93
102
// add a new error
94
103
await sandbox . patch (
95
- 'src/index .ts' ,
96
- "let password = '';" ,
97
- "let password = ''\nlet temporary: any;"
104
+ 'src/model/User .ts' ,
105
+ [ ' lastName?: string;' , '}' ] . join ( '\n' ) ,
106
+ [ ' lastName?: string;' , '}' , '' , 'let temporary: any;' , '' ] . join ( '\n' )
98
107
) ;
99
108
100
109
errors = await driver . waitForErrors ( ) ;
101
110
expect ( errors ) . toEqual ( [
102
111
[
103
- 'WARNING in src/index .ts 20 :5-19' ,
112
+ 'WARNING in src/model/User .ts 11 :5-19' ,
104
113
"@typescript-eslint/no-unused-vars: 'temporary' is defined but never used." ,
105
- " 18 | let email = '';" ,
106
- " 19 | let password = ''" ,
107
- ' > 20 | let temporary: any;' ,
114
+ ' 9 | }' ,
115
+ ' 10 | ' ,
116
+ ' > 11 | let temporary: any;' ,
108
117
' | ^^^^^^^^^^^^^^' ,
109
- ' 21 | ' ,
110
- " 22 | emailInput.addEventListener('change', event => {" ,
111
- ' 23 | if (event.target instanceof HTMLInputElement) {' ,
118
+ ' 12 | ' ,
119
+ ' 13 | ' ,
120
+ ' 14 | function getUserName(user: User): string {' ,
112
121
] . join ( '\n' ) ,
113
122
[
114
- 'WARNING in src/index .ts 20 :16-19' ,
123
+ 'WARNING in src/model/User .ts 11 :16-19' ,
115
124
'@typescript-eslint/no-explicit-any: Unexpected any. Specify a different type.' ,
116
- " 18 | let email = '';" ,
117
- " 19 | let password = ''" ,
118
- ' > 20 | let temporary: any;' ,
125
+ ' 9 | }' ,
126
+ ' 10 | ' ,
127
+ ' > 11 | let temporary: any;' ,
119
128
' | ^^^' ,
120
- ' 21 | ' ,
121
- " 22 | emailInput.addEventListener('change', event => {" ,
122
- ' 23 | if (event.target instanceof HTMLInputElement) {' ,
129
+ ' 12 | ' ,
130
+ ' 13 | ' ,
131
+ ' 14 | function getUserName(user: User): string {' ,
123
132
] . join ( '\n' ) ,
124
133
] ) ;
125
134
} ) ;
0 commit comments