Skip to content

Commit 1a00275

Browse files
committed
Add error
1 parent 31076c1 commit 1a00275

File tree

4 files changed

+41
-4
lines changed

4 files changed

+41
-4
lines changed

package-lock.json

Lines changed: 24 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"typescript": "^5.1.6"
3535
},
3636
"dependencies": {
37-
"@actions/core": "^1.10.0"
37+
"@actions/core": "^1.10.0",
38+
"ansi-to-html": "^0.7.2"
3839
},
3940
"peerDependencies": {
4041
"@playwright/test": "^1.37.0"

src/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@ import type {
33
FullConfig,
44
Suite,
55
TestCase,
6-
TestResult,
76
FullResult,
8-
TestStatus,
97
} from "@playwright/test/reporter";
108
import * as core from "@actions/core";
119
import { basename } from "path";
1210
import { getHtmlTable } from "./utils/getHtmlTable";
1311
import { getTableRows } from "./utils/getTableRows";
1412
import { checkForFailedTests } from "./utils/checkForFailedTests";
13+
import Convert from "ansi-to-html";
1514

1615
interface GitHubActionOptions {
1716
title?: string;

src/utils/getTableRows.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
import { SummaryTableRow } from "@actions/core/lib/summary";
22
import { TestCase } from "@playwright/test/reporter";
3+
import Convert from "ansi-to-html";
34

45
export const getTableRows = (tests: TestCase[]): SummaryTableRow[] => {
6+
const convert = new Convert();
7+
58
const tableRows = [
69
[
710
{
@@ -20,6 +23,10 @@ export const getTableRows = (tests: TestCase[]): SummaryTableRow[] => {
2023
data: "Retries",
2124
header: true,
2225
},
26+
{
27+
data: "Error",
28+
header: true,
29+
},
2330
],
2431
];
2532

@@ -44,6 +51,13 @@ export const getTableRows = (tests: TestCase[]): SummaryTableRow[] => {
4451
data: `${result.retry}`,
4552
header: false,
4653
},
54+
{
55+
data:
56+
result.error && result.error.message
57+
? convert.toHtml(result.error.message!)
58+
: "",
59+
header: false,
60+
},
4761
]);
4862
}
4963

0 commit comments

Comments
 (0)