Skip to content

Improve type checking of test macros#3873

Closed
henrymercer wants to merge 19 commits intomainfrom
henrymercer/typed-test-macros
Closed

Improve type checking of test macros#3873
henrymercer wants to merge 19 commits intomainfrom
henrymercer/typed-test-macros

Conversation

@henrymercer
Copy link
Copy Markdown
Contributor

When invoked via test or test.serial, detailed argument types are erased and we lose some type safety.

This PR wraps macro invocations in helper functions to ensure each of the arguments to the macros is type checked properly.

Dev/test only change.

Copilot AI review requested due to automatic review settings May 6, 2026 13:21
@henrymercer henrymercer requested a review from a team as a code owner May 6, 2026 13:21
@github-actions github-actions Bot added the size/XL May be very hard to review label May 6, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves TypeScript type checking in the AVA test suite by introducing small wrapper functions around test.macro(...) invocations, so macro arguments are type-checked at the wrapper call sites (instead of being erased/widened when passed directly through test(...)/test.serial(...)).

Changes:

  • Added typed wrapper helper functions around several AVA macros to preserve argument type checking.
  • Renamed some macro constants to *Macro and updated call sites to use the new wrappers.
  • Minor refactor in one test loop to iterate over BuiltInLanguage values when generating repeated test cases.
Show a summary per file
File Description
src/upload-sarif.test.ts Adds testPostProcessAndUploadSarif(...) wrapper around the upload macro.
src/status-report.test.ts Renames macro constant and adds testCreateInitWithConfigStatusReport(...) wrapper.
src/start-proxy.test.ts Renames macros and adds wrappers for sendFailedStatusReport, getCredentials, and wrapFailure macro usage.
src/setup-codeql.test.ts Adds testToolcacheInputFallback(...) wrapper around the toolcache fallback macro.
src/overlay/caching.test.ts Renames macro constant and adds testDownloadOverlayBaseDatabaseFromCache(...) wrapper.
src/init.test.ts Renames macro constant and adds testCheckPacksForOverlayCompatibility(...) wrapper.
src/init-action-post-helper.test.ts Renames macro constant and adds testSkippedUpload(...) wrapper.
src/diff-informed-analysis-utils.test.ts Renames macro constant and adds testShouldPerformDiffInformedAnalysis(...) wrapper.
src/config/db-config.test.ts Adds wrappers for several macros (parsePacks, invalid pack names, pretty printing, augmentation tests).
src/config-utils.test.ts Adds testCheckOverlayEnablement(...) wrapper and updates repeated test generation loop.
src/codeql.test.ts Adds testInjectedConfig(...) wrapper around the injected config macro.

Copilot's findings

  • Files reviewed: 11/11 changed files
  • Comments generated: 1

Comment thread src/codeql.test.ts
@henrymercer henrymercer closed this May 6, 2026
@henrymercer henrymercer deleted the henrymercer/typed-test-macros branch May 6, 2026 13:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XL May be very hard to review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants