fix: list-directory returns flat array, drop defensive fallback

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.
This commit is contained in:
2026-07-23 09:34:57 +05:30
parent 772a791d9a
commit f1f8a16a79
5 changed files with 128 additions and 23 deletions
+16 -3
View File
@@ -10,10 +10,23 @@ module.exports = {
// Root directory
rootDir: '.',
// Test file patterns
// Test file patterns — scoped to ./tests/ only so dist/ artifacts like
// .snap packages don't get matched as test suites.
testMatch: [
'**/tests/**/*.test.js',
'**/tests/**/*.spec.js'
'<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