Files
homeassistant-mcp/jest.config.cjs
jango-blockchained 3115c41e87 Add test environment configuration and update Jest setup
- Created `.env.test.example` with test environment variables
- Updated `jest.config.cjs` to simplify configuration and improve test setup
- Added `jest.setup.ts` to load and configure test environment variables
- Updated test files to use dynamic test environment configuration
- Enhanced README.md with additional configuration details for testing
2025-01-30 09:56:19 +01:00

48 lines
1.4 KiB
JavaScript

/** @type {import('ts-jest').JestConfigWithTsJest} */
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
setupFiles: ['./jest.setup.ts'],
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
'#(.*)': '<rootDir>/node_modules/$1',
'^(\\.{1,2}/.*)\\.ts$': '$1',
'^chalk$': '<rootDir>/node_modules/chalk/source/index.js',
'#ansi-styles': '<rootDir>/node_modules/ansi-styles/index.js',
'#supports-color': '<rootDir>/node_modules/supports-color/index.js'
},
transform: {
'^.+\\.tsx?$': ['ts-jest', {
useESM: true,
}],
},
transformIgnorePatterns: [
'node_modules/(?!(@digital-alchemy|chalk|#ansi-styles|#supports-color)/)'
],
resolver: '<rootDir>/jest-resolver.cjs',
testMatch: ['**/__tests__/**/*.test.ts'],
globals: {
'ts-jest': {
useESM: true,
},
},
collectCoverage: true,
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'clover', 'html'],
collectCoverageFrom: [
'src/**/*.ts',
'!src/**/*.d.ts',
'!src/**/*.test.ts',
'!src/types/**/*',
'!src/polyfills.ts'
],
coverageThreshold: {
global: {
branches: 80,
functions: 80,
lines: 80,
statements: 80
}
},
verbose: true
};