/ libs / typescript / integrations / opencode / jest.config.js
jest.config.js
 1  const path = require('path');
 2  
 3  /** @type {import('ts-jest').JestConfigWithTsJest} */
 4  module.exports = {
 5    preset: 'ts-jest',
 6    testEnvironment: 'node',
 7    roots: ['<rootDir>/tests'],
 8    testMatch: ['**/*.test.ts'],
 9    moduleFileExtensions: ['ts', 'js', 'json', 'node'],
10    modulePaths: [path.resolve(__dirname, '../../node_modules')],
11    transform: {
12      '^.+\\.tsx?$': [
13        'ts-jest',
14        {
15          tsconfig: {
16            target: 'ES2022',
17            module: 'CommonJS',
18            moduleResolution: 'Node',
19            esModuleInterop: true,
20            strict: true,
21            skipLibCheck: true,
22            types: ['jest', 'node'],
23            baseUrl: '.',
24            paths: {
25              '@opencode-ai/plugin': ['./tests/__mocks__/@opencode-ai/plugin.ts'],
26              '@mlflow/core': ['../../core/src/index.ts'],
27              '@mlflow/core/*': ['../../core/src/*'],
28            },
29          },
30        },
31      ],
32    },
33    moduleNameMapper: {
34      '^@opencode-ai/plugin$': '<rootDir>/tests/__mocks__/@opencode-ai/plugin.ts',
35      '^@mlflow/core$': '<rootDir>/../../core/src',
36      '^@mlflow/core/(.*)$': '<rootDir>/../../core/src/$1',
37    },
38    testTimeout: 30000,
39    forceExit: true,
40    detectOpenHandles: true,
41  };