Skip to content

Commit

Permalink
test: tweak up win32 test
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Feb 25, 2024
1 parent 074fb63 commit 01db958
Showing 1 changed file with 19 additions and 19 deletions.
38 changes: 19 additions & 19 deletions test/win32.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,30 @@ import assert from 'node:assert'
import { test, describe, beforeEach } from 'node:test'
import '../build/globals.js'

describe('win32', () => {
const _describe = process.platform === 'win32' ? describe : describe.skip

_describe('win32', () => {
beforeEach(() => {
$.verbose = false
})

if (process.platform === 'win32') {
test('should work with windows-specific commands', async () => {
const p = await $`echo $0` // Bash is first by default.
assert.match(p.stdout, /bash/)
await within(async () => {
$.shell = which.sync('powershell.exe')
$.quote = quotePowerShell
const p = await $`get-host`
assert.match(p.stdout, /PowerShell/)
})
test('should work with windows-specific commands', async () => {
const p = await $`echo $0` // Bash is first by default.
assert.match(p.stdout, /bash/)
await within(async () => {
$.shell = which.sync('powershell.exe')
$.quote = quotePowerShell
const p = await $`get-host`
assert.match(p.stdout, /PowerShell/)
})
})

test('quotePowerShell works', async () => {
await within(async () => {
$.shell = which.sync('powershell.exe')
$.quote = quotePowerShell
const p = await $`echo ${`Windows 'rulez!'`}`
assert.match(p.stdout, /Windows 'rulez!'/)
})
test('quotePowerShell works', async () => {
await within(async () => {
$.shell = which.sync('powershell.exe')
$.quote = quotePowerShell
const p = await $`echo ${`Windows 'rulez!'`}`
assert.match(p.stdout, /Windows 'rulez!'/)
})
}
})
})

0 comments on commit 01db958

Please sign in to comment.