Skip to content

Commit

Permalink
test the exitCode
Browse files Browse the repository at this point in the history
  • Loading branch information
75lb committed Aug 31, 2024
1 parent 2f92be8 commit 77dd312
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ class TestRunner {
} catch (err) {
console.log(`${ansi.format(test.metadata.file || '', ['magenta'])} ${test.name} - ${ansi.format('Failed', ['red'])}`)
/* Crash the process */
process.exitCode = 1
throw err
}
}
Expand Down
4 changes: 4 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ async function syncFail () {
a.equal(err.message, 'broken')
a.equal(test1.result, undefined)
a.deepEqual(actuals, ['syncFail'])
a.equal(process.exitCode, 1)
process.exitCode = 0
}
}
syncFail()
Expand All @@ -64,5 +66,7 @@ syncFail()
})
.catch(err => {
a.equal(err.message, 'broken')
a.equal(process.exitCode, 1)
process.exitCode = 0
})
}

0 comments on commit 77dd312

Please sign in to comment.