1
0
Fork 0

flatten error prefix logic

This commit is contained in:
ssube 2021-07-22 15:03:02 -05:00
parent a284288312
commit 5451fa6d92
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
1 changed files with 5 additions and 6 deletions

View File

@ -67,15 +67,14 @@ export function formatExamples<T>(details: RunDetails<[T]>): string {
} else {
return `without counterexamples (seed: ${details.seed})`;
}
}
export function formatPrefix<T>(details: RunDetails<[T]>): string {
if (isString(details.error)) {
if (isErrorRun(details)) {
return 'Property failed by throwing an error';
}
if (isErrorRun(details)) {
return 'Property failed by throwing an error';
}
if (isString(details.error)) {
return details.error;
}
@ -87,7 +86,7 @@ export function isString(val: unknown): val is string {
}
export function isErrorRun<T>(details: RunDetails<T>): boolean {
if (details.error) {
if (isString(details.error)) {
return /^([A-Z][a-z]*)*Error:/.test(details.error);
}
return false;