Skip to content

Commit 046e070

Browse files
committed
added test demonstrating include path normalization (for #73)
1 parent 3b01d6a commit 046e070

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/specs/parse-tsconfig/extends/merges.spec.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,34 @@ export default testSuite(({ describe }) => {
192192
expect(tsconfig).toStrictEqual(expectedTsconfig);
193193
});
194194

195+
test('inherits with relative path from subdirectory', async () => {
196+
await using fixture = await createFixture({
197+
configs: {
198+
'tsconfig.base.json': createTsconfigJson({
199+
include: ['../src-a/*'],
200+
}),
201+
},
202+
'src-a': {
203+
'a.ts': '',
204+
'b.ts': '',
205+
'c.ts': '',
206+
},
207+
'tsconfig.json': createTsconfigJson({
208+
extends: './configs/tsconfig.base.json',
209+
}),
210+
});
211+
212+
const expectedTsconfig = await getTscTsconfig(fixture.path);
213+
delete expectedTsconfig.files;
214+
215+
const tsconfig = parseTsconfig(path.join(fixture.path, 'tsconfig.json'));
216+
217+
expect({
218+
...tsconfig,
219+
include: tsconfig.include?.map(includePath => `configs/../${includePath}`),
220+
}).toStrictEqual(expectedTsconfig);
221+
});
222+
195223
test('gets overwritten', async () => {
196224
await using fixture = await createFixture({
197225
'src-a': {

0 commit comments

Comments
 (0)