- 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
23 lines
746 B
JavaScript
23 lines
746 B
JavaScript
const path = require('path');
|
|
|
|
module.exports = (request, options) => {
|
|
// Handle chalk and related packages
|
|
if (request === 'chalk' || request === '#ansi-styles' || request === '#supports-color') {
|
|
return path.resolve(__dirname, 'node_modules', request.replace('#', ''));
|
|
}
|
|
|
|
// Call the default resolver
|
|
return options.defaultResolver(request, {
|
|
...options,
|
|
// Force node to resolve modules as CommonJS
|
|
packageFilter: pkg => {
|
|
if (pkg.type === 'module') {
|
|
pkg.type = 'commonjs';
|
|
if (pkg.exports && pkg.exports.import) {
|
|
pkg.main = pkg.exports.import;
|
|
}
|
|
}
|
|
return pkg;
|
|
},
|
|
});
|
|
};
|