Skip to content

Commit 93c9396

Browse files
Fix tests to work with ES modules and TypeScript
- Updated Jest configuration to use ts-jest ESM preset - Added NODE_OPTIONS flag for experimental VM modules support - Fixed import statements in all test files to import Jest globals - Rewrote provider.test.ts to work with ESM (using actual implementations with mock Redis) - Fixed test expectations to match actual implementation - Fixed encryption key generation in tests (using proper 64-char hex tokens) - Standardized token_type to "Bearer" across codebase - Removed unused imports to fix lint errors - Excluded scratch folder from test runs All tests now pass successfully with proper ES module support. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]> Relocked
1 parent b1d1790 commit 93c9396

File tree

8 files changed

+281
-424
lines changed

8 files changed

+281
-424
lines changed

jest.config.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
1-
import { createDefaultEsmPreset } from "ts-jest";
2-
3-
const defaultEsmPreset = createDefaultEsmPreset();
4-
5-
/** @type {import('ts-jest').JestConfigWithTsJest} **/
1+
/** @type {import('ts-jest').JestConfigWithTsJest} */
62
export default {
7-
...defaultEsmPreset,
3+
preset: 'ts-jest/presets/default-esm',
4+
testEnvironment: 'node',
5+
extensionsToTreatAsEsm: ['.ts'],
86
moduleNameMapper: {
9-
"^(\\.{1,2}/.*)\\.js$": "$1",
7+
'^(\\.{1,2}/.*)\\.js$': '$1',
108
},
11-
testPathIgnorePatterns: ["/node_modules/", "/dist/"],
9+
transform: {
10+
'^.+\\.tsx?$': [
11+
'ts-jest',
12+
{
13+
useESM: true,
14+
},
15+
],
16+
},
17+
testPathIgnorePatterns: ['/node_modules/', '/dist/', '/scratch/'],
18+
injectGlobals: true,
1219
};

0 commit comments

Comments
 (0)