Skip to content

Fix Test-MtConnection formatting tests on Windows#1984

Merged
merill merged 1 commit into
mainfrom
codex/fix-windows-connection-formatting-tests
Jul 22, 2026
Merged

Fix Test-MtConnection formatting tests on Windows#1984
merill merged 1 commit into
mainfrom
codex/fix-windows-connection-formatting-tests

Conversation

@merill

@merill merill commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • make Test-MtConnection formatting assertions accept both LF and CRLF line endings
  • preserve the existing exact service labels, ordering, and disconnected status checks

Root cause

Out-String uses CRLF on Windows. In multiline .NET regular expressions, $ matches before \n but not before the preceding \r, so assertions ending in Not connected$ failed only on Windows.

Validation

  • powershell/tests/pester.ps1 -TestGeneral:$false -TestFunctions:$true -Include Test-MtConnection.Tests.ps1 -Output Detailed — 35 passed, 0 failed
  • direct CRLF regex reproduction
  • Invoke-ScriptAnalyzer with error severity
  • git diff --check

Summary by CodeRabbit

  • Tests
    • Improved validation of disconnected service-status output across multiple scenarios.
    • Tests now support Windows-style line endings for more reliable results.

@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 8babb276-81b1-46a7-ad45-edd9bce4af3d

📥 Commits

Reviewing files that changed from the base of the PR and between c45c1dc and 2bae2a1.

📒 Files selected for processing (1)
  • powershell/tests/functions/Test-MtConnection.Tests.ps1

📝 Walkthrough

Walkthrough

Updated connection status test regexes to accept optional carriage returns before line endings across complete, filtered, all-service, and Exchange Online Protection status assertions.

Changes

Connection status test compatibility

Layer / File(s) Summary
Relax not-connected line matching
powershell/tests/functions/Test-MtConnection.Tests.ps1
Updated service-status assertions to match “Not connected” lines with either LF or CRLF line endings across multiple connection-status scenarios.

Estimated code review effort: 1 (Trivial) | ~3 minutes

Suggested reviewers: massimomazzariol

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the Windows-specific formatting test fix.
Description check ✅ Passed The description covers the change, root cause, and validation, though it omits the template's issue link and checkbox sections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-windows-connection-formatting-tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

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.

@merill
merill marked this pull request as ready for review July 22, 2026 14:33
@merill
merill requested a review from a team as a code owner July 22, 2026 14:33
@merill
merill merged commit c2e32d9 into main Jul 22, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant