[PR #10465] Fix code-format and test invocation through PowerShell #28073

Closed
opened 2026-01-31 09:26:08 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/10465

State: closed
Merged: Yes


Fixes the Invoke-CodeFormat and Invoke-OpenConsoleTests functions in OpenConsole.psm1 so that they can be run directly from PowerShell.

Addresses the issues found when creating #10447.

Invoke-CodeFormat did not work when invoked directly from PowerShell due to a relative path being passed into the .NET function [IO.File]::WriteAllLines(). The working directory for .NET objects does not change when you change directory in PowerShell, so the paths were being treated as relative to the initial working directory of the shell - which was not the terminal git repo.

Invoke-OpenConsoleTests had 3 issues:

  1. The path to TestHostApp was wrong.
  2. It would attempt to run the "in host app" tests both in the host app and not in the host app.
  3. The test configuration in tests.xml wasn't in sync with the runABC.cmd files, so the remoting and control unit tests didn't run.

Validation Steps Performed

  1. Ran Invoke-CodeFormat and runformat.cmd from multiple directories and didn't see errors.
  2. Ran Invoke-OpenConsoleTests and didn't see errors.
**Original Pull Request:** https://github.com/microsoft/terminal/pull/10465 **State:** closed **Merged:** Yes --- Fixes the `Invoke-CodeFormat` and `Invoke-OpenConsoleTests` functions in `OpenConsole.psm1` so that they can be run directly from PowerShell. Addresses the issues found when creating #10447. `Invoke-CodeFormat` did not work when invoked directly from PowerShell due to a relative path being passed into the .NET function `[IO.File]::WriteAllLines()`. The working directory for .NET objects does not change when you change directory in PowerShell, so the paths were being treated as relative to the initial working directory of the shell - which was not the terminal git repo. `Invoke-OpenConsoleTests` had 3 issues: 1. The path to `TestHostApp` was wrong. 2. It would attempt to run the "in host app" tests both in the host app and not in the host app. 3. The test configuration in `tests.xml` wasn't in sync with the `runABC.cmd` files, so the remoting and control unit tests didn't run. ## Validation Steps Performed 1. Ran `Invoke-CodeFormat` and `runformat.cmd` from multiple directories and didn't see errors. 2. Ran `Invoke-OpenConsoleTests` and didn't see errors.
claunia added the pull-request label 2026-01-31 09:26:08 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#28073