From cee393d0da6c845d809b3549103e51c66c585ab9 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Sun, 27 Sep 2020 10:42:28 +0100 Subject: [PATCH] test(compiler-cli): improve error message if a unit test is bad (#38959) The message now also reports the name of the predicate function that failed. PR Close #38959 --- packages/compiler-cli/src/ngtsc/testing/src/utils.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/compiler-cli/src/ngtsc/testing/src/utils.ts b/packages/compiler-cli/src/ngtsc/testing/src/utils.ts index f2c84d263d..d1597de5a6 100644 --- a/packages/compiler-cli/src/ngtsc/testing/src/utils.ts +++ b/packages/compiler-cli/src/ngtsc/testing/src/utils.ts @@ -60,7 +60,8 @@ export function getDeclaration( throw new Error(`No such symbol: ${name} in ${fileName}`); } if (!assert(chosenDecl)) { - throw new Error(`Symbol ${name} from ${fileName} is a ${ts.SyntaxKind[chosenDecl.kind]}`); + throw new Error(`Symbol ${name} from ${fileName} is a ${ + ts.SyntaxKind[chosenDecl.kind]}. Expected it to pass predicate "${assert.name}()".`); } return chosenDecl; }