test(compiler-cli): expand logging when extra compliance check fails (#39863)
Previously this would have just printed that `false` was not equal to `true`, which, although true, is not very helpful. This commit adds details about which special check failed together with the generated code, for easier debugging. PR Close #39863
This commit is contained in:
parent
e2040af412
commit
157d690704
|
@ -79,6 +79,10 @@ function runExtraChecks(
|
|||
`Unknown extra-check function: "${fnName}" in ${testPath}.\n` +
|
||||
`Possible choices are: ${Object.keys(EXTRA_CHECK_FUNCTIONS).map(f => `\n - ${f}`)}.`);
|
||||
}
|
||||
expect(fn(generated, ...args)).toBe(true);
|
||||
if (!fn(generated, ...args)) {
|
||||
throw new Error(
|
||||
`Extra check ${fnName}(${args.map(arg => JSON.stringify(arg)).join(',')}) in ${
|
||||
testPath} failed for generated code:\n\n${generated}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue