You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@clavex/react's Jest suite does not run cleanly under the monorepo. Build and
type emission (tsup) are unaffected — this is purely a test-harness issue.
Symptoms
With the default ts-jest (CommonJS) preset the suite fails to compile:
src/ClavexProvider.tsx:72:20 - error TS1343: The 'import.meta' meta-property
is only allowed when the '--module' option is 'es2020', 'es2022', 'esnext',
'system', 'node16', 'node18', 'node20', or 'nodenext'.
Root cause: the source uses import.meta.env, which requires ESM.
Switching to ts-jest/presets/default-esm + useESM: true + module: esnext
fixes compilation but then breaks React module interop — React.useContext
resolves to null under jest ESM:
Cannot read properties of null (reading 'useContext') (src/context.tsx:45)
5 tests fail because React/context is mis-resolved.
Current workaround
jest.config.js left on the default ts-jest preset (documented inline).
CI (.github/workflows/ci.yml) runs npm test with continue-on-error: true
so the react suite does not block the pipeline.
Goal
Working jest-ESM setup for @clavex/react with correct React CJS/ESM interop,
so the suite passes and continue-on-error can be removed.
Things to try
ts-jest/presets/default-esm + extensionsToTreatAsEsm + moduleNameMapper
pinning a single React instance.
Or migrate the suite to Vitest (native ESM + import.meta, jsdom).
Problem
@clavex/react's Jest suite does not run cleanly under the monorepo. Build andtype emission (tsup) are unaffected — this is purely a test-harness issue.
Symptoms
With the default
ts-jest(CommonJS) preset the suite fails to compile:Root cause: the source uses
import.meta.env, which requires ESM.Switching to
ts-jest/presets/default-esm+useESM: true+module: esnextfixes compilation but then breaks React module interop —
React.useContextresolves to
nullunder jest ESM:5 tests fail because React/context is mis-resolved.
Current workaround
jest.config.jsleft on the defaultts-jestpreset (documented inline)..github/workflows/ci.yml) runsnpm testwithcontinue-on-error: trueso the react suite does not block the pipeline.
Goal
Working jest-ESM setup for
@clavex/reactwith correct React CJS/ESM interop,so the suite passes and
continue-on-errorcan be removed.Things to try
ts-jest/presets/default-esm+extensionsToTreatAsEsm+moduleNameMapperpinning a single React instance.
import.meta, jsdom).