Skip to content

Commit 8725fe3

Browse files
enhance TS test matrix for testing
1 parent ab38cbf commit 8725fe3

File tree

6 files changed

+117
-95
lines changed

6 files changed

+117
-95
lines changed

.evergreen/config.in.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ functions:
347347
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
348348
TS_VERSION: ${TS_VERSION}
349349
TS_CHECK: CHECK_TYPES
350+
TYPES_VERSION: ${TYPES_VERSION}
350351
binary: bash
351352
args:
352353
- "${PROJECT_DIRECTORY}/.evergreen/run-typescript.sh"
@@ -361,6 +362,7 @@ functions:
361362
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
362363
TS_VERSION: ${TS_VERSION}
363364
TS_CHECK: COMPILE_DRIVER
365+
TYPES_VERSION: ${TYPES_VERSION}
364366
binary: bash
365367
args:
366368
- "${PROJECT_DIRECTORY}/.evergreen/run-typescript.sh"

.evergreen/config.yml

Lines changed: 70 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,7 @@ functions:
311311
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
312312
TS_VERSION: ${TS_VERSION}
313313
TS_CHECK: CHECK_TYPES
314+
TYPES_VERSION: ${TYPES_VERSION}
314315
binary: bash
315316
args:
316317
- ${PROJECT_DIRECTORY}/.evergreen/run-typescript.sh
@@ -324,6 +325,7 @@ functions:
324325
PROJECT_DIRECTORY: ${PROJECT_DIRECTORY}
325326
TS_VERSION: ${TS_VERSION}
326327
TS_CHECK: COMPILE_DRIVER
328+
TYPES_VERSION: ${TYPES_VERSION}
327329
binary: bash
328330
args:
329331
- ${PROJECT_DIRECTORY}/.evergreen/run-typescript.sh
@@ -3451,7 +3453,7 @@ tasks:
34513453
- {key: NPM_VERSION, value: '9'}
34523454
- func: install dependencies
34533455
- func: run lint checks
3454-
- name: check-types-typescript-next
3456+
- name: check-types-typescript-next-node-types-20.12.7
34553457
tags:
34563458
- check-types-typescript-next
34573459
- typescript-compilation
@@ -3463,9 +3465,10 @@ tasks:
34633465
- {key: NODE_LTS_VERSION, value: '16'}
34643466
- {key: NPM_VERSION, value: '9'}
34653467
- {key: TS_VERSION, value: next}
3468+
- {key: TYPES_VERSION, value: 20.12.7}
34663469
- func: install dependencies
34673470
- func: check types
3468-
- name: compile-driver-typescript-current
3471+
- name: compile-driver-typescript-current-node-types-20.12.7
34693472
tags:
34703473
- compile-driver-typescript-current
34713474
- typescript-compilation
@@ -3477,9 +3480,10 @@ tasks:
34773480
- {key: NODE_LTS_VERSION, value: '16'}
34783481
- {key: NPM_VERSION, value: '9'}
34793482
- {key: TS_VERSION, value: current}
3483+
- {key: TYPES_VERSION, value: 20.12.7}
34803484
- func: install dependencies
34813485
- func: compile driver
3482-
- name: check-types-typescript-current
3486+
- name: check-types-typescript-current-node-types-20.12.7
34833487
tags:
34843488
- check-types-typescript-current
34853489
- typescript-compilation
@@ -3491,9 +3495,10 @@ tasks:
34913495
- {key: NODE_LTS_VERSION, value: '16'}
34923496
- {key: NPM_VERSION, value: '9'}
34933497
- {key: TS_VERSION, value: current}
3498+
- {key: TYPES_VERSION, value: 20.12.7}
34943499
- func: install dependencies
34953500
- func: check types
3496-
- name: check-types-typescript-4.4
3501+
- name: check-types-typescript-4.4-node-types-20.12.7
34973502
tags:
34983503
- check-types-typescript-4.4
34993504
- typescript-compilation
@@ -3505,6 +3510,67 @@ tasks:
35053510
- {key: NODE_LTS_VERSION, value: '16'}
35063511
- {key: NPM_VERSION, value: '9'}
35073512
- {key: TS_VERSION, value: '4.4'}
3513+
- {key: TYPES_VERSION, value: 20.12.7}
3514+
- func: install dependencies
3515+
- func: check types
3516+
- name: check-types-typescript-next-node-types-16.x
3517+
tags:
3518+
- check-types-typescript-next
3519+
- typescript-compilation
3520+
commands:
3521+
- command: expansions.update
3522+
type: setup
3523+
params:
3524+
updates:
3525+
- {key: NODE_LTS_VERSION, value: '16'}
3526+
- {key: NPM_VERSION, value: '9'}
3527+
- {key: TS_VERSION, value: next}
3528+
- {key: TYPES_VERSION, value: 16.x}
3529+
- func: install dependencies
3530+
- func: check types
3531+
- name: compile-driver-typescript-current-node-types-16.x
3532+
tags:
3533+
- compile-driver-typescript-current
3534+
- typescript-compilation
3535+
commands:
3536+
- command: expansions.update
3537+
type: setup
3538+
params:
3539+
updates:
3540+
- {key: NODE_LTS_VERSION, value: '16'}
3541+
- {key: NPM_VERSION, value: '9'}
3542+
- {key: TS_VERSION, value: current}
3543+
- {key: TYPES_VERSION, value: 16.x}
3544+
- func: install dependencies
3545+
- func: compile driver
3546+
- name: check-types-typescript-current-node-types-16.x
3547+
tags:
3548+
- check-types-typescript-current
3549+
- typescript-compilation
3550+
commands:
3551+
- command: expansions.update
3552+
type: setup
3553+
params:
3554+
updates:
3555+
- {key: NODE_LTS_VERSION, value: '16'}
3556+
- {key: NPM_VERSION, value: '9'}
3557+
- {key: TS_VERSION, value: current}
3558+
- {key: TYPES_VERSION, value: 16.x}
3559+
- func: install dependencies
3560+
- func: check types
3561+
- name: check-types-typescript-4.4-node-types-16.x
3562+
tags:
3563+
- check-types-typescript-4.4
3564+
- typescript-compilation
3565+
commands:
3566+
- command: expansions.update
3567+
type: setup
3568+
params:
3569+
updates:
3570+
- {key: NODE_LTS_VERSION, value: '16'}
3571+
- {key: NPM_VERSION, value: '9'}
3572+
- {key: TS_VERSION, value: '4.4'}
3573+
- {key: TYPES_VERSION, value: 16.x}
35083574
- func: install dependencies
35093575
- func: check types
35103576
- name: download-and-merge-coverage

.evergreen/generate_evergreen_tasks.js

Lines changed: 32 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -497,51 +497,49 @@ SINGLETON_TASKS.push(
497497
);
498498

499499
function* makeTypescriptTasks() {
500-
for (const TS_VERSION of ['next', 'current', '4.4']) {
501-
// We don't compile on next, because compilation errors are likely. We do expect
502-
// that the drivers types continue to work with next though.
503-
if (TS_VERSION !== '4.4' && TS_VERSION !== 'next') {
504-
yield {
505-
name: `compile-driver-typescript-${TS_VERSION}`,
506-
tags: [`compile-driver-typescript-${TS_VERSION}`, 'typescript-compilation'],
507-
commands: [
508-
updateExpansions({
509-
NODE_LTS_VERSION: LOWEST_LTS,
510-
NPM_VERSION: 9,
511-
TS_VERSION
512-
}),
513-
{ func: 'install dependencies' },
514-
{ func: 'compile driver' }
515-
]
516-
};
500+
function makeCompileTask(TS_VERSION, TYPES_VERSION) {
501+
return {
502+
name: `compile-driver-typescript-${TS_VERSION}-node-types-${TYPES_VERSION}`,
503+
tags: [`compile-driver-typescript-${TS_VERSION}`, 'typescript-compilation'],
504+
commands: [
505+
updateExpansions({
506+
NODE_LTS_VERSION: LOWEST_LTS,
507+
NPM_VERSION: 9,
508+
TS_VERSION,
509+
TYPES_VERSION
510+
}),
511+
{ func: 'install dependencies' },
512+
{ func: 'compile driver' }
513+
]
517514
}
518-
519-
yield {
520-
name: `check-types-typescript-${TS_VERSION}`,
515+
}
516+
function makeCheckTypesTask(TS_VERSION, TYPES_VERSION) {
517+
return {
518+
name: `check-types-typescript-${TS_VERSION}-node-types-${TYPES_VERSION}`,
521519
tags: [`check-types-typescript-${TS_VERSION}`, 'typescript-compilation'],
522520
commands: [
523521
updateExpansions({
524522
NODE_LTS_VERSION: LOWEST_LTS,
525523
NPM_VERSION: 9,
526-
TS_VERSION
524+
TS_VERSION,
525+
TYPES_VERSION
527526
}),
528527
{ func: 'install dependencies' },
529528
{ func: 'check types' }
530529
]
531-
};
530+
}
532531
}
533-
return {
534-
name: 'run-typescript-next',
535-
tags: ['run-typescript-next', 'typescript-compilation'],
536-
commands: [
537-
updateExpansions({
538-
NODE_LTS_VERSION: LOWEST_LTS,
539-
NPM_VERSION: 9
540-
}),
541-
{ func: 'install dependencies' },
542-
{ func: 'run typescript next' }
543-
]
544-
};
532+
533+
const typesVersion = require('../package.json').devDependencies['@types/node'].slice(1)
534+
yield makeCheckTypesTask('next', typesVersion);
535+
yield makeCompileTask('current', typesVersion);
536+
yield makeCheckTypesTask('current', typesVersion);
537+
yield makeCheckTypesTask('4.4', typesVersion);
538+
539+
yield makeCheckTypesTask('next', '16.x');
540+
yield makeCompileTask('current', '16.x');
541+
yield makeCheckTypesTask('current', '16.x');
542+
yield makeCheckTypesTask('4.4', '16.x');
545543
}
546544

547545
BUILD_VARIANTS.push({

.evergreen/run-typescript.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ case $TS_CHECK in
1414
esac
1515

1616
if [ -z "$TS_VERSION" ]; then echo "TS_VERSION must be set"; exit 1; fi
17+
if [ -z "$TYPES_VERSION" ]; then echo "TYPES_VERSION must be set"; exit 1; fi
1718

1819
if [ ! -f "mongodb.d.ts" ]; then
1920
echo "mongodb.d.ts should always exist because of the installation in prior steps but in case it doesn't, build it"
@@ -32,7 +33,7 @@ export TSC="./node_modules/typescript/bin/tsc"
3233
export TS_VERSION=$(get_ts_version)
3334

3435
# On old versions of TS we need to put the node types back to 18.11.19
35-
npm install --no-save --force typescript@"$TS_VERSION" "$(if [[ $TS_VERSION == '4.4' ]]; then echo "@types/node@18.11.19"; else echo ""; fi)"
36+
npm install --no-save --force typescript@"$TS_VERSION" "@types/node@$TYPES_VERSION"
3637

3738
echo "Typescript $($TSC -v)"
3839

package-lock.json

Lines changed: 10 additions & 55 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@
110110
"source-map-support": "^0.5.21",
111111
"ts-node": "^10.9.2",
112112
"tsd": "^0.31.0",
113-
"typescript": "5.3",
113+
"typescript": "^5.5.3",
114114
"typescript-cached-transpile": "^0.0.6",
115115
"v8-heapsnapshot": "^1.3.1",
116116
"yargs": "^17.7.2"

0 commit comments

Comments
 (0)