Skip to content

Commit

Permalink
require output: only shorten the error message when it is the expecte…
Browse files Browse the repository at this point in the history
…d one
  • Loading branch information
karfau committed Jan 8, 2020
1 parent 2db21b0 commit c603b6b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const requireRunnable = (
}
return required
} catch (err) {
errors.push(err.message)
errors.push(err.message === `Cannot find module '${candidate}'` ? err.message : err)
}
}
console.error('No runnable module found:')
Expand Down
2 changes: 1 addition & 1 deletion test/implicit-exit-codes.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test('exits when no arguments are provided', async t => {
/**
* possible causes:
* - file not existing (extensions might added by node/ts-node)
* - requiring the file throws (e.g. syntax error) => TODO: shortened error message not ideal
* - requiring the file throws (e.g. syntax error)
*/
test('exits when module can not be required', async t => {
[
Expand Down

0 comments on commit c603b6b

Please sign in to comment.