File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed
tests/specs/parse-tsconfig/extends/resolves Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change @@ -144,7 +144,7 @@ export const resolveExtendsPath = (
144
144
}
145
145
146
146
const packagePath = findUp (
147
- directoryPath ,
147
+ path . resolve ( directoryPath ) ,
148
148
path . join ( 'node_modules' , packageName ) ,
149
149
cache ,
150
150
) ;
Original file line number Diff line number Diff line change @@ -348,6 +348,44 @@ export default testSuite(({ describe }) => {
348
348
expect ( tsconfig ) . toStrictEqual ( expectedTsconfig ) ;
349
349
} ) ;
350
350
351
+ // https://github.com/privatenumber/get-tsconfig/issues/76
352
+ test ( 'resolves config in parent node_modules' , async ( ) => {
353
+ await using fixture = await createFixture ( {
354
+ library : {
355
+ src : {
356
+ 'a.ts' : '' ,
357
+ 'b.ts' : '' ,
358
+ 'c.ts' : '' ,
359
+ } ,
360
+ 'tsconfig.json' : createTsconfigJson ( {
361
+ extends : '@monorepo/tsconfig/tsconfig.base.json' ,
362
+ include : [ 'src' ] ,
363
+ } ) ,
364
+ } ,
365
+
366
+ 'node_modules/@monorepo/tsconfig' : {
367
+ 'tsconfig.base.json' : createTsconfigJson ( {
368
+ compilerOptions : {
369
+ module : 'commonjs' ,
370
+ } ,
371
+ } ) ,
372
+ } ,
373
+ } ) ;
374
+
375
+ const originalCwd = process . cwd ( ) ;
376
+ try {
377
+ process . chdir ( fixture . getPath ( 'library' ) ) ;
378
+ const expectedTsconfig = await getTscTsconfig ( '.' ) ;
379
+ delete expectedTsconfig . files ;
380
+
381
+ const tsconfig = parseTsconfig ( './tsconfig.json' ) ;
382
+
383
+ expect ( tsconfig ) . toStrictEqual ( expectedTsconfig ) ;
384
+ } finally {
385
+ process . chdir ( originalCwd ) ;
386
+ }
387
+ } ) ;
388
+
351
389
describe ( 'package.json#tsconfig' , ( { test } ) => {
352
390
test ( 'package.json#tsconfig' , async ( ) => {
353
391
await using fixture = await createFixture ( {
You can’t perform that action at this time.
0 commit comments