Skip to content

Commit 3291da2

Browse files
committed
test: skip unit tests for non-code files in test-affected
Update affected test mapper to skip unit tests when non-JS/TS/JSON files are changed, improving test performance by avoiding unnecessary test runs for documentation, configuration, and other non-code changes.
1 parent f403727 commit 3291da2

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
@@ -38,6 +38,13 @@ const CORE_FILES = [
3838
function mapSourceToTests(filepath) {
3939
const normalized = normalizePath(filepath)
4040

41+
// Skip non-code files
42+
const ext = path.extname(normalized)
43+
const codeExtensions = ['.js', '.mjs', '.cjs', '.ts', '.cts', '.mts', '.json']
44+
if (!codeExtensions.includes(ext)) {
45+
return []
46+
}
47+
4148
// Core utilities affect all tests
4249
if (CORE_FILES.some(f => normalized.includes(f))) {
4350
return ['all']

0 commit comments

Comments
 (0)