Вы можете добавить описание в ToBeTruthy
следующим образом:
expect(htmlValue == excelValue || (htmlValue === "0" && excelValue == "NaN")).toBeTruthy("description why I checked this")
Если хотите, вы можете отобразить ошибочные тестовые значения следующим образом:
expect(
htmlValue == excelValue || (htmlValue === '0' && excelValue == 'NaN'),
).toBeTruthy(
`HTML differ form Excel. HTML: ${htmlValue}; Excel: ${excelValue}`,
);
Практически любой жасмин Matchers
принимает expectationFailOuput
параметр:
toBe(expected: any, expectationFailOutput?: any): Promise<void>;
toEqual(expected: any, expectationFailOutput?: any): Promise<void>;
toMatch(expected: string | RegExp | Promise<string | RegExp>, expectationFailOutput?: any): Promise<void>;
toBeDefined(expectationFailOutput?: any): Promise<void>;
toBeUndefined(expectationFailOutput?: any): Promise<void>;
toBeNull(expectationFailOutput?: any): Promise<void>;
toBeTruthy(expectationFailOutput?: any): Promise<void>;
toBeFalsy(expectationFailOutput?: any): Promise<void>;
toContain(expected: any, expectationFailOutput?: any): Promise<void>;
toBeLessThan(expected: number | Promise<number>, expectationFailOutput?: any): Promise<void>;
toBeLessThanOrEqual(expected: number | Promise<number>, expectationFailOutput?: any): Promise<void>;
toBeGreaterThan(expected: number | Promise<number>, expectationFailOutput?: any): Promise<void>;
toBeGreaterThanOrEqual(expected: number | Promise<number>, expectationFailOutput?: any): Promise<void>;
toBeCloseTo(expected: number | Promise<number>, precision?: any, expectationFailOutput?: any): Promise<void>;
Вы найдете определение Matchers в jasminewd2 депо