Skip to content

feat: add NestJS v12 peer dependency support - #627

Draft
Papooch with Copilot wants to merge 5 commits into
mainfrom
copilot/update-nestjs-peer-dependencies
Draft

feat: add NestJS v12 peer dependency support#627
Papooch with Copilot wants to merge 5 commits into
mainfrom
copilot/update-nestjs-peer-dependencies

Conversation

Copilot AI commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Widens peer dependency ranges to include NestJS v12 and upgrades all devDependencies to test against v12 as the primary target. NestJS v12 is pure ESM, requiring pervasive test infrastructure changes to remain compatible.

Peer dependency ranges (packages/core, packages/transactional)

  • @nestjs/common / @nestjs/core: >= 10 < 12>= 10 < 13

devDependency upgrades

  • packages/core: primary @nestjs/* deps bumped to ^12; new v11 aliases added (@nestjs/common11, @nestjs/core11, etc.) alongside existing v10 aliases; @nestjs/{apollo,graphql,mercurius} bumped to ^14 (required for NestJS v12 ESM compatibility)
  • packages/transactional + all 8 adapter packages: @nestjs/common, @nestjs/core, @nestjs/testing, @nestjs/cli, @nestjs/schematics bumped to ^12

Jest / ESM migration

NestJS v12 ships as a pure ES module ("type": "module"), so require('@nestjs/common') from a CJS test harness fails. All 10 jest.config.js files were updated to ts-jest ESM mode:

extensionsToTreatAsEsm: ['.ts'],
transform: {
  '^.+\\.m?tsx?$': ['ts-jest', {
    useESM: true,
    tsconfig: { module: 'ESNext', moduleResolution: 'bundler', rootDir: '../..' },
  }],
},

NODE_OPTIONS="--experimental-vm-modules" added to test scripts in transactional and all adapter packages.

Adapter packages add moduleNameMapper entries pointing nestjs-cls and @nestjs-cls/transactional to their TypeScript source so ts-jest compiles them as ESM rather than loading the CJS dist build.

Test file fixes required by ESM mode

  • feature-detection.utils.spec.ts: rewrote to use lightweight mock adapter objects — jest.mock() inside functions cannot be hoisted in ESM mode
  • gql-mercurius.spec.ts / gql-apollo.spec.ts: added __dirname polyfill via fileURLToPath; mercurius import changed from private deep path (/dist/drivers/mercurius.driver) to public main entry (also valid in @nestjs/mercurius@13)
  • propagation.spec.ts, unit-testing-with-no-op-adapter.spec.ts, unit-testing-with-jest-mock.spec.ts: added import { jest } from '@jest/globals' (not auto-injected in ESM mode); rewrote jest.mock('../src') pattern with an inline no-op decorator to avoid ESM hoisting constraints
  • transactional-adapter-drizzle-orm-sync.spec.ts: same jest import fix; as any casts on mock.calls

No production code changes

All src/ library files are unchanged. The peer range widening is purely additive — NestJS v10 and v11 remain supported.

Copilot AI and others added 2 commits September 1, 2026 13:40
…SM compatibility

Co-authored-by: Papooch <46406259+Papooch@users.noreply.github.com>
Co-authored-by: Papooch <46406259+Papooch@users.noreply.github.com>
Copilot AI changed the title [WIP] Update packages for NestJS v12 peer dependency support feat: add NestJS v12 peer dependency support Sep 1, 2026
Copilot AI requested a review from Papooch September 1, 2026 14:05
Copilot AI and others added 2 commits September 1, 2026 14:34
Co-authored-by: Papooch <46406259+Papooch@users.noreply.github.com>
…ature flags

Co-authored-by: Papooch <46406259+Papooch@users.noreply.github.com>
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.

2 participants