@apistudio/apim-cli
Version:
CLI for API Management Products
39 lines (37 loc) • 940 B
JavaScript
/** @type {import('jest').Config} */
const config = {
preset: 'ts-jest/presets/default-esm',
testEnvironment: 'node',
extensionsToTreatAsEsm: ['.ts'],
transform: {
'^.+\\.tsx?$': ['ts-jest', {
useESM: true,
tsconfig: {
// Override tsconfig options for tests
module: 'NodeNext',
moduleResolution: 'NodeNext',
resolveJsonModule: true,
isolatedModules: true
}
}]
},
// Mock JSON imports and handle ESM imports
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
'\\.(json)$': '<rootDir>/__mocks__/fileMock.cjs'
},
// Only run tests from the src directory, not from dist
testMatch: [
'<rootDir>/src/**/*.test.ts'
],
// Ignore the dist directory
testPathIgnorePatterns: [
'/node_modules/',
'/dist/'
],
// Fix for ci-info dependency issue
transformIgnorePatterns: [
'/node_modules/(?!ci-info)/'
]
};
export default config;