Skip to content

Commit 9bd91a5

Browse files
committed
fix: add file extension filtering to affected test mapper
- Skip non-code files (images, docs, etc.) in test mapping - Prevents running all tests for non-code file changes - Improves test performance
1 parent 3d74250 commit 9bd91a5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

scripts/utils/affected-test-mapper.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,13 @@ const RUN_ALL_PATTERNS = [
4848
function mapSourceToTests(filepath) {
4949
const normalized = normalizePath(filepath)
5050

51+
// Skip non-code files
52+
const ext = path.extname(normalized)
53+
const codeExtensions = ['.js', '.mjs', '.cjs', '.ts', '.cts', '.mts', '.json']
54+
if (!codeExtensions.includes(ext)) {
55+
return []
56+
}
57+
5158
// Core utilities affect all tests
5259
if (CORE_FILES.some(f => normalized.includes(f))) {
5360
return ['all']

0 commit comments

Comments
 (0)