Skip to content

Commit

Permalink
Fixing #32: Log test name on expectation failure
Browse files Browse the repository at this point in the history
  • Loading branch information
Ian Walter committed Apr 23, 2019
1 parent 9f3ec7b commit d68cea5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ function run (config) {
} catch (err) {
if (err.name === 'TimeoutError') {
print.error(
`Timeout in test '${test.name}'`,
`${test.name}: timeout`,
chalk.gray(path.relative(process.cwd(), file))
)
} else {
print.error(err)
print.error(`${test.name}:`, err)
}
context.failed++
} finally {
Expand Down
4 changes: 2 additions & 2 deletions worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ worker({
...test,
expect,
fail (msg) {
throw new Error(msg || `Manual failure in test '${test.name}'`)
throw new Error(msg || 'manual failure')
},
pass () {
result.passed = true
Expand Down Expand Up @@ -107,7 +107,7 @@ worker({

// If there were no assertions executed, fail the test.
if (!result.passed && assertionCalls === 0) {
throw new Error(`No assertions in test '${test.name}'`)
throw new Error('no assertions made')
}

// If expect has a suppressed error (e.g. a snapshot did not match)
Expand Down

0 comments on commit d68cea5

Please # to comment.