From eeda3f28ebb19e23f1149caeabedbabb1fb471a5 Mon Sep 17 00:00:00 2001 From: Amit Haridas Date: Sun, 23 Aug 2026 17:19:30 +0530 Subject: [PATCH] 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 --- jest.config.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/jest.config.js b/jest.config.js index 4644c6f..e8c2608 100644 --- a/jest.config.js +++ b/jest.config.js @@ -11,10 +11,7 @@ module.exports = { rootDir: '.', // Test file patterns - testMatch: [ - '**/tests/**/*.test.js', - '**/tests/**/*.spec.js' - ], + testMatch: ['**/tests/**/*.test.js', '**/tests/**/*.spec.js'], // Coverage configuration collectCoverageFrom: [ @@ -22,7 +19,7 @@ module.exports = { '!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/**' + '!**/node_modules/**', ], // Coverage thresholds (raised with expanded test suite) @@ -31,8 +28,8 @@ module.exports = { branches: 10, functions: 15, lines: 15, - statements: 15 - } + statements: 15, + }, }, // Transform settings (no transpilation needed for vanilla JS) @@ -45,10 +42,11 @@ module.exports = { setupFilesAfterEnv: ['/tests/setup.js'], // Ignore patterns - testPathIgnorePatterns: [ - '/node_modules/', - '/dist/' - ], + 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, @@ -57,5 +55,5 @@ module.exports = { clearMocks: true, // Reset modules between tests - resetModules: true + resetModules: true, };