From d68cea501c67ec5b3c374a2f27d4abdd5f755659 Mon Sep 17 00:00:00 2001 From: Ian Walter Date: Tue, 23 Apr 2019 11:22:16 -0400 Subject: [PATCH] Fixing #32: Log test name on expectation failure --- index.js | 4 ++-- worker.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 371a0c4a..77c2d4f0 100644 --- a/index.js +++ b/index.js @@ -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 { diff --git a/worker.js b/worker.js index 44643ce8..15871e5b 100644 --- a/worker.js +++ b/worker.js @@ -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 @@ -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)