Finally block silents errors causing false-positive 0 exit code
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 3k
- Forks
- 101
- PR merge metrics
- No merged PRs in 30d
Description
[the finally block in runner function](https://github.com/lukeed/uvu/blob/0f9dfb7df31d55d063ef7a1e943499f9f89ef97a/src/index.js#L83) silents every error which is thrown outside the inner `try` block.
Example:
```
import { test } from 'uvu'
test.before(() => {
throw Error()
})
test('foo', () => {
})
test.run()
```
although the console output correctly shows that 0 tests passed, the process exits with false-positive exit code 0 and prints no error
besides hooks, also internal errors may cause this, e.g. a [function for error formatting](https://github.com/lukeed/uvu/blob/0f9dfb7df31d55d063ef7a1e943499f9f89ef97a/src/index.js#L48) fails, when a string is passed as an error (`throw 'error string'`)
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/index.js at the runner's finally block around line 83, then inspect the error-formatting function around line 48. Reproduce the failing hook and string-thrown-error examples; done means these errors are reported and the process exits with a nonzero code instead of a false-positive 0.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100