mirror of
https://github.com/amitwh/markdown-converter.git
synced 2026-08-02 18:10:18 +05:30
The list-directory handler returned { path, entries } while the
renderer typed result.data as FileEntry[]; the file-store had to fall
back to raw.entries via Array.isArray. Extract the entries builder into
src/main/files/list-directory.js so it can be unit-tested, return a
plain array, and skip entries that can't be stat'd (broken symlinks,
permission errors) instead of throwing.
Also tighten jest config so dist/*.snap electron-builder artifacts are
not matched as test suites.
74 lines
1.5 KiB
JavaScript
74 lines
1.5 KiB
JavaScript
/**
|
|
* Jest Configuration for PanConverter
|
|
* @version 2.2.0
|
|
*/
|
|
|
|
module.exports = {
|
|
// Test environment
|
|
testEnvironment: 'jsdom',
|
|
|
|
// Root directory
|
|
rootDir: '.',
|
|
|
|
// Test file patterns — scoped to ./tests/ only so dist/ artifacts like
|
|
// .snap packages don't get matched as test suites.
|
|
testMatch: [
|
|
'<rootDir>/tests/**/*.test.js',
|
|
'<rootDir>/tests/**/*.spec.js'
|
|
],
|
|
|
|
// Ignore build outputs so .snap packages and bundled .asar contents
|
|
// never enter jest's file discovery.
|
|
testPathIgnorePatterns: [
|
|
'/node_modules/',
|
|
'/dist/',
|
|
'/\\.git/'
|
|
],
|
|
modulePathIgnorePatterns: [
|
|
'/node_modules/',
|
|
'/dist/'
|
|
],
|
|
|
|
// Coverage configuration
|
|
collectCoverageFrom: [
|
|
'src/**/*.js',
|
|
'!src/main/**', // Main process needs electron-mock
|
|
'!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/'
|
|
],
|
|
|
|
// Verbose output
|
|
verbose: true,
|
|
|
|
// Clear mocks between tests
|
|
clearMocks: true,
|
|
|
|
// Reset modules between tests
|
|
resetModules: true
|
|
};
|