Skip to content
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
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