From f5a8c2b2df757886247492ce3372f1e18da36ab7 Mon Sep 17 00:00:00 2001 From: toddkcarlson Date: Sun, 16 Feb 2020 06:42:26 -0500 Subject: [PATCH] Improve error message when `test.cb()` is used with promises Fixes #2386 Co-authored-by: Mark Wubben --- lib/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/test.js b/lib/test.js index af5ae9f3c..02d68e940 100644 --- a/lib/test.js +++ b/lib/test.js @@ -594,7 +594,7 @@ class Test { if (this.metadata.callback) { if (returnedObservable || returnedPromise) { const asyncType = returnedObservable ? 'observables' : 'promises'; - this.saveFirstError(new Error(`Do not return ${asyncType} from tests declared via \`test.cb(...)\`, if you want to return a promise simply declare the test via \`test(...)\``)); + this.saveFirstError(new Error(`Do not return ${asyncType} from tests declared via \`test.cb(...)\`. Use \`test.cb(...)\` for legacy callback APIs. When using promises, observables or async functions, use \`test(...)\`.`)); return this.finishPromised(); }