Commit d09e34d
fix(test): make jest run under ESM + sync config with tsconfig
pnpm test failed before any test loaded: package.json is "type":"module", so
Node loaded jest.config.js as ESM and its require('next/jest') threw. Fixes:
- Rename jest.config.js -> jest.config.cjs (CommonJS, as the config file is
loaded by Node un-transformed).
- jest.setup.js: drop `process.noDeprecation = true`. The test script already
passes NODE_OPTIONS=--no-deprecation, and that property is read-only once the
flag is set (Node 24), so the assignment threw and failed every suite.
- moduleNameMapper: point @uuid at src/utilities/uuidTags.ts (was lib/
capabilities.ts, which doesn't export the helpers) and add the many other
tsconfig path aliases that were missing (@utilities, @hooks, @components, …).
- Exclude src/__tests__/utils/ (shared helpers, no test cases) from testMatch.
pnpm test now executes the full suite: 154 passing of 181. The remaining 27
failures are pre-existing test-level drift, not runner issues — incomplete mocks
(stripe payload.findByID; revalidate imports the real payload.config /
email-nodemailer ESM instead of mocking getPayload) and assertion drift in the
capabilities/storage/images unit tests.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 73babcf commit d09e34d
2 files changed
Lines changed: 26 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
60 | 74 | | |
61 | | - | |
62 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
63 | 81 | | |
64 | 82 | | |
65 | 83 | | |
| |||
73 | 91 | | |
74 | 92 | | |
75 | 93 | | |
76 | | - | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
77 | 97 | | |
78 | 98 | | |
79 | 99 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
65 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
0 commit comments