@@ -3,7 +3,10 @@ import fs from "node:fs/promises";
33import path from "node:path" ;
44import { PassThrough } from "node:stream" ;
55import { afterEach , beforeEach , describe , expect , it , vi } from "vitest" ;
6- import { getWindowsCmdExePath } from "../infra/windows-install-roots.js" ;
6+ import {
7+ getWindowsCmdExePath ,
8+ getWindowsPowerShellExePath ,
9+ } from "../infra/windows-install-roots.js" ;
710import "./test-helpers/schtasks-base-mocks.js" ;
811import {
912 inspectPortUsage ,
@@ -136,7 +139,11 @@ function makeSpawnSyncResult(overrides: Partial<SpawnSyncResult> = {}): SpawnSyn
136139function mockWindowsNodeHostProcess ( processId = 5151 ) : void {
137140 vi . spyOn ( process , "platform" , "get" ) . mockReturnValue ( "win32" ) ;
138141 spawnSync . mockImplementation ( ( command , args ) => {
139- if ( command === "powershell" && Array . isArray ( args ) && args . includes ( NODE_PROCESS_QUERY ) ) {
142+ if (
143+ command === getWindowsPowerShellExePath ( ) &&
144+ Array . isArray ( args ) &&
145+ args . includes ( NODE_PROCESS_QUERY )
146+ ) {
140147 return makeSpawnSyncResult ( {
141148 stdout : JSON . stringify ( [
142149 {
@@ -405,7 +412,7 @@ describe("Windows startup fallback", () => {
405412 findVerifiedGatewayListenerPidsOnPortSync . mockReturnValue ( [ 4242 ] ) ;
406413 spawnSync . mockImplementation ( ( command , args ) => {
407414 if (
408- command === "powershell" &&
415+ command === getWindowsPowerShellExePath ( ) &&
409416 Array . isArray ( args ) &&
410417 args . includes (
411418 "Get-CimInstance Win32_Process | Select-Object ProcessId,CommandLine | ConvertTo-Json -Compress" ,
@@ -475,7 +482,7 @@ describe("Windows startup fallback", () => {
475482 fastForwardTaskStartWait ( ) ;
476483 spawnSync . mockImplementation ( ( command , args ) => {
477484 if (
478- command === "powershell" &&
485+ command === getWindowsPowerShellExePath ( ) &&
479486 Array . isArray ( args ) &&
480487 args . includes (
481488 "Get-CimInstance Win32_Process | Select-Object ProcessId,CommandLine | ConvertTo-Json -Compress" ,
@@ -563,7 +570,7 @@ describe("Windows startup fallback", () => {
563570 ) ;
564571 spawnSync . mockImplementation ( ( command , args ) => {
565572 if (
566- command === "powershell" &&
573+ command === getWindowsPowerShellExePath ( ) &&
567574 Array . isArray ( args ) &&
568575 args . includes (
569576 "Get-CimInstance Win32_Process | Select-Object ProcessId,CommandLine | ConvertTo-Json -Compress" ,
0 commit comments