-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): respect
extends
when reading tsconfig options (#30062)
Fix a bug introduced in #29774. ## Current Behavior If a local plugin's `tsconfig.json` uses `extends`, the referenced base config is not loaded. ## Expected Behavior If a local plugin's `tsconfig.json` uses `extends`, the referenced base config is loaded. ## Related Issue(s) Fixes #30007 --------- Co-authored-by: Leosvel Pérez Espinosa <[email protected]>
- Loading branch information
Showing
2 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { readTsConfigOptions } from './typescript'; | ||
import { join } from 'path'; | ||
import { TempFs } from '../../../internal-testing-utils/temp-fs'; | ||
|
||
describe('readTsConfigOptions', () => { | ||
let fs: TempFs; | ||
beforeEach(() => { | ||
fs = new TempFs('Workspaces'); | ||
}); | ||
afterEach(() => { | ||
fs.cleanup(); | ||
}); | ||
|
||
it('should handle extending local configs', async () => { | ||
await fs.createFiles({ | ||
'a.json': JSON.stringify({ extends: './b.json' }), | ||
'b.json': JSON.stringify({ compilerOptions: { strict: true } }), | ||
}); | ||
|
||
expect(readTsConfigOptions(join(fs.tempDir, 'a.json'))).toEqual({ | ||
configFilePath: undefined, | ||
strict: true, | ||
}); | ||
}); | ||
|
||
it('should handle extending third-party configs', async () => { | ||
await fs.createFiles({ | ||
'tsconfig.json': JSON.stringify({ | ||
extends: '@fake-third-party/some-package/tsconfig.json', | ||
}), | ||
'node_modules/@fake-third-party/some-package/tsconfig.json': | ||
JSON.stringify({ compilerOptions: { strict: true } }), | ||
}); | ||
|
||
expect(readTsConfigOptions(join(fs.tempDir, 'tsconfig.json'))).toEqual({ | ||
configFilePath: undefined, | ||
strict: true, | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters