Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,12 @@ jobs:
'netlify/framework-adapters' }}
run: echo "SKIP_LIVE_TESTS=true" >> "$GITHUB_ENV"
- name: Tests
# angular-runtime requires Node 22+, so it's excluded on the Node 20 job
if: ${{ matrix.node-version != '20.19.0' }}
# A workspace that needs a newer Node than this matrix entry skips itself, so there is
# no list of workspaces to keep in sync here. See angular-runtime's
# `tools/skip-unsupported-node.js`.
run: npm run test --workspaces=true
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
- name: Tests (excludes angular-runtime, which requires Node 22+)
if: ${{ matrix.node-version == '20.19.0' }}
run: >-
npm run test --workspace=packages/nuxt-module --workspace=packages/vite-plugin
--workspace=packages/vite-plugin-tanstack-start
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
- name: Warn if live tests were skipped
if: ${{ env.SKIP_LIVE_TESTS == 'true' }}
run: |
Expand Down
4 changes: 2 additions & 2 deletions packages/angular-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@
"pretest:fixtures:angular-22": "cd tests/fixtures/angular-22 && npm ci",
"pretest:fixtures:nx-angular-19-common-engine": "cd tests/fixtures/nx-angular-19-common-engine && npm ci",
"pretest:fixtures:nx-angular-19-app-engine": "cd tests/fixtures/nx-angular-19-app-engine && npm ci",
"pretest": "run-s pretest:*",
"pretest": "node tools/skip-unsupported-node.js || run-s pretest:*",
"publint": "npx -y publint --strict",
"test": "node --test"
"test": "node tools/skip-unsupported-node.js || node --test"
},
"repository": {
"type": "git",
Expand Down
25 changes: 25 additions & 0 deletions packages/angular-runtime/tools/skip-unsupported-node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import process from 'node:process'

import { satisfies } from 'semver'

import pkg from '../package.json' with { type: 'json' }

/**
* Decides whether this package's tests should run on the Node version in use.
*
* Exits 0 when they should be *skipped* and non-zero when they should run, so a caller can
* short-circuit with `node tools/skip-unsupported-node.js || <command>` and still report
* success on a skip. The inverted-looking exit code is deliberate: `&&` would make a skip
* indistinguishable from a test failure, and `!` negation is not available in the cmd.exe
* shell npm uses on Windows.
*
* This package needs a newer Node than the rest of the monorepo, so it opts itself out of
* the older CI matrix entries here. That keeps the workflow free of a hand-maintained list
* of workspaces to run, which would silently go stale as packages are added or their
* supported Node ranges change.
*/
if (satisfies(process.version, pkg.engines.node)) {
process.exitCode = 1
} else {
console.log(`Skipping tests: ${pkg.name} requires Node ${pkg.engines.node}, but ${process.version} is running.`)
}
Loading