@@ -5,6 +5,7 @@ import deepmerge from 'deepmerge'
5
5
import packageName from 'depcheck-package-name'
6
6
import { Linter } from 'eslint'
7
7
import fs from 'fs-extra'
8
+ import inFolder from 'in-folder'
8
9
import outputFiles from 'output-files'
9
10
import P from 'path'
10
11
@@ -161,30 +162,6 @@ export default tester(
161
162
output : "import foo from '@/foo'" ,
162
163
} )
163
164
} ,
164
- 'cwd: packagejson' : async ( ) => {
165
- await outputFiles ( {
166
- sub : {
167
- '.babelrc.json' : JSON . stringify ( {
168
- plugins : [
169
- [
170
- packageName `babel-plugin-module-resolver` ,
171
- { alias : { '@' : '.' } , cwd : 'packagejson' } ,
172
- ] ,
173
- ] ,
174
- } ) ,
175
- 'foo.js' : '' ,
176
- 'package.json' : JSON . stringify ( { } ) ,
177
- } ,
178
- } )
179
- expect (
180
- lint ( "import foo from '../foo'" , {
181
- filename : P . join ( 'sub' , 'sub' , 'index.js' ) ,
182
- } ) ,
183
- ) . toEqual ( {
184
- messages : [ "Unexpected parent import '../foo'. Use '@/foo' instead" ] ,
185
- output : "import foo from '@/foo'" ,
186
- } )
187
- } ,
188
165
'cwd: subfolder' : async ( ) => {
189
166
await outputFiles ( {
190
167
'.babelrc.json' : JSON . stringify ( {
@@ -220,6 +197,20 @@ export default tester(
220
197
)
221
198
expect ( lint ( "import foo from 'foo'" ) . messages ) . toEqual ( [ ] )
222
199
} ,
200
+ 'file in parent folder' : async ( ) => {
201
+ await outputFiles ( {
202
+ 'babel.config.json' : JSON . stringify ( {
203
+ plugins : [
204
+ [
205
+ packageName `babel-plugin-module-resolver` ,
206
+ { alias : { '@' : '.' } } ,
207
+ ] ,
208
+ ] ,
209
+ } ) ,
210
+ 'sub/package.json' : JSON . stringify ( { } ) ,
211
+ } )
212
+ await inFolder ( 'sub' , ( ) => expect ( lint ( '' ) . messages ) . toEqual ( [ ] ) )
213
+ } ,
223
214
'no aliases' : async ( ) => {
224
215
await outputFiles ( {
225
216
'foo.js' : '' ,
0 commit comments