NestJS 12 and Jest: why your tests fail and how to fix them

NestJS 12 packages are ESM only, and Jest 30 loads them only on Node.js 24.9 or later with --experimental-vm-modules.

In our runs Jest failed on Node 22.12.0 and 24.8.0 either way, and on Node 24.15.0 it still failed until the VM modules flag was set.

Vitest passed the same spec on Node 20.19.0, 22.12.0 and 24.15.0 with no flag, so it is the safest path if CI cannot move to Node 24.

Read the full post

Read the full post