uncloseai.com/jest.config.js
Russell Ballestrini c721b88473 fix: add fallback handling for window modal functions in embed modal
- Add safety checks for window.openTTSModal and window.openTranslateModal availability
- Implement fallback dynamic imports if window functions not available
- Prevents "window.openTTSModal is not a function" and "window.openTranslateModal is not a function" errors
- Provides graceful error handling with user feedback if modal imports fail
- Resolves loading order dependency issues between ui.js and embed modal

This ensures modal buttons work regardless of script loading order.
2025-07-03 18:51:48 -04:00

26 lines
No EOL
801 B
JavaScript

export default {
testEnvironment: 'jsdom',
moduleFileExtensions: ['js', 'mjs'],
extensionsToTreatAsEsm: ['.js'],
transform: {},
setupFilesAfterEnv: ['<rootDir>/tests/setup.js'],
testMatch: [
'<rootDir>/tests/**/*.test.js',
],
collectCoverageFrom: [
'src/**/*.js',
'!src/languages/**',
'!**/node_modules/**',
],
coverageDirectory: 'coverage',
coverageReporters: ['text', 'lcov', 'html'],
testTimeout: 10000,
// Mock external dependencies
moduleNameMapping: {
'^https://cdn\\.jsdelivr\\.net/npm/marked/lib/marked\\.esm\\.js$': '<rootDir>/tests/__mocks__/marked.js',
'^https://cdnjs\\.cloudflare\\.com/ajax/libs/highlight\\.js/11\\.8\\.0/es/highlight\\.min\\.js$': '<rootDir>/tests/__mocks__/hljs.js',
},
globals: {
fetch: global.fetch,
},
};