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

chore: upgrade to TypeScript v5.5 #83

Merged
merged 4 commits into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"slash": "^5.1.0",
"tsx": "^4.15.7",
"type-fest": "^4.20.1",
"typescript": "~5.2.0"
"typescript": "~5.5.4"
},
"packageManager": "[email protected]+sha512.98a80fd11c2e7096747762304106432b3ddc67dcf54b5a8c01c93f68a2cd5e05e6821849522a06fb76284d41a2660d5e334f2ee3bbf29183bf2e739b1dafa771"
}
122 changes: 61 additions & 61 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions tests/specs/parse-tsconfig/extends/merges.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ export default testSuite(({ describe }) => {

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));

expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

describe('files', ({ test }) => {
Expand Down Expand Up @@ -423,7 +424,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

test('watchOptions', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

test('no extension', async () => {
Expand All @@ -44,7 +45,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

test('arbitrary extension', async () => {
Expand All @@ -65,7 +67,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});
});
});
46 changes: 31 additions & 15 deletions tests/specs/parse-tsconfig/extends/resolves/node-modules.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

test('without package.json', async () => {
Expand All @@ -80,7 +81,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

test('ignores invalid package.json', async () => {
Expand Down Expand Up @@ -160,7 +162,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

test('empty object package.json', async () => {
Expand Down Expand Up @@ -188,7 +191,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});
});

Expand All @@ -211,7 +215,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

test('implicit .json extension', async () => {
Expand All @@ -232,7 +237,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

test('prefers implicit .json over directory', async () => {
Expand Down Expand Up @@ -321,7 +327,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

test('extends dependency package far', async () => {
Expand All @@ -345,7 +352,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(path.join(fixturePath, 'tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

// https://github.com/privatenumber/get-tsconfig/issues/76
Expand Down Expand Up @@ -417,7 +425,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

test('reads nested package.json#tsconfig', async () => {
Expand Down Expand Up @@ -454,7 +463,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});
});

Expand Down Expand Up @@ -507,7 +517,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

test('subpath', async () => {
Expand Down Expand Up @@ -540,7 +551,9 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);

// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

describe('conditions', ({ test }) => {
Expand Down Expand Up @@ -576,7 +589,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

test('types', async () => {
Expand Down Expand Up @@ -611,7 +625,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

test('missing condition should fail', async () => {
Expand Down Expand Up @@ -796,7 +811,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

test('prefers exact match (extensionless file)', async () => {
Expand Down Expand Up @@ -57,7 +58,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

test('arbitrary extension', async () => {
Expand All @@ -81,7 +83,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(fixture.getPath('tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

test('parent directory', async () => {
Expand All @@ -108,7 +111,8 @@ export default testSuite(({ describe }) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(path.join(testDirectory, 'tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
});

test('shoud not resolve directory', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const validate = async (directoryPath: string) => {
delete expectedTsconfig.files;

const tsconfig = parseTsconfig(path.join(directoryPath, 'tsconfig.json'));
expect(tsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(tsconfig);
};

export default testSuite(({ describe }) => {
Expand Down
19 changes: 16 additions & 3 deletions tests/specs/parse-tsconfig/parses.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,13 @@ export default testSuite(({ describe }) => {
const expectedTsconfig = await getTscTsconfig(fixture.path);
delete expectedTsconfig.files;

expect(parsedTsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 resolve excludes paths
if (expectedTsconfig.exclude) {
expectedTsconfig.exclude = expectedTsconfig.exclude.map(excludePath => excludePath.split('/').pop()!);
}

// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(parsedTsconfig);
});

describe('baseUrl', ({ test }) => {
Expand Down Expand Up @@ -150,12 +156,19 @@ export default testSuite(({ describe }) => {
const expectedTsconfig = await getTscTsconfig(fixture.path);
delete expectedTsconfig.files;

expect(parsedTsconfig).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 resolve excludes paths
if (expectedTsconfig.exclude) {
expectedTsconfig.exclude = expectedTsconfig.exclude.map(excludePath => excludePath.split('/').pop()!);
}

// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(parsedTsconfig);

const parsedTsconfigCached = parseTsconfig(fixture.getPath('tsconfig.json'), cache);
expect(cache.size).toBe(1);

expect(parsedTsconfigCached).toStrictEqual(expectedTsconfig);
// TODO: TS 5.5 --showConfig returns extra default fields
expect(expectedTsconfig).toMatchObject(parsedTsconfigCached);
});
});
});
Loading