8 lines
1.0 KiB
TypeScript
8 lines
1.0 KiB
TypeScript
export const diagnosticSteps = ['management:login-banner', 'management:catalog-response', 'management:catalog-heading', 'management:membership-heading', 'management:unknown-stop', 'management:action-option', 'management:select-native', 'management:native-hint', 'management:identity-unchanged', 'management:inert-controls', 'management:logout'] as const;
|
|
export function diagnostic(label: string, error: { name?: string; message?: string } | undefined, line: number | undefined): string | null {
|
|
if (!error || !diagnosticSteps.some(step => step === label)) return null;
|
|
const name = ['Error', 'TimeoutError', 'TypeError', 'AssertionError', 'TestTimeoutError'].includes(error.name ?? '') ? error.name : 'Error';
|
|
const kind = /Timeout|timed out|timeout/i.test(error.message ?? '') ? 'timeout' : /expect\(|Assertion/i.test(error.message ?? '') ? 'assertion' : 'exception';
|
|
return `failure_step=${label} exception=${name} kind=${kind} source_line=${Number.isSafeInteger(line) && Number(line) > 0 ? line : 'unknown'}`;
|
|
}
|