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
This commit is contained in:
parent
118f37b174
commit
cee393d0da
|
@ -60,7 +60,8 @@ export function getDeclaration<T extends ts.Declaration>(
|
|||
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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue