|
13 | 13 | // limitations under the License.
|
14 | 14 |
|
15 | 15 | import assert from 'node:assert'
|
16 |
| -import { test, describe } from 'node:test' |
| 16 | +import { test, describe, before, after } from 'node:test' |
17 | 17 | import { inspect } from 'node:util'
|
18 | 18 | import { basename } from 'node:path'
|
19 | 19 | import { Readable, Writable } from 'node:stream'
|
@@ -584,15 +584,38 @@ describe('core', () => {
|
584 | 584 | assert.ok(ok, 'Expected failure!')
|
585 | 585 | })
|
586 | 586 |
|
587 |
| - test('usePwsh() sets proper defaults', () => { |
| 587 | + describe('presets', () => { |
588 | 588 | const originalWhichSync = which.sync
|
589 |
| - which.sync = (bin) => (bin === 'pwsh' ? 'pwsh' : originalWhichSync(bin)) |
590 |
| - usePwsh() |
591 |
| - assert.equal($.shell, 'pwsh') |
592 |
| - assert.equal($.prefix, '') |
593 |
| - assert.equal($.postfix, '; exit $LastExitCode') |
594 |
| - assert.equal($.quote, quotePowerShell) |
595 |
| - which.sync = originalWhichSync |
596 |
| - useBash() |
| 589 | + before(() => { |
| 590 | + which.sync = (bin) => bin |
| 591 | + }) |
| 592 | + after(() => { |
| 593 | + which.sync = originalWhichSync |
| 594 | + useBash() |
| 595 | + }) |
| 596 | + |
| 597 | + test('usePwsh()', () => { |
| 598 | + usePwsh() |
| 599 | + assert.equal($.shell, 'pwsh') |
| 600 | + assert.equal($.prefix, '') |
| 601 | + assert.equal($.postfix, '; exit $LastExitCode') |
| 602 | + assert.equal($.quote, quotePowerShell) |
| 603 | + }) |
| 604 | + |
| 605 | + test('usePowerShell()', () => { |
| 606 | + usePowerShell() |
| 607 | + assert.equal($.shell, 'powershell.exe') |
| 608 | + assert.equal($.prefix, '') |
| 609 | + assert.equal($.postfix, '; exit $LastExitCode') |
| 610 | + assert.equal($.quote, quotePowerShell) |
| 611 | + }) |
| 612 | + |
| 613 | + test('useBash()', () => { |
| 614 | + useBash() |
| 615 | + assert.equal($.shell, 'bash') |
| 616 | + assert.equal($.prefix, 'set -euo pipefail;') |
| 617 | + assert.equal($.postfix, '') |
| 618 | + assert.equal($.quote, quote) |
| 619 | + }) |
597 | 620 | })
|
598 | 621 | })
|
0 commit comments