Skip to content

Commit

Permalink
added test demonstrating include path normalization (for #73)
Browse files Browse the repository at this point in the history
  • Loading branch information
inga-lovinde committed May 5, 2024
1 parent 3b01d6a commit 046e070
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions tests/specs/parse-tsconfig/extends/merges.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,34 @@ export default testSuite(({ describe }) => {
expect(tsconfig).toStrictEqual(expectedTsconfig);
});

test('inherits with relative path from subdirectory', async () => {
await using fixture = await createFixture({
configs: {
'tsconfig.base.json': createTsconfigJson({
include: ['../src-a/*'],
}),
},
'src-a': {
'a.ts': '',
'b.ts': '',
'c.ts': '',
},
'tsconfig.json': createTsconfigJson({
extends: './configs/tsconfig.base.json',
}),
});

const expectedTsconfig = await getTscTsconfig(fixture.path);
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(path.join(fixture.path, 'tsconfig.json'));

expect({
...tsconfig,
include: tsconfig.include?.map(includePath => `configs/../${includePath}`),
}).toStrictEqual(expectedTsconfig);
});

test('gets overwritten', async () => {
await using fixture = await createFixture({
'src-a': {
Expand Down

0 comments on commit 046e070

Please sign in to comment.