diff --git a/test/smoke/win32.test.js b/test/smoke/win32.test.js index 1b2c760a61..207845a541 100644 --- a/test/smoke/win32.test.js +++ b/test/smoke/win32.test.js @@ -14,10 +14,13 @@ import assert from 'node:assert' import { test, describe } from 'node:test' +import which from 'which' import '../../build/globals.js' const _describe = process.platform === 'win32' ? describe : describe.skip +const _testPwsh = which.sync('pwsh', { nothrow: true }) ? test : test.skip + _describe('win32', () => { test('should work with windows-specific commands', async () => { const p = await $`echo $0` // Bash is first by default. @@ -38,4 +41,13 @@ _describe('win32', () => { assert.match(p.stdout, /Windows 'rulez!'/) }) }) + + _testPwsh('should work with pwsh when it is available', async () => { + await within(async () => { + usePwsh() + assert.match($.shell, /pwsh/i) + const p = await $`echo 'Hello,' && echo ${`new 'PowerShell'!`}` + assert.match(p.stdout, /Hello,\s+new 'PowerShell'!/) + }) + }) })