@@ -3,7 +3,14 @@ import { fs } from 'zx';
33
44const { mkdir, rm, writeJson } = fs ;
55
6- const ALL_TESTS = process . env . ALL_TYPE_DEFINITIONS_TESTS === '1' ;
6+ const { TYPE_DEFINITIONS_TESTS } = process . env ;
7+
8+ if ( ! [ 'ALL' , 'CI' , 'SMOKE' ] . includes ( TYPE_DEFINITIONS_TESTS ) ) {
9+ throw new Error ( 'Incorrect or lack of TYPE_DEFINITIONS_TESTS' ) ;
10+ }
11+
12+ const ALL_TESTS = TYPE_DEFINITIONS_TESTS === 'ALL' ;
13+ const CI_TESTS = TYPE_DEFINITIONS_TESTS === 'CI' ;
714const NUM_CPUS = cpus ( ) . length ;
815const TMP_DIR = './tmp/' ;
916
@@ -13,23 +20,25 @@ const ES_TARGETS = [
1320 'es6' ,
1421] ;
1522
16- const TYPE_SCRIPT_VERSIONS = ALL_TESTS ? [
23+ const DEFAULT_TYPE_SCRIPT_VERSION = '5.9' ;
24+
25+ const TYPE_SCRIPT_VERSIONS = [ DEFAULT_TYPE_SCRIPT_VERSION , ...ALL_TESTS ? [
1726 '6.0.0-beta' ,
18- '5.9' ,
1927 '5.8' ,
2028 '5.7' ,
2129 '5.6' ,
2230 // '5.5', // fails with node types: Named property 'next' of types 'AsyncIterator<T, TReturn, TNext>' and 'AsyncIteratorObject<T, TReturn, TNext>' are not identical.
2331 // '5.4',
2432 // '5.3',
2533 // '5.2',
26- ] : [
27- '5.9 ' ,
34+ ] : CI_TESTS ? [
35+ '6.0.0-beta ' ,
2836 '5.6' ,
29- ] ;
37+ ] : [
38+ // empty
39+ ] ] ;
3040
3141const ENVIRONMENTS = ALL_TESTS ? [
32- null ,
3342 '@types/node@25' ,
3443 '@types/node@24' ,
3544 '@types/node@22' ,
@@ -39,21 +48,24 @@ const ENVIRONMENTS = ALL_TESTS ? [
3948 // '@types/node@15', // fails
4049 // '@types/bun@latest', // ArrayBuffer.resize signature incorrect. Return type ArrayBuffer instead of void.
4150 // '@types/deno@latest', // fails
51+ ] : CI_TESTS ? [
52+ '@types/node@25' ,
53+ '@types/node@24' ,
54+ '@types/node@22' ,
55+ '@types/node@16' ,
4256] : [
43- null ,
4457 '@types/node@25' ,
4558] ;
4659
60+ const LIBS = [
61+ 'dom' ,
62+ ] ;
63+
4764const CORE_JS_MODES = [
4865 'global' ,
4966 'pure' ,
5067] ;
5168
52- const LIBS = [
53- 'dom' ,
54- null ,
55- ] ;
56-
5769const TARGET_RULES = {
5870 es6 : '**/*es2018*test.ts' ,
5971} ;
@@ -79,7 +91,7 @@ async function runTasksInParallel() {
7991 } ) ) ;
8092}
8193
82- async function runTask ( { cwd, ts, config, args = [ ] } ) {
94+ async function runTask ( { cwd, ts = DEFAULT_TYPE_SCRIPT_VERSION , config, args = [ ] } ) {
8395 const task = $ ( { cwd, verbose : false } ) `npx --package typescript@${ ts } tsc --project ${ config } ${ args } ` ;
8496 // eslint-disable-next-line no-underscore-dangle -- third-party code
8597 const { cmd } = task . _snapshot ;
@@ -98,8 +110,8 @@ function * buildTasks() {
98110 for ( const mode of CORE_JS_MODES ) {
99111 for ( const target of ES_TARGETS ) {
100112 for ( const ts of TYPE_SCRIPT_VERSIONS ) {
101- for ( const env of ENVIRONMENTS ) {
102- for ( const lib of LIBS ) {
113+ for ( const env of [ null , ... ENVIRONMENTS ] ) {
114+ for ( const lib of [ null , ... LIBS ] ) {
103115 const tsConfigPostfix = `${ TARGET_RULES [ target ] ? `.${ target } ` : '' } ${ LIB_RULES [ lib ] ? `.${ lib } ` : '' } ` ;
104116 const config = env ? `./tsconfig.${ mode } ${ tsConfigPostfix } .json` : `${ mode } /tsconfig${ tsConfigPostfix } .json` ;
105117 const libWithTarget = lib ? `${ target } ,${ lib } ` : target ;
@@ -156,18 +168,18 @@ async function prepareEnvironments() {
156168}
157169
158170const tasks = [
159- { ts : '5.9' , config : 'tools/tsconfig.json' } ,
160- { ts : '5.9' , config : 'templates/tsconfig.json' } ,
161- { ts : '5.9' , config : 'templates/tsconfig.require.json' } ,
162- { ts : '5.9' , config : 'entries/full/tsconfig.json' } ,
163- { ts : '5.9' , config : 'entries/actual/tsconfig.json' } ,
164- { ts : '5.9' , config : 'entries/stable/tsconfig.json' } ,
165- { ts : '5.9' , config : 'entries/es/tsconfig.json' } ,
166- { ts : '5.9' , config : 'entries/proposals/tsconfig.json' } ,
167- { ts : '5.9' , config : 'entries/global-imports/tsconfig.json' } ,
168- { ts : '5.9' , config : 'entries/pure-imports/tsconfig.json' } ,
169- { ts : '5.9' , config : 'entries/configurator/tsconfig.json' } ,
170- { ts : '5.9' , config : 'entries/pure-pollutions/tsconfig.json' } ,
171+ { config : 'tools/tsconfig.json' } ,
172+ { config : 'templates/tsconfig.json' } ,
173+ { config : 'templates/tsconfig.require.json' } ,
174+ { config : 'entries/full/tsconfig.json' } ,
175+ { config : 'entries/actual/tsconfig.json' } ,
176+ { config : 'entries/stable/tsconfig.json' } ,
177+ { config : 'entries/es/tsconfig.json' } ,
178+ { config : 'entries/proposals/tsconfig.json' } ,
179+ { config : 'entries/global-imports/tsconfig.json' } ,
180+ { config : 'entries/pure-imports/tsconfig.json' } ,
181+ { config : 'entries/configurator/tsconfig.json' } ,
182+ { config : 'entries/pure-pollutions/tsconfig.json' } ,
171183 ...buildTasks ( ) ,
172184] ;
173185
0 commit comments