Skip to content

Commit

Permalink
Fetch list of TypeScript versions dynamically
Browse files Browse the repository at this point in the history
  • Loading branch information
fasttime committed Sep 27, 2024
1 parent fd05b91 commit 39a9be9
Showing 1 changed file with 17 additions and 10 deletions.
27 changes: 17 additions & 10 deletions test/spec/ts-defs.spec.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,22 @@ describe
'TypeScript definitions',
() =>
{
describe('TypeScript 4.7', () => defineTests('typescript_4.7'));
describe('TypeScript 4.8', () => defineTests('typescript_4.8'));
describe('TypeScript 4.9', () => defineTests('typescript_4.9'));
describe('TypeScript 5.0', () => defineTests('typescript_5.0'));
describe('TypeScript 5.1', () => defineTests('typescript_5.1'));
describe('TypeScript 5.2', () => defineTests('typescript_5.2'));
describe('TypeScript 5.3', () => defineTests('typescript_5.3'));
describe('TypeScript 5.4', () => defineTests('typescript_5.4'));
describe('TypeScript 5.5', () => defineTests('typescript_5.5'));
describe('TypeScript 5.6', () => defineTests('typescript_5.6'));
const typescriptPkgNames =
(() =>
{
const require = createRequire(import.meta.url);
const { devDependencies } = require('../../package.json');
const typescriptPkgNames =
Object
.keys(devDependencies)
.filter(devDependency => /^typescript_\d+\.\d+$/.test(devDependency));
return typescriptPkgNames;
}
)();
for (const typescriptPkgName of typescriptPkgNames)
{
const title = typescriptPkgName.replace(/^typescript_/, 'TypeScript ');
describe(title, () => defineTests(typescriptPkgName));
}
},
);

0 comments on commit 39a9be9

Please sign in to comment.