Skip to content

Commit

Permalink
Test on Node 22. (#2347)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
sobolk authored Dec 19, 2024
1 parent a66f5f2 commit 6dd93d1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/health_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ on:
description: 'Node versions list (as JSON array).'
required: false
type: string
default: '["18", "20"]'
default: '["18", "20", "22"]'
workflow_call:
inputs:
desired-cdk-version:
Expand Down Expand Up @@ -78,7 +78,7 @@ on:
description: 'Node versions list (as JSON array).'
required: false
type: string
default: '["18", "20"]'
default: '["18", "20", "22"]'

env:
# Health checks can run on un-released code. Often work in progress.
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
echo "os=$os" >> "$GITHUB_OUTPUT"
echo "os_for_e2e=$os_for_e2e" >> "$GITHUB_OUTPUT"
if [ -z "${{ inputs.node }}" ]; then
echo 'node=["18", "20"]' >> "$GITHUB_OUTPUT"
echo 'node=["18", "20", "22"]' >> "$GITHUB_OUTPUT"
else
echo 'node=${{ inputs.node }}' >> "$GITHUB_OUTPUT"
fi
Expand Down Expand Up @@ -512,6 +512,10 @@ jobs:
node-version: 20
- os: windows-latest
node-version: 20
- os: macos-14
node-version: 22
- os: windows-latest
node-version: 22
runs-on: ${{ matrix.os }}
timeout-minutes: ${{ matrix.os == 'windows-latest' && 35 || 25 }}
needs:
Expand All @@ -538,7 +542,7 @@ jobs:
matrix:
os: ${{ fromJSON(needs.resolve_inputs.outputs.os) }}
pkg-manager: [npm, yarn-classic, yarn-modern, pnpm]
node-version: ['20']
node-version: ['22']
env:
PACKAGE_MANAGER: ${{ matrix.pkg-manager }}
runs-on: ${{ matrix.os }}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"test": "npm run test:dir $(tsx scripts/get_unit_test_dir_list.ts)",
"test:coverage:generate": "NODE_V8_COVERAGE=coverage/ npm run test",
"test:coverage:threshold": "c8 npm run test",
"test:dir": "tsx --test --test-reporter spec",
"test:dir": "tsx scripts/run_tests.ts",
"test:scripts": "npm run test:dir $(glob --cwd=scripts --absolute **/*.test.ts)",
"update:api": "tsx scripts/concurrent_workspace_script.ts update:api --if-present",
"update:tsconfig-refs": "tsx scripts/update_tsconfig_refs.ts",
Expand Down
1 change: 1 addition & 0 deletions scripts/get_unit_test_dir_list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ result = result.filter((result) => !result.includes('integration-tests'));
result.push(
path.join('packages', 'integration-tests', 'lib', 'test-in-memory')
);

console.log(result.join(' '));
21 changes: 21 additions & 0 deletions scripts/run_tests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { execa } from 'execa';
import fs from 'fs';
import semver from 'semver';

let testPaths = process.argv.slice(2);

const nodeVersion = semver.parse(process.versions.node);
if (nodeVersion && nodeVersion.major >= 21) {
// Starting from version 21. Node test runner's cli changed how inputs to test CLI work.
// See https://github.com/nodejs/node/issues/50219.
testPaths = testPaths.map((path) => {
if (fs.existsSync(path) && fs.statSync(path).isDirectory()) {
return `${path}/**/*.test.?(c|m)js`;
}
return path;
});
}

await execa('tsx', ['--test', '--test-reporter', 'spec'].concat(testPaths), {
stdio: 'inherit',
});

0 comments on commit 6dd93d1

Please sign in to comment.