Skip to content

Commit

Permalink
chore: update deps & install and test typescript versions >=3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
plainheart committed Mar 9, 2024
1 parent 2e010c7 commit 7d25313
Show file tree
Hide file tree
Showing 3 changed files with 1,109 additions and 837 deletions.
27 changes: 14 additions & 13 deletions build/testDts.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,20 +19,18 @@
*/

const { TypeScriptVersion } = require('@definitelytyped/typescript-versions');
const {
cleanTypeScriptInstalls,
installAllTypeScriptVersions,
typeScriptPath
} = require('@definitelytyped/utils');
const { typeScriptPath, install } = require('@definitelytyped/utils');
const { runTsCompile } = require('./pre-publish');
const globby = require('globby');
const semver = require('semver');

const MIN_VERSION = '3.5.0';

async function installTs() {
// await cleanTypeScriptInstalls();
await installAllTypeScriptVersions();
const tsVersions = getTypeScriptVersions();
for (const version of tsVersions) {
await install(version);
}
}

async function runTests() {
Expand All @@ -52,11 +50,8 @@ async function runTests() {
};
const testsList = await globby(__dirname + '/../test/types/*.ts');

for (let version of TypeScriptVersion.shipped) {
if (semver.lt(version + '.0', MIN_VERSION)) {
continue;
}

const tsVersions = getTypeScriptVersions();
for (const version of tsVersions) {
console.log(`Testing ts version ${version}`);
const ts = require(typeScriptPath(version));
await runTsCompile(ts, compilerOptions, testsList);
Expand All @@ -65,11 +60,17 @@ async function runTests() {
}
}

function getTypeScriptVersions() {
return TypeScriptVersion.unsupported
.concat(TypeScriptVersion.shipped)
.filter(version => semver.gte(version + '.0', MIN_VERSION));
}

async function main() {
await installTs();
await runTests();
}

module.exports = main;

main();
main();
Loading

0 comments on commit 7d25313

Please sign in to comment.