-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjest.config.js
More file actions
27 lines (27 loc) · 1.2 KB
/
Copy pathjest.config.js
File metadata and controls
27 lines (27 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/** @type {import('ts-jest').JestConfigWithTsJest} **/
module.exports = {
testEnvironment: 'node',
watchman: false,
testPathIgnorePatterns: ['/node_modules/'],
// ai v7 / @ai-sdk / langsmith は ESM 専用で Jest の CJS ランタイムから読めないため、
// 形だけ互換のスタブへ差し替える。LLM 呼び出しは各テストでモックを注入し、
// 実プロバイダとの結合は wrangler dev で確認する。
moduleNameMapper: {
'^ai$': '<rootDir>/test/stubs/ai-sdk.ts',
'^@ai-sdk/(anthropic|openai)$': '<rootDir>/test/stubs/ai-sdk-provider.ts',
'^@ai-sdk/google-vertex/edge$': '<rootDir>/test/stubs/ai-sdk-provider.ts',
'^langsmith$': '<rootDir>/test/stubs/langsmith.ts',
'^langsmith/experimental/vercel$': '<rootDir>/test/stubs/langsmith.ts',
},
transform: {
'^.+\\.tsx?$': [
'ts-jest',
{
// ランタイム結合は wrangler dev で確認する。テストは純粋関数のみを
// トランスパイルのみ(型チェックなし)で実行し、Workers 型の解決を不要にする。
isolatedModules: true,
tsconfig: { module: 'commonjs', verbatimModuleSyntax: false },
},
],
},
};