Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ comment:
layout: "condensed_header, diff, flags, files"
require_changes: false

# Coverage is collected by vitest (v8) over src/**; mirror its exclusions so the
# Codecov total matches the local report.
# Coverage is collected by vitest (v8) over src/**, packages/gittensory-engine/src/**,
# and packages/gittensory-miner/lib/**; mirror its exclusions so the Codecov total
# matches the local report.
ignore:
- "src/env.d.ts"
- "apps/**"
Expand Down
10 changes: 10 additions & 0 deletions test/unit/codecov-policy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ describe("Codecov policy", () => {
expect(testResultsUploadWith.fail_ci_if_error).toBe(false);
});

it("measures miner lib changes for codecov patch coverage (#4864)", () => {
const vitestConfig = readFileSync("vitest.config.ts", "utf8");
expect(vitestConfig).toMatch(/packages\/gittensory-miner\/lib\/\*\*\/\*\.js/);

const config = readYaml("codecov.yml");
const ignore = config.ignore;
if (!Array.isArray(ignore)) throw new Error("codecov.yml ignore must be an array");
expect(ignore.some((entry) => typeof entry === "string" && entry.includes("gittensory-miner"))).toBe(false);
});

it("uploads fork PR coverage tokenlessly instead of silently skipping it", () => {
// Fork PRs cannot read secrets.CODECOV_TOKEN. Previously the token-gated upload steps simply
// excluded forks with no replacement, so codecov/patch had no report to compare against and fell
Expand Down
7 changes: 6 additions & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ export default defineConfig({
...(junitPath ? { outputFile: { junit: junitPath } } : {}),
coverage: {
provider: "v8",
include: ["src/**/*.ts", "packages/gittensory-engine/src/**/*.ts", "review-enrichment/src/analyzers/codeowners.ts"],
include: [
"src/**/*.ts",
"packages/gittensory-engine/src/**/*.ts",
"packages/gittensory-miner/lib/**/*.js",
"review-enrichment/src/analyzers/codeowners.ts",
],
exclude: ["src/env.d.ts", "apps/**"],
// Emit lcov for Codecov to compute patch (changed-lines) coverage.
reporter: ["text", "lcov"],
Expand Down