Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
ci(sdk): run the JavaScript SDK unit tests on Node 22 only
Yudhi Armyndharis61ea4c6b685e
diff --git a/.github/workflows/sdk-ci.yml b/.github/workflows/sdk-ci.ymlindex e4e700464..c80395980 100644--- a/.github/workflows/sdk-ci.yml+++ b/.github/workflows/sdk-ci.yml@@ -40,9 +40,9 @@ jobs:strategy:fail-fast: falsematrix:- # 18 is the published package's engines floor; vitest 4 needs Node 20.19+ or 22.12+, so 18- # only gates the typecheck, build and smoke (packaging plus real requests through each- # build's client), and the unit tests run on 20 and 22.+ # 18 is the published package's engines floor; vitest 5 needs Node 22.12+, so 18 and 20 only+ # gate the typecheck, build and smoke (packaging plus real requests through each build's+ # client), and the unit tests run on 22.node: ['18', '20', '22']defaults:run:@@ -58,9 +58,9 @@ jobs:# its Node fails here, naming the package, instead of warning and then testing on an# unsupported runtime or failing at startup on a skipped native binding. The condition is the# test step's own.- - run: npm ci --engine-strict=${{ matrix.node != '18' }}+ - run: npm ci --engine-strict=${{ matrix.node == '22' }}- run: npm test- if: matrix.node != '18'+ if: matrix.node == '22'# The build tsconfigs exclude test/, and vitest strips types without checking them, so the# type-level wire contract in test/*.test-d.ts only gates if tsc runs over test/ too (#754).- run: npm run typecheckdiff --git a/CHANGELOG.md b/CHANGELOG.mdindex 6a011009c..82fa704ff 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -126,7 +126,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0### Dependencies- `handlebars` 4.7.9 to 4.7.10, closing two critical advisories in which a crafted template could inject JavaScript into compiled output. It reaches the root tree only through `ts-jest`, so it is dev-only and nothing that ships changes.-- `vitest` 2.1 to 4.1 in the JavaScript SDK tree, closing its dev-only advisories. Its tests now need Node 20.19+ or 22.12+; the published package still supports Node 18.+- `vitest` 2.1 to 5 in the JavaScript SDK tree, closing its dev-only advisories, and `typescript` 5.9 to 7. Its unit tests now need Node 22.12+; the published package still supports Node 18.### Upgrade notes (behavior changes)diff --git a/docs/09-testing-strategy.md b/docs/09-testing-strategy.mdindex 1b39a50e4..e90f98fca 100644--- a/docs/09-testing-strategy.md+++ b/docs/09-testing-strategy.md@@ -271,7 +271,7 @@ contract surfaces that SDKs mirror (`src/**/dto/**`, `src/**/*.controller.ts`, ``src/engine/interfaces/whatsapp-engine.interface.ts`), so any backend controller or service change alsore-runs the SDK suites. It runs:-- JavaScript SDK type-check, build, and dual CJS/ESM smoke test (module loading plus requests through each build's client) on Node 18 (the `engines` floor), 20 and 22, with unit tests on 20 and 22 (vitest 4 needs Node 20.19+ or 22.12+).+- JavaScript SDK type-check, build, and dual CJS/ESM smoke test (module loading plus requests through each build's client) on Node 18 (the `engines` floor), 20 and 22, with unit tests on 22 only (vitest 5 needs Node 22.12+).- Python SDK type check with `mypy` and tests with `pytest` on Python 3.9 and 3.12.- PHP SDK tests with PHPUnit.- Java SDK tests with Maven.diff --git a/docs/18-sdk-design.md b/docs/18-sdk-design.mdindex 9ffff4c9a..79a9fd856 100644--- a/docs/18-sdk-design.md+++ b/docs/18-sdk-design.md@@ -1174,7 +1174,7 @@ The wire types live in a dedicated module (`types.ts` / `types.py`) so they can### Release process```bash-# JavaScript (the tests need Node 20.19+ or 22.12+; the published package runs on Node 18+)+# JavaScript (the tests need Node 22.12+; the published package runs on Node 18+)cd sdk/javascript && npm test && npm run build && npm run smoke # smoke = require()+import() packaging plus request check# Pythoncd sdk/python && python -m pytest -qdiff --git a/sdk/javascript/scripts/smoke.mjs b/sdk/javascript/scripts/smoke.mjsindex 7ffb745d1..7133561b3 100644--- a/sdk/javascript/scripts/smoke.mjs+++ b/sdk/javascript/scripts/smoke.mjs@@ -31,7 +31,7 @@ for (const [format, mod] of [}}-// Request smoke: the Node 18 lane skips the unit tests (vitest 4 needs Node 20.19+ or 22.12+), and+// Request smoke: the Node 18 and 20 lanes skip the unit tests (vitest 5 needs Node 22.12+), and// the typecheck accepts DOM-declared globals Node 18 lacks, so send real requests through each// build's client over the default global fetch: a parsed 2xx body, a typed error for a non-2xx, and// the abort timeout.