Repository navigation
Add -ExcludeProduct to Invoke-Maester - #2608
Conversation
Leaves out the tests whose Product or RelatedProduct matches, with '*' wildcards and product aliases resolved as for -Product. The parameter adds to the config list and wins over -Product, -TestId and the other selectors. Excluded tests are NotRun with the reason code ExcludedByProduct. A test without a product, such as a Pester-format test, is never excluded, and -ExcludeProduct alone does not count as selecting by attribute. Services needed only by excluded tests are no longer read or connected, and the 2.x tag warning names -ExcludeProduct for -ExcludeTag EXO. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JPZKVDDUsNJQCdanp88YaD
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Configure and resolve product exclusions powershell/internal/engine/Resolve-MtRunConfig.ps1, powershell/internal/engine/Resolve-MtSelection.ps1, powershell/public/run/Invoke-Maester.ps1, powershell/tests/functions/engine/TestAttributes.Tests.ps1, website/docs/configuration/run-configuration.md, website/docs/upgrading-from-2x.md |
Configuration and the public command accept ExcludeProduct. Resolution combines configured and command-line values and handles aliases, keys, and wildcards. Tests and documentation describe the filter. |
Apply exclusions to native tests powershell/internal/engine/Resolve-MtNativePlan.ps1, powershell/public/run/Invoke-Maester.ps1, powershell/tests/functions/engine/*, powershell/tests/fixtures/golden/selection.json, build/golden/Export-MtGoldenFixture.ps1, build/parity/parity-allowlist.psd1, website/docs/configuration/applicability.md, website/docs/configuration/run-configuration.md |
Native planning checks exclusions before ID inclusion and marks matches NotRun with ExcludedByProduct. Tests without product data remain eligible. Services used only by excluded native tests are omitted. Fixtures and documentation include the new reason. |
Map legacy tag exclusions powershell/internal/engine/Resolve-MtNativePlan.ps1, powershell/tests/functions/engine/TestAttributes.Tests.ps1, website/docs/configuration/run-configuration.md, website/docs/upgrading-from-2x.md |
Legacy-tag warnings use -ExcludeProduct for excluded tags when a product mapping exists. Tests and migration documentation include the mappings. |
ASD homepage link
| Layer / File(s) | Summary |
|---|---|
Update ASD suite destination website/src/pages/index.js |
The ASD suite link now points to /docs/next/tests/asd. |
Priority:
Estimated code review effort: 3 (Moderate) | ~25 minutes
Change: Feature
Sequence Diagram(s)
sequenceDiagram
participant Invoke-Maester
participant Resolve-MtSelection
participant Resolve-MtNativePlan
Invoke-Maester->>Resolve-MtSelection: Pass ExcludeProduct values
Resolve-MtSelection-->>Invoke-Maester: Return resolved exclusion patterns
Invoke-Maester->>Resolve-MtNativePlan: Pass selection and native test rows
Resolve-MtNativePlan-->>Invoke-Maester: Mark matching rows ExcludedByProduct
Possibly related PRs
- maester365/maester#2430 — Adds native pack test rows with product and service data that this change filters.
- maester365/maester#2552 — Adds the ASD suite and changes the same homepage link addressed here.
Suggested reviewers: f-bader, samerde
Merge Risk: 
Minimal · up to 00ee0
-
No actionable merge-blocking issue remains in the reviewed change.
Pre-merge checks: 
5
-
Full details: Description check
-
Explanation
The description follows the required template and explains the behavior, implementation, documentation updates, tests, and known sandbox failures. The issue reference is blank, but this is non-critical.
Full details: Docstring Coverage
-
Explanation
No eligible functions found in the changed files. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 0 functions across 1 files.
-
Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
Docusaurus reports one broken link on There's no fix PR yet. I've kept it out of this PR to keep it focused. Proposed patch, to revert once 3.0 docs are versioned: --- a/website/src/pages/index.js
+++ b/website/src/pages/index.js
@@
count: "14 tests",
- href: "/docs/tests/asd",
+ href: "/docs/next/tests/asd",
},Everything else is green, including Generated by Claude Code |
Ports #2611 so the website build passes on this branch. /docs/ serves the released 2.3.0 docs, which have no ASD pages, so the link added in #2552 broke the Docusaurus broken-link check. The change no-ops once main carries #2611. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JPZKVDDUsNJQCdanp88YaD
|
Follow-up to my earlier comment on the website build: #2611 now has the fix, so I ported it here as 00ee066 (same one-line change to Generated by Claude Code |
|
A correction to my earlier comment: the link fix covers The Cloudflare build fails in about a minute, far too fast for a real website build. #2611, which holds only the link fix and passes the GitHub Actions website build, fails Cloudflare Pages the same way (the check completes in 0 seconds). The cause is in the Cloudflare Pages project, not in the repository. The build log is on the Cloudflare dashboard, which needs maintainer access, and I can't re-run the check from here. The repository has no fix for it. Generated by Claude Code |
📑 Description
Adds a first-class way to leave a product out of a run:
Invoke-Maester -ExcludeProduct <product>andSelection.ExcludeProductin the run configuration. Until now, skipping a product meant listing every other product with-Product, or using a 2.x tag such as-ExcludeTag EXO. That tag prints a deprecation warning and misses tests added after 3.0.Behaviour
-Product. It matches a test'sProductor any of itsRelatedProductvalues.*wildcards are allowed. Names go throughResolve-MtProductKey, soexo,EXOandexchangeall mean the same product.-ExcludeTagand-ExcludeTestIddo.-Product,-TestIdand the other selectors. For example,-Product entra -ExcludeProduct entraruns nothing from entra. In the native plan the check sits right after-ExcludeTestIdand before-TestId.NotRunwith the new reason codeExcludedByProduct, andReasonDetailreadsExcluded by product (exchange).Product, such as a Pester-format custom test, is never excluded. This is the opposite of-Product, which leaves such tests out.-ExcludeProductis not counted byTest-MtSelectorInUse, so using it alone adds noExcludeLineentries for Pester tests. Maester ships no Pester-format tests of its own, so the Pester selection plan needs no exclusion logic.-DryRunand the native path both apply it, throughResolve-MtNativePlan.$neededServicesinInvoke-Maesternow skips excluded tests.-ExcludeTag, the warning now suggests the exclude form:-ExcludeTag EXOreports(now -ExcludeProduct exchange)instead of-Product exchange.Changes
Resolve-MtSelection.ps1: new-ExcludeProductparameter, merged with the config list and resolved to product keys. NewTest-MtProductExcludedhelper.Resolve-MtNativePlan.ps1: theExcludedByProductgate, and the context-aware legacy tag warning.Resolve-MtRunConfig.ps1: default and blank-value cleanup forSelection.ExcludeProduct.Invoke-Maester.ps1: the new parameter with.PARAMETERhelp and an.EXAMPLE(Invoke-Maester -ExcludeProduct exchange), plus the$neededServicesfilter.run-configuration.md: added to the Selection example, the table, the rules, the merge rules and the 2.x tag table.applicability.md: the new reason code and its place in the order of checks.upgrading-from-2x.md: the parameter table and-ExcludeTag EXO→-ExcludeProduct exchange.website/docs/commands/is generated and left untouched.ExcludedByProductis added to the golden exporter's list of selection reasons (fixture text updated to match) and to the parity allowlist.Tests
TestAttributes.Tests.ps1:-Productand-TestId-ExcludeProductalone does not count as selecting by attribute-DryRunwhere the native test isExcludedByProductand the Pester-format test staysDryRunGet-MtPesterSelectionPlan.Tests.ps1:ExcludeProduct = '*'excludes no Pester-format test.✅ Checks
/powershell/tests/pester.ps1locally.ℹ️ Additional Information
Test results
./build/Build-MaesterModule.ps1and./build/Test-MaesterModuleOutput.ps1pass../powershell/tests/pester.ps1: 4172 of 4224 tests pass. The changed files' suites all pass: TestAttributes, Get-MtPesterSelectionPlan, Resolve-MtRunConfig, Invoke-Maester.Selection and Golden.mainin this sandbox. The PowerShell Gallery was not reachable from it, soMicrosoft.Graph.Authenticationwas a local stub without the SDK's types. CI with the real modules should be the judge.Possible follow-up:
-ExcludeFeature,-ExcludeArea,-ExcludeSeverityand-ExcludeSuitewould follow the same pattern: a list inResolve-MtSelection, a matcher likeTest-MtProductExcluded, one gate inResolve-MtNativePlan, and one reason code each, or a sharedExcludedByAttribute. They are left out to keep this PR focused. Unlike Product, a Pester-format test does have a Suite, so-ExcludeSuitewould need its own rule in the Pester plan.Generated by Claude Code
Summary by CodeRabbit
-ExcludeProductto exclude tests matching a product name, alias, or wildcard, including tests associated with a related product. Product exclusions take precedence over other selectors; tests without a product, including Pester-format tests, remain eligible.