Skip to content

Commit d4c3f8d

Browse files
committed
Added error to HTML table
1 parent 1a00275 commit d4c3f8d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/utils/getHtmlTable.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { TestCase } from "@playwright/test/reporter";
2+
import Convert from "ansi-to-html";
23

34
export const getHtmlTable = (tests: TestCase[]): string => {
5+
const convert = new Convert();
6+
47
const content: string[] = [];
58

69
content.push(`<br>`);
@@ -11,6 +14,7 @@ export const getHtmlTable = (tests: TestCase[]): string => {
1114
content.push(`<th>Status</th>`);
1215
content.push(`<th>Duration</th>`);
1316
content.push(`<th>Retries</th>`);
17+
content.push(`<th>Error</th>`);
1418
content.push(`</tr>`);
1519
content.push(`</thead>`);
1620
content.push(`<tbody>`);
@@ -26,6 +30,13 @@ export const getHtmlTable = (tests: TestCase[]): string => {
2630
);
2731
content.push(`<td>${result.duration / 1000}s</td>`);
2832
content.push(`<td>${result.retry}</td>`);
33+
content.push(
34+
`<td>${
35+
result.error && result.error.message
36+
? convert.toHtml(result.error.message!)
37+
: ""
38+
}</td>`
39+
);
2940
content.push(`</tr>`);
3041
}
3142

0 commit comments

Comments
 (0)