@@ -5,12 +5,12 @@ const { mkdir, writeJson } = fs;
55const TMP_DIR = './tmp/' ;
66const ALL_TESTS = process . env . ALL_TYPE_DEFINITIONS_TESTS === '1' ;
77
8- const targets = [
8+ const TARGETS = [
99 'esnext' ,
1010 'es2022' ,
1111 'es6' ,
1212] ;
13- const typeScriptVersions = [
13+ const TYPE_SCRIPT_VERSIONS = [
1414 '5.9' ,
1515 '5.8' ,
1616 '5.7' ,
@@ -20,7 +20,7 @@ const typeScriptVersions = [
2020 // '5.3',
2121 // '5.2',
2222] ;
23- const envs = [
23+ const ENVS = [
2424 null ,
2525 '@types/node@24' ,
2626 '@types/node@20' ,
@@ -29,14 +29,17 @@ const envs = [
2929 // '@types/node@15', // fails
3030 // '@types/bun@latest', // conflicts with DOM types (TextDecorator, SharedArrayBuffer...)
3131] ;
32- const types = [
32+ const TYPES = [
3333 'global' ,
3434 'pure' ,
3535] ;
36- const libs = [
36+ const LIBS = [
3737 'dom' ,
3838 // null, // fails on web types
3939] ;
40+ const TARGET_EXCLUDES = {
41+ 'es6' : [ '**/*es2018*test.ts' ] ,
42+ }
4043
4144let tested = 0 ;
4245let failed = 0 ;
@@ -49,20 +52,21 @@ function getEnvPath(env) {
4952async function runTestsOnEnv ( { typeScriptVersion, target, type, env, lib } ) {
5053 $ . verbose = false ;
5154 const envLibName = env ? env . substring ( 0 , env . lastIndexOf ( '@' ) ) : '' ;
55+ const tsConfigPostfix = TARGET_EXCLUDES [ target ] ? `.${ target } ` : '' ;
5256 const command = `npx -p typescript@${ typeScriptVersion } ${
53- env ? ` -p ${ env } ` : '' } tsc -p ${ type } /tsconfig.json --target ${ target } --lib ${ target } ${ lib ? `,${ lib } ` : '' } ${
57+ env ? ` -p ${ env } ` : '' } tsc -p ${ type } /tsconfig${ tsConfigPostfix } .json --target ${ target } --lib ${ target } ${ lib ? `,${ lib } ` : '' } ${
5458 env ? ` --types @core-js/types${ type === 'pure' ? '/pure' : '' } ,${ envLibName } ` : '' } `;
5559 echo ( `$ ${ command } ` ) ;
5660 try {
5761 tested ++ ;
5862 if ( env && lib ) {
59- await $ ( { cwd : getEnvPath ( env ) } ) `npx -p typescript@${ typeScriptVersion } tsc -p ./tsconfig.${ type } .json --target ${ target } --lib ${ target } ,${ lib } --types @core-js/types${ type === 'pure' ? '/pure' : '' } ,${ envLibName } ` . quiet ( ) ;
63+ await $ ( { cwd : getEnvPath ( env ) } ) `npx -p typescript@${ typeScriptVersion } tsc -p ./tsconfig.${ type } ${ tsConfigPostfix } .json --target ${ target } --lib ${ target } ,${ lib } --types @core-js/types${ type === 'pure' ? '/pure' : '' } ,${ envLibName } ` . quiet ( ) ;
6064 } else if ( env ) {
61- await $ ( { cwd : getEnvPath ( env ) } ) `npx -p typescript@${ typeScriptVersion } tsc -p ./tsconfig.${ type } .json --target ${ target } --lib ${ target } --types @core-js/types${ type === 'pure' ? '/pure' : '' } ,${ envLibName } ` . quiet ( ) ;
65+ await $ ( { cwd : getEnvPath ( env ) } ) `npx -p typescript@${ typeScriptVersion } tsc -p ./tsconfig.${ type } ${ tsConfigPostfix } .json --target ${ target } --lib ${ target } --types @core-js/types${ type === 'pure' ? '/pure' : '' } ,${ envLibName } ` . quiet ( ) ;
6266 } else if ( lib ) {
63- await $ `npx -p typescript@${ typeScriptVersion } tsc -p ${ type } /tsconfig.json --target ${ target } --lib ${ target } ,${ lib } ` . quiet ( ) ;
67+ await $ `npx -p typescript@${ typeScriptVersion } tsc -p ${ type } /tsconfig${ tsConfigPostfix } .json --target ${ target } --lib ${ target } ,${ lib } ` . quiet ( ) ;
6468 } else {
65- await $ `npx -p typescript@${ typeScriptVersion } tsc -p ${ type } /tsconfig.json --target ${ target } --lib ${ target } ` . quiet ( ) ;
69+ await $ `npx -p typescript@${ typeScriptVersion } tsc -p ${ type } /tsconfig${ tsConfigPostfix } .json --target ${ target } --lib ${ target } ` . quiet ( ) ;
6670 }
6771 echo ( chalk . green ( `$ ${ command } ` ) ) ;
6872 } catch ( error ) {
@@ -83,11 +87,11 @@ async function runLimited(configs, limit) {
8387}
8488
8589const taskConfigs = [ ] ;
86- for ( const type of types ) {
87- for ( const target of targets ) {
88- for ( const typeScriptVersion of typeScriptVersions ) {
89- for ( const env of envs ) {
90- for ( const lib of libs ) {
90+ for ( const type of TYPES ) {
91+ for ( const target of TARGETS ) {
92+ for ( const typeScriptVersion of TYPE_SCRIPT_VERSIONS ) {
93+ for ( const env of ENVS ) {
94+ for ( const lib of LIBS ) {
9195 taskConfigs . push ( { env, lib, target, type, typeScriptVersion } ) ;
9296 }
9397 }
@@ -99,7 +103,7 @@ async function clearTmpDir() {
99103 await $ `rm -rf ${ TMP_DIR } ` ;
100104}
101105
102- async function prepareEnvironment ( environments , coreJsTypes ) {
106+ async function prepareEnvironment ( environments , coreJsTypes , targetExcludes ) {
103107 await clearTmpDir ( ) ;
104108 for ( const env of environments ) {
105109 if ( ! env ) continue ;
@@ -111,8 +115,14 @@ async function prepareEnvironment(environments, coreJsTypes) {
111115 await writeJson ( path . join ( tmpEnvDir , `tsconfig.${ type } .json` ) , {
112116 extends : '../../tsconfig.json' ,
113117 include : [ `../../${ type } /**/*.ts` ] ,
114- exclude : [ `../../${ type } /async-iteration.test.ts` ] ,
115118 } ) ;
119+ for ( const [ target , patterns ] of Object . entries ( targetExcludes ) ) {
120+ await writeJson ( path . join ( tmpEnvDir , `tsconfig.${ type } .${ target } .json` ) , {
121+ extends : '../../tsconfig.json' ,
122+ include : [ `../../${ type } /**/*.ts` ] ,
123+ exclude : patterns . map ( pattern => `../../${ pattern } ` ) ,
124+ } ) ;
125+ }
116126 }
117127 }
118128}
@@ -123,26 +133,21 @@ await $`npx -p typescript@5.9 tsc -p tsconfig.entries.json`;
123133await $ `npx -p typescript@5.9 tsc -p tsconfig.entries.pure.json` ;
124134await $ `npx -p typescript@5.9 -p @types/node@24 tsc -p tsconfig.templates.require.json` ;
125135
126- await $ `npx -p typescript@5.6 tsc -p pure/tsconfig.async-iteration.json --target es2023 --lib es2023` ;
127- await $ `npx -p typescript@5.6 tsc -p pure/tsconfig.async-iteration.json --target esnext --lib esnext` ;
128- await $ `npx -p typescript@5.9 tsc -p pure/tsconfig.async-iteration.json --target es2023 --lib es2023` ;
129- await $ `npx -p typescript@5.9 tsc -p pure/tsconfig.async-iteration.json --target esnext --lib esnext` ;
130-
131136if ( ! ALL_TESTS ) {
132- await $ `npx -p typescript@5.6 tsc -p pure/tsconfig.json --target es6 --lib es6` ;
137+ await $ `npx -p typescript@5.6 tsc -p pure/tsconfig.es6. json --target es6 --lib es6` ;
133138 await $ `npx -p typescript@5.6 tsc -p pure/tsconfig.json --target esnext --lib esnext` ;
134- await $ `npx -p typescript@5.6 tsc -p global/tsconfig.json --target es6 --lib es6,dom` ;
139+ await $ `npx -p typescript@5.6 tsc -p global/tsconfig.es6. json --target es6 --lib es6,dom` ;
135140 await $ `npx -p typescript@5.6 tsc -p global/tsconfig.json --target esnext --lib esnext,dom` ;
136141
137- await $ `npx -p typescript@5.9 tsc -p pure/tsconfig.json --target es6 --lib es6` ;
142+ await $ `npx -p typescript@5.9 tsc -p pure/tsconfig.es6. json --target es6 --lib es6` ;
138143 await $ `npx -p typescript@5.9 tsc -p pure/tsconfig.json --target es2023 --lib es2023` ;
139144 await $ `npx -p typescript@5.9 tsc -p pure/tsconfig.json --target esnext --lib esnext` ;
140- await $ `npx -p typescript@5.9 tsc -p global/tsconfig.json --target es6 --lib es6,dom` ;
145+ await $ `npx -p typescript@5.9 tsc -p global/tsconfig.es6. json --target es6 --lib es6,dom` ;
141146 await $ `npx -p typescript@5.9 tsc -p global/tsconfig.json --target es2023 --lib es2023,dom` ;
142147 await $ `npx -p typescript@5.9 tsc -p global/tsconfig.json --target esnext --lib esnext,dom` ;
143148} else {
144149 const numCPUs = os . cpus ( ) . length ;
145- await prepareEnvironment ( envs , types ) ;
150+ await prepareEnvironment ( ENVS , TYPES , TARGET_EXCLUDES ) ;
146151 await runLimited ( taskConfigs , Math . max ( numCPUs - 1 , 1 ) ) ;
147152 await clearTmpDir ( ) ;
148153 echo ( `Tested: ${ chalk . green ( tested ) } , Failed: ${ chalk . red ( failed ) } ` ) ;
0 commit comments