Skip to content

fix: exclude spec files from codeToTestRatio code glob#843

Merged
kitsuyui merged 1 commit into
mainfrom
fix/metric-codetotest-ratio-spec-overlap-001
Jun 10, 2026
Merged

fix: exclude spec files from codeToTestRatio code glob#843
kitsuyui merged 1 commit into
mainfrom
fix/metric-codetotest-ratio-spec-overlap-001

Conversation

@kitsuyui

@kitsuyui kitsuyui commented Jun 9, 2026

Copy link
Copy Markdown
Owner

The codeToTestRatio.code glob src/**/*.ts matched spec files
(*.spec.ts), causing them to be counted in both the code and test sets.
This inflated the denominator (code line count) and produced a lower
ratio than the actual production-to-test ratio.

Add !src/**/*.spec.ts as an exclusion pattern so the code side counts
only production TypeScript files. The test side is unchanged.

This follows the same pattern used in octocov's own configuration for
excluding Go test files from the code set.

The `code` glob `src/**/*.ts` matched spec files (`*.spec.ts`), causing
them to appear in both the code and test sets. This inflated the code line
count and made the ratio lower than the actual production-to-test ratio.

Add `!src/**/*.spec.ts` to exclude spec files from the code side, matching
the pattern used in octocov's own config for Go test files.
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

🎉 Happy commit!

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown

Code Metrics Report

main (d6def62) #843 (b8c6401) +/-
Coverage 99.2% 99.2% 0.0%
Code to Test Ratio 1:0.5 1:1.3 +0.7
Test Execution Time 2s 2s 0s
Details
  |                     | main (d6def62) | #843 (b8c6401) | +/-  |
  |---------------------|----------------|----------------|------|
  | Coverage            |          99.2% |          99.2% | 0.0% |
  |   Files             |              5 |              5 |    0 |
  |   Lines             |            134 |            134 |    0 |
  |   Covered           |            133 |            133 |    0 |
+ | Code to Test Ratio  |          1:0.5 |          1:1.3 | +0.7 |
  |   Code              |           1678 |            723 | -955 |
  |   Test              |            955 |            955 |    0 |
  | Test Execution Time |             2s |             2s |   0s |

Reported by octocov

@kitsuyui
kitsuyui merged commit ccab954 into main Jun 10, 2026
5 checks passed
@kitsuyui
kitsuyui deleted the fix/metric-codetotest-ratio-spec-overlap-001 branch June 10, 2026 14:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant