Files
markdown-converter/jest.config.js
T
amitwh eeda3f28eb fix(test): exclude dist/ from Jest haste map
electron-builder's .snap (Squashfs) artifact in dist/ registered as an
obsolete Jest snapshot file, failing the suite exit code despite all
516 tests passing. modulePathIgnorePatterns keeps the snapshot scanner
out of build output.

Amit Haridas
2026-08-23 19:31:33 +05:30

60 lines
1.4 KiB
JavaScript

/**
* Jest Configuration for PanConverter
* @version 2.2.0
*/
module.exports = {
// Test environment
testEnvironment: 'jsdom',
// Root directory
rootDir: '.',
// Test file patterns
testMatch: ['**/tests/**/*.test.js', '**/tests/**/*.spec.js'],
// Coverage configuration
collectCoverageFrom: [
'src/**/*.js',
'!src/main.js', // Main process needs electron-mock
'!src/renderer.js', // Large renderer file with duplicate declarations
'!src/preload.js', // Electron preload requires contextBridge
'!**/node_modules/**',
],
// Coverage thresholds (raised with expanded test suite)
coverageThreshold: {
global: {
branches: 10,
functions: 15,
lines: 15,
statements: 15,
},
},
// Transform settings (no transpilation needed for vanilla JS)
transform: {},
// Module paths
moduleDirectories: ['node_modules', 'src'],
// Setup files
setupFilesAfterEnv: ['<rootDir>/tests/setup.js'],
// Ignore patterns
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
// Keep the haste map / snapshot scanner out of build output — electron-builder's
// .snap (Squashfs) artifacts otherwise register as obsolete Jest snapshots.
modulePathIgnorePatterns: ['/dist/'],
// Verbose output
verbose: true,
// Clear mocks between tests
clearMocks: true,
// Reset modules between tests
resetModules: true,
};