- Refactored Jest configuration for improved ESM and TypeScript support - Updated `jest.setup.ts` with comprehensive test environment configuration - Enhanced mocking for WebSocket, console, and external dependencies - Adjusted package.json dependencies and scripts - Updated tsconfig.json with decorator and test exclusion settings - Improved test coverage configuration and reporting - Simplified test file structure and mocking strategies
39 lines
1.0 KiB
JavaScript
39 lines
1.0 KiB
JavaScript
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
|
module.exports = {
|
|
preset: 'ts-jest/presets/default-esm',
|
|
testEnvironment: 'node',
|
|
extensionsToTreatAsEsm: ['.ts'],
|
|
moduleNameMapper: {
|
|
'^(\\.{1,2}/.*)\\.js$': '$1',
|
|
'#(.*)': '<rootDir>/node_modules/$1',
|
|
'^(\\.{1,2}/.*)\\.ts$': '$1',
|
|
'^chalk$': 'chalk',
|
|
'#ansi-styles': 'ansi-styles',
|
|
'#supports-color': 'supports-color'
|
|
},
|
|
transform: {
|
|
'^.+\\.tsx?$': [
|
|
'ts-jest',
|
|
{
|
|
useESM: true,
|
|
},
|
|
],
|
|
},
|
|
transformIgnorePatterns: [
|
|
'node_modules/(?!(@digital-alchemy|chalk|ansi-styles|supports-color)/)'
|
|
],
|
|
resolver: '<rootDir>/jest-resolver.cjs',
|
|
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
|
|
testMatch: [
|
|
'**/__tests__/helpers.test.ts',
|
|
'**/__tests__/schemas/devices.test.ts'
|
|
],
|
|
globals: {
|
|
'ts-jest': {
|
|
useESM: true,
|
|
},
|
|
},
|
|
collectCoverage: false,
|
|
verbose: true,
|
|
testTimeout: 30000
|
|
};
|