Skip to content

Triage and resolve lingering source-code TODO comments #2767

Description

@nohwnd

Context

A test-suite audit (see #2764) surfaced ~58 TODO comments scattered across src/. None are production blockers — the test suite is green and behavior is correct. These are accumulated design-debt notes worth tracking in one place so the information isn't lost in comments. This is housekeeping, not a bug.

Grouped by theme below. Each line is a file:line reference (line numbers approximate; they drift as code changes).

P1 — Latent dead code (cheap wins)

  • src/functions/TestResults.NUnit25.ps1:320,334 — the reason/message block for Skipped/Inconclusive is unreachable: it guards on $TestResult.FailureMessage, which is never populated for those states (verified — empty at the source, so the emitted NUnit2.5 XML is still valid but the block is dead). :334 also guards on FailureMessage but writes DisplayErrorMessage. Remove or wire up correctly.
  • src/Pester.Runtime.ps1:1069 — commented-out Write-Host debug line tagged #TODO; just delete.

P2 — Dead-code "Remove?" decisions

  • src/Pester.Utility.ps1:314,420
  • src/functions/Coverage.ps1:154,170,182 — hashtable/IDictionary config syntax: implement or remove.
  • src/functions/Mock.ps1:1841,1861

P3 — Unify error formatting across NUnit/JUnit writers

Several writers format errors locally instead of via one shared core function (so screen vs. report can diverge).

  • src/functions/TestResults.NUnit25.ps1:272,348,349,363
  • src/functions/TestResults.NUnit3.ps1:594,595,614

P4 — Mock internals / "resolve path safely"

  • src/functions/Mock.ps1:1181,1186$______isInMockParameterFilter hack + bound-parameter binding note.
  • src/functions/Pester.SessionState.Mock.ps1:35,40,45 — resolve path safely (×3).
  • src/functions/Pester.SessionState.Mock.ps1:464,557,892

P5 — Runtime concepts to clarify ("before shipping")

  • src/Pester.Runtime.ps1:180,2605Id used by NUnit2.5/3 grouping; find a better mechanism.
  • src/Pester.Runtime.ps1:1961,1982,2300,2324,2581
  • src/Pester.RSpec.ps1:309,310,314 — error-writing logic coupled to a plugin; separation of concerns.

P6 — Coverage breakpoint-merge implementation

  • src/functions/Coverage.ps1:588,595 — quick merge of breakpoint lists; avoid splitting/merging twice.
  • src/functions/Coverage.Plugin.ps1:124 — check config for coverage mode instead of inferring.

P7 — Should-BeEquivalent verbose-output polish

  • src/functions/assert/Equivalence/Should-BeEquivalent.ps1:78,231,244,266,332,592,607,705

P8 — SkipRemainingOnFailure: expose data via $Context

  • src/functions/Get-SkipRemainingOnFailurePlugin.ps1:57,132 — use $Context.GlobalPluginData.SkipRemainingOnFailure.* once exposed.

P9 — Low-priority informational notes (likely leave as-is)

  • src/Format.ps1:170 · src/Main.ps1:465,584,585 · src/Pester.Utility.ps1:449 · src/functions/Describe.ps1:195 · src/functions/Output.ps1:426 · src/functions/TestDrive.ps1:190 · src/functions/TestRegistry.ps1:110

No action is required for production quality; resolve opportunistically. The P1 items are the only quick "real" cleanups.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions