Skip to content

test(aws-cdk): mock agent detection instead of clearing its env vars - #1966

Draft
9pace wants to merge 1 commit into
mainfrom
mock-guess-agent-in-cli-tests
Draft

9pace wants to merge 1 commit into
mainfrom
mock-guess-agent-in-cli-tests

Conversation

@9pace

@9pace 9pace commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

The auto-default tests in cli.test.ts cleared a hardcoded copy of the env vars guessAgent() reads. The copy went stale when #1855 added AI_AGENT/AGENT, making the "no agent detected" test fail when the suite runs inside an agent that sets them.

Mock guessAgent() instead: these tests verify the guard in exec(), and detection has its own coverage in guess-agent.test.ts. New detection signals no longer require touching this file.

Checklist

  • This change contains a major version upgrade for a dependency and I confirm all breaking changes are addressed

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@aws-cdk-automation
aws-cdk-automation requested a review from a team September 14, 2026 21:11
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@9pace
9pace deployed to run-tests September 14, 2026 21:15 — with GitHub Actions Active
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.29%. Comparing base (a73eebf) to head (96938b3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1966      +/-   ##
==========================================
- Coverage   91.32%   91.29%   -0.04%     
==========================================
  Files          79       79              
  Lines       12217    12217              
  Branches     1724     1722       -2     
==========================================
- Hits        11157    11153       -4     
- Misses       1025     1029       +4     
  Partials       35       35              
Flag Coverage Δ
suite.unit 91.29% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants