Skip to content

Commit

Permalink
test: add usePwsh smoke test
Browse files Browse the repository at this point in the history
Signed-off-by: Grigorii K. Shartsev <[email protected]>
  • Loading branch information
ShGKme committed Apr 29, 2024
1 parent 085e00a commit 2b6b9bb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/smoke/win32.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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'!/)
})
})
})

0 comments on commit 2b6b9bb

Please sign in to comment.