Skip to content

Raise Codecov patch coverage for config loader fallback paths#31

Merged
night-slayer18 merged 4 commits intomainfrom
copilot/fix-codecov-issue
Mar 23, 2026
Merged

Raise Codecov patch coverage for config loader fallback paths#31
night-slayer18 merged 4 commits intomainfrom
copilot/fix-codecov-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 23, 2026

Codecov patch failed because recently changed branches in packages/cli/src/config/loader.ts were not exercised by existing tests (codecov/patch reported 33.33% on the diff). This PR increases patch coverage by adding focused tests for the explicit-path and fallback code paths that were previously uncovered.

  • Coverage gap addressed in config-loader tests

    • Extended packages/cli/tests/config-loader.test.ts to cover:
      • TS config discovery (autodocs.config.ts)
      • explicit JSON config path loading
      • null return when no config exists
      • explicit-path fallback when cosmiconfig returns null (JSON + JS paths)
      • wrapped loader error message path (Failed to load config: ...)
  • Fallback/error branches tested without production code changes

    • Used jest.isolateModulesAsync + jest.doMock('cosmiconfig', ...) to force loader fallback branches deterministically.
    • Kept scope strictly to tests; no runtime behavior changes in CLI/core code.
  • Cross-platform test hardening

    • Replaced hardcoded '/tmp' usage in error-path test with createTempDir() to avoid platform-specific assumptions.
await jest.isolateModulesAsync(async () => {
  jest.doMock('cosmiconfig', () => ({
    cosmiconfig: () => ({
      search: jest.fn(),
      load: jest.fn().mockResolvedValue(null),
    }),
  }));

  const { loadConfig } = await import('../src/config/loader');
  const config = await loadConfig(configPath); // explicit path fallback exercised
  expect(config?.output.dir).toBe('./fallback-json');
});

💬 Send tasks to Copilot coding agent from Slack and Teams to turn conversations into code. Copilot posts an update in your thread when it's finished.

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 23, 2026

Deploy Preview for autodocshq ready!

Name Link
🔨 Latest commit f2cc198
🔍 Latest deploy log https://app.netlify.com/projects/autodocshq/deploys/69c180d46cf7fa00080d5537
😎 Deploy Preview https://deploy-preview-31--autodocshq.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI and others added 3 commits March 23, 2026 17:59
Copilot AI changed the title [WIP] Fix Codecov coverage threshold failure Raise Codecov patch coverage for config loader fallback paths Mar 23, 2026
Copilot AI requested a review from night-slayer18 March 23, 2026 18:07
@night-slayer18 night-slayer18 marked this pull request as ready for review March 23, 2026 18:13
@github-actions
Copy link
Copy Markdown

🚀 Deployed on https://pr-31--autodocshq.netlify.app

@github-actions github-actions Bot temporarily deployed to pull request March 23, 2026 18:14 Inactive
@github-actions
Copy link
Copy Markdown

Preview Deployment

Your preview is ready.

URL: https://pr-31--autodocshq.netlify.app


Deployed from commit bb797dc

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 23, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@night-slayer18 night-slayer18 merged commit d08a5da into main Mar 23, 2026
23 checks passed
@night-slayer18 night-slayer18 deleted the copilot/fix-codecov-issue branch March 23, 2026 18:32
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.

2 participants