Files
homeassistant-mcp/jest.setup.js
jango-blockchained d7e5fcf764 Enhance Jest configuration and testing infrastructure
- Updated Jest configuration to support ESM and improve test coverage
- Added comprehensive test files for helpers, index, context, and HASS integration
- Configured coverage reporting and added new test scripts
- Updated Jest resolver to handle module resolution for chalk and related packages
- Introduced new test setup files for mocking and environment configuration
2025-01-30 09:04:07 +01:00

31 lines
772 B
JavaScript

import { jest } from '@jest/globals';
// Mock environment variables
process.env.HASS_URL = 'http://localhost:8123';
process.env.HASS_TOKEN = 'test_token';
process.env.CLAUDE_API_KEY = 'test_api_key';
process.env.CLAUDE_MODEL = 'test_model';
// Global Jest settings
jest.setTimeout(30000); // 30 seconds timeout
// Mock semver to avoid the SemVer constructor issue
jest.mock('semver', () => ({
default: class SemVer {
constructor(version) {
this.version = version;
}
toString() {
return this.version;
}
},
valid: (v) => v,
clean: (v) => v,
satisfies: () => true,
gt: () => false,
gte: () => true,
lt: () => false,
lte: () => true,
eq: () => true,
neq: () => false,
}));