Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: demonstrate quirks in include path normalization #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 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,35 @@ 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,
// See https://github.com/privatenumber/get-tsconfig/issues/73
include: tsconfig.include?.map(includePath => `configs/../${includePath}`),
}).toStrictEqual(expectedTsconfig);
});

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