Skip to content

v2.0.0: Node 22+/NestJS 11–12 support, Vitest, and close() fix - #9

Merged
rbonestell merged 6 commits into
mainfrom
chore/lts-targets
Sep 30, 2026
Merged

rbonestell merged 6 commits into
mainfrom
chore/lts-targets

Conversation

@rbonestell

Copy link
Copy Markdown
Owner

This pull request targets the current LTS lines of Node.js and the maintained NestJS majors, fixes two defects, switches the test suite from Jest to Vitest, and removes the example app. It is a breaking change: 2.0.0, because it drops support for Node 18/20 and NestJS 9/10.

Breaking changes:

  • engines.node is now >=22.0.0. Node 18 and 20 are end-of-life; 22 and 24 are the current LTS lines.
  • peerDependencies["@nestjs/common"] is now ^11.0.0 || ^12.0.0. NestJS 9 and 10 are no longer supported.

Fixes:

  • close() now calls server.close() before closeAllConnections(). Previously the proxy kept listening and accepting connections after close() and kept the process alive. A side effect is that start() works again after close().
  • Build output now matches main/types again. The build had started emitting dist/src/... and dist/test/..., so the next release would have been unusable (1.2.0 on npm is fine). The new tsconfig.build.json compiles only lib/src, and the package again contains exactly three dist/ files.

NestJS 12 compatibility:

  • NestJS 12 ships as ES modules only. The library is still CommonJS, and INestApplication is now imported with import type, so the emitted JS has no runtime dependency on @nestjs/*. This was verified with real HTTPS requests on NestJS 11 and 12, Express and Fastify, and Node 22 and 24, plus a TypeScript consumer type-check (nodenext and bundler).
  • Removed the unreachable else if condition in start() (it's now a plain else; behavior is identical).

Testing:

  • Switched from Jest to Vitest 5 with v8 coverage. Jest can only load the ES-module-only NestJS 12 packages on Node 24.9+, and only with --experimental-vm-modules. The spec changes are only the jest.* β†’ vi.* renames.
  • Coverage is enforced at 100% (lines, branches, functions, statements). The earlier 100% report from Jest 29/ts-jest was inaccurate; the real branch coverage was 95.65%, and the missed branch was the dead else if above.
  • Added tests for close() stopping the server and for close() doing nothing when the proxy isn't listening.
  • The test workflow runs a Node 22/24 Γ— NestJS 11/12 matrix. NestJS 11 is installed with npm install --no-save over the NestJS 12 dev dependencies.

Dependencies and repo:

  • Dev dependencies: NestJS 12 and @types/node 22; added vitest and @vitest/coverage-v8; removed jest, ts-jest, @types/jest, ts-node, and @nestjs/testing (unused).
  • lint-staged moved from dependencies to devDependencies, so consumers no longer install it.
  • Removed the example/ app.
  • CI now uses Node 22/24 for build and test and Node 24 for publish. The workflows now also trigger on changes to lib/test/**, package-lock.json, and tsconfig.build.json.
  • Added AGENTS.md (with CLAUDE.md symlinked to it) and replaced the Jest references in the README badge and VS Code config.

Move agent guidance into AGENTS.md so it can be shared by any AI coding
tool, and point CLAUDE.md at it via symlink so Claude Code still picks
it up without keeping two copies in sync.
…stop listening

- Require Node >= 22 and narrow the @nestjs/common peer range to 11 or 12.
  CI now runs build and test on a Node 22 + 24 matrix, and publish uses
  Node 24.
- Import INestApplication with `import type` so the emitted CJS has no
  runtime dependency on Nest, which lets Nest 12 (ESM-only) work as a peer.
- close() now calls server.close() before closeAllConnections(). Before,
  the port stayed bound after close().
- Add tsconfig.build.json to build only lib/src into dist/.
- Move lint-staged from dependencies to devDependencies.
- Bump devDependencies, refresh the lockfile, and update AGENTS.md to match.
Drop the example/ Nest app, its committed self-signed cert and key, and
its lockfile. Remove the matching AGENTS.md section and the "example"
entry from the root tsconfig exclude list, since the directory no longer
exists.
Nest 12 packages are ESM-only, which Jest's CJS loader can't import
without experimental flags. Vitest loads ESM natively, so the devDeps
can move to Nest 12 while CI still verifies Nest 11 compatibility.

- Replace jest, ts-jest, ts-node and @nestjs/testing with vitest and
  @vitest/coverage-v8; add vitest.config.mjs with 100% thresholds
- Port the spec file from jest.* to vi.* APIs
- Add a Nest 11/12 matrix to test.yml via npm install --no-save
- Update workflow path filters, VS Code settings and AGENTS.md
- Drop the unreachable else-if condition in start()
Correct "develoment" to "development" in the package.json description.
The file also loses its trailing newline.
@codecov

codecov Bot commented Sep 30, 2026

Copy link
Copy Markdown

Codecov Report

βœ… All modified and coverable lines are covered by tests.
βœ… Project coverage is 100.00%. Comparing base (e32f927) to head (3275913).

Additional details and impacted files
@@            Coverage Diff            @@
##              main        #9   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           38        35    -3     
  Branches         8         7    -1     
=========================================
- Hits            38        35    -3     

β˜” View full report in Codecov by Harness.
πŸ“’ Have feedback on the report? Share it here.

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rbonestell
rbonestell merged commit ab6636f into main Sep 30, 2026
12 checks passed
@rbonestell
rbonestell deleted the chore/lts-targets branch September 30, 2026 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant