Skip to content

Commit 6dd93d1

Browse files
authored
Test on Node 22. (#2347)
* Node 22 * this * this * this * this * this * Revert "this" This reverts commit 476231d. * Revert "this" This reverts commit b909e6a. * Revert "this" This reverts commit c68ed7c. * Revert "this" This reverts commit 1206b37. * Revert "this" This reverts commit 486b8b1. * try this * try this * boop * boop * try this
1 parent a66f5f2 commit 6dd93d1

File tree

4 files changed

+31
-5
lines changed

4 files changed

+31
-5
lines changed

.github/workflows/health_checks.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ on:
4747
description: 'Node versions list (as JSON array).'
4848
required: false
4949
type: string
50-
default: '["18", "20"]'
50+
default: '["18", "20", "22"]'
5151
workflow_call:
5252
inputs:
5353
desired-cdk-version:
@@ -78,7 +78,7 @@ on:
7878
description: 'Node versions list (as JSON array).'
7979
required: false
8080
type: string
81-
default: '["18", "20"]'
81+
default: '["18", "20", "22"]'
8282

8383
env:
8484
# Health checks can run on un-released code. Often work in progress.
@@ -121,7 +121,7 @@ jobs:
121121
echo "os=$os" >> "$GITHUB_OUTPUT"
122122
echo "os_for_e2e=$os_for_e2e" >> "$GITHUB_OUTPUT"
123123
if [ -z "${{ inputs.node }}" ]; then
124-
echo 'node=["18", "20"]' >> "$GITHUB_OUTPUT"
124+
echo 'node=["18", "20", "22"]' >> "$GITHUB_OUTPUT"
125125
else
126126
echo 'node=${{ inputs.node }}' >> "$GITHUB_OUTPUT"
127127
fi
@@ -512,6 +512,10 @@ jobs:
512512
node-version: 20
513513
- os: windows-latest
514514
node-version: 20
515+
- os: macos-14
516+
node-version: 22
517+
- os: windows-latest
518+
node-version: 22
515519
runs-on: ${{ matrix.os }}
516520
timeout-minutes: ${{ matrix.os == 'windows-latest' && 35 || 25 }}
517521
needs:
@@ -538,7 +542,7 @@ jobs:
538542
matrix:
539543
os: ${{ fromJSON(needs.resolve_inputs.outputs.os) }}
540544
pkg-manager: [npm, yarn-classic, yarn-modern, pnpm]
541-
node-version: ['20']
545+
node-version: ['22']
542546
env:
543547
PACKAGE_MANAGER: ${{ matrix.pkg-manager }}
544548
runs-on: ${{ matrix.os }}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
"test": "npm run test:dir $(tsx scripts/get_unit_test_dir_list.ts)",
3333
"test:coverage:generate": "NODE_V8_COVERAGE=coverage/ npm run test",
3434
"test:coverage:threshold": "c8 npm run test",
35-
"test:dir": "tsx --test --test-reporter spec",
35+
"test:dir": "tsx scripts/run_tests.ts",
3636
"test:scripts": "npm run test:dir $(glob --cwd=scripts --absolute **/*.test.ts)",
3737
"update:api": "tsx scripts/concurrent_workspace_script.ts update:api --if-present",
3838
"update:tsconfig-refs": "tsx scripts/update_tsconfig_refs.ts",

scripts/get_unit_test_dir_list.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ result = result.filter((result) => !result.includes('integration-tests'));
66
result.push(
77
path.join('packages', 'integration-tests', 'lib', 'test-in-memory')
88
);
9+
910
console.log(result.join(' '));

scripts/run_tests.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { execa } from 'execa';
2+
import fs from 'fs';
3+
import semver from 'semver';
4+
5+
let testPaths = process.argv.slice(2);
6+
7+
const nodeVersion = semver.parse(process.versions.node);
8+
if (nodeVersion && nodeVersion.major >= 21) {
9+
// Starting from version 21. Node test runner's cli changed how inputs to test CLI work.
10+
// See https://github.com/nodejs/node/issues/50219.
11+
testPaths = testPaths.map((path) => {
12+
if (fs.existsSync(path) && fs.statSync(path).isDirectory()) {
13+
return `${path}/**/*.test.?(c|m)js`;
14+
}
15+
return path;
16+
});
17+
}
18+
19+
await execa('tsx', ['--test', '--test-reporter', 'spec'].concat(testPaths), {
20+
stdio: 'inherit',
21+
});

0 commit comments

Comments
 (0)