Skip to content

Commit

Permalink
test: fix exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
fu050409 committed Jul 23, 2024
1 parent b353311 commit b9d6f28
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions __test__/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ test('run command', (t) => {
test('run help', (t) => {
const result = spawnSync('node', [`examples/simple.cjs`, '--help'])
t.falsy(result.error)
t.deepEqual(result.status, 0)
t.deepEqual(result.status ?? 0, 0)
})

test('run version', (t) => {
const version = spawnSync('node', [`examples/simple.cjs`, '--version'])
const no_version = spawnSync('node', [`examples/no_version.cjs`, '--version'])
t.falsy(version.error)
t.deepEqual(version.status, 0)
t.not(no_version.status, 0)
t.deepEqual(version.status ?? 0, 0)
t.not(no_version.status ?? 0, 0)
})
4 changes: 2 additions & 2 deletions __test__/options.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ test('required positional option', (t) => {
const result = spawnSync('node', [`examples/positional_required.cjs`, 'foo'])
const should_fail = spawnSync('node', [`examples/positional_required.cjs`])
t.falsy(result.error)
t.deepEqual(result.status, 0)
t.not(should_fail.status, 0)
t.deepEqual(result.status ?? 0, 0)
t.not(should_fail.status ?? 0, 0)
})

test('boolean flag', (t) => {
Expand Down

0 comments on commit b9d6f28

Please sign in to comment.