Skip to content

[heft-jest-plugin] Validate managed Jest configuration - #6211

Open
Yashwanth Reddy Verupaka (yashwanth195) wants to merge 3 commits into
microsoft:mainfrom
yashwanth195:user/yverupaka/jest-managed-config
Open

Yashwanth Reddy Verupaka (yashwanth195) wants to merge 3 commits into
microsoft:mainfrom
yashwanth195:user/yverupaka/jest-managed-config

Conversation

@yashwanth195

@yashwanth195 Yashwanth Reddy Verupaka (yashwanth195) commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Add configuration validation for future managed Jest shards.

Details

Require V8 when managed coverage is enabled and reject settings incompatible with managed execution. Preserve coverage-disabled runs and ordinary Jest behavior without modifying configuration.

This PR does not enable sharding or add runtime wiring.

How it was tested

node common\scripts\install-run-rush.js test --only @rushstack/heft-jest-plugin — passed build, lint, and 73 tests on Windows with Node 24.22.1.

Impacted documentation

Package README only.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Malformed coverageReporters settings can trigger a TypeError instead of an actionable diagnostic because the code calls .some without checking Array.isArray.

1 open issue
What changed in this PR

Adds a configuration-validation foundation for future managed Jest shards in the Heft Jest plugin. Sharded execution remains disabled, and ordinary Jest behavior is unchanged.

Changes:

  • Requires V8 for managed coverage and rejects settings incompatible with managed execution.
  • Adds tests for accepted and rejected configurations, reporter policies, and non-mutation.
  • Documents the preflight utility and adds a minor-release change entry.
File Description
heft-plugins/​heft-jest-plugin/​src/​test/​JestManagedConfiguration.test.ts Tests validation rules and configuration preservation.
heft-plugins/​heft-jest-plugin/​src/​JestManagedConfiguration.ts Adds managed configuration validation and a shared coverage reporter policy.
heft-plugins/​heft-jest-plugin/​README.md Documents preflight behavior and the lack of runtime integration.
common/​changes/​@rushstack/​heft-jest-plugin/​jest-managed-config_2026-11-13.json Records the feature for a minor release.

Review effort: Balanced

Comment on lines +75 to +77
jestConfig.coverageReporters?.some(
(reporter) => typeof reporter !== 'string' || !isSupportedCoverageReporter(reporter)
)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added an array guard before .some(). Malformed JSON values, including null, now get the managed-coverage diagnostic. Added regression tests for disabled coverage and V8 collection; supported arrays and omitted settings remain accepted.

This branch has not been deployed

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

Labels

area:heft-sharding Sharding feature for heft especially for jest

Projects

Status: Needs triage

Development

Successfully merging this pull request may close these issues.

2 participants