Skip to content

Commit 89ac223

Browse files
authored
Merge pull request #16 from estruyf/dev
Update local summary location
2 parents ca7d5d0 + 96bab1a commit 89ac223

8 files changed

+40
-16
lines changed

Diff for: CHANGELOG.md

+5
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [1.8.0]
6+
7+
- Added `⏭️` icon for skipped tests
8+
- Added flaky test support
9+
510
## [1.7.0]
611

712
- [#14](https://github.com/estruyf/playwright-github-actions-reporter/issues/14): Added the `quiet` option to disable console logging + `stdErr` output support

Diff for: package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@estruyf/github-actions-reporter",
3-
"version": "1.7.0",
3+
"version": "1.8.0",
44
"description": "GitHub Actions reporter for Playwright",
55
"main": "dist/index.js",
66
"scripts": {

Diff for: src/utils/getTestStatus.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { getTestStatus } from "./getTestStatus";
22

33
describe("getTestStatus", () => {
4-
it("should return '⚠️ Pass' when test status is 'passed' and result retry is greater than 0", () => {
4+
it("should return '⚠️ Flaky' when test status is 'passed' and result retry is greater than 0", () => {
55
const test: any = {
66
outcome: () => "expected",
77
};
@@ -12,7 +12,7 @@ describe("getTestStatus", () => {
1212

1313
const status = getTestStatus(test, result);
1414

15-
expect(status).toBe("⚠️ Pass");
15+
expect(status).toBe("⚠️ Flaky");
1616
});
1717

1818
it("should return '✅ Pass' when test status is 'passed' and result retry is 0", () => {
@@ -29,7 +29,7 @@ describe("getTestStatus", () => {
2929
expect(status).toBe("✅ Pass");
3030
});
3131

32-
it("should return '️ Skipped' when test status is 'skipped'", () => {
32+
it("should return '️ Skipped' when test status is 'skipped'", () => {
3333
const test: any = {
3434
outcome: () => "expected",
3535
};
@@ -40,7 +40,7 @@ describe("getTestStatus", () => {
4040

4141
const status = getTestStatus(test, result);
4242

43-
expect(status).toBe("️ Skipped");
43+
expect(status).toBe("️ Skipped");
4444
});
4545

4646
it("should return '❌ Fail' when test status is not 'passed' or 'skipped'", () => {

Diff for: src/utils/getTestStatus.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ export const getTestStatus = (test: TestCase, result: TestResult) => {
77
let status = getTestOutcome(test, result);
88

99
if (status === "passed" && result.retry > 0) {
10-
value = `⚠️ Pass`;
10+
value = `⚠️ Flaky`;
1111
} else if (status === "passed") {
1212
value = "✅ Pass";
1313
} else if (status === "skipped") {
14-
value = `️ Skipped`;
14+
value = `️ Skipped`;
1515
} else {
1616
value = "❌ Fail";
1717
}

Diff for: src/utils/getTestStatusIcon.test.ts

+19-5
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,29 @@ import { getTestStatusIcon } from "./getTestStatusIcon";
33

44
describe("getTestStatusIcon", () => {
55
it("should return ✅ if all tests have passed", () => {
6-
const tests = [{ results: [{ status: "passed" }] }] as TestCase[];
6+
const tests = [
7+
{ results: [{ status: "passed" }], outcome: () => "expected" },
8+
] as TestCase[];
79

810
const result = getTestStatusIcon(tests);
911

1012
expect(result).toBe("✅");
1113
});
1214

13-
it("should return ⚠️ if any test has been skipped", () => {
14-
const tests = [{ results: [{ status: "skipped" }] }] as TestCase[];
15+
it("should return ⏭️ if any test has been skipped", () => {
16+
const tests = [
17+
{ results: [{ status: "skipped" }], outcome: () => "expected" },
18+
] as TestCase[];
1519

1620
const result = getTestStatusIcon(tests);
1721

18-
expect(result).toBe("⚠️");
22+
expect(result).toBe("");
1923
});
2024

2125
it("should return ❌ if any test has failed, interrupted, or timed out", () => {
22-
const tests = [{ results: [{ status: "failed" }] }] as TestCase[];
26+
const tests = [
27+
{ results: [{ status: "failed" }], outcome: () => "expected" },
28+
] as TestCase[];
2329

2430
const result = getTestStatusIcon(tests);
2531

@@ -41,4 +47,12 @@ describe("getTestStatusIcon", () => {
4147

4248
expect(result).toBe("❌");
4349
});
50+
51+
it("should return ⚠️ if any test is flaky", () => {
52+
const tests = [{ results: [{}], outcome: () => "flaky" }] as TestCase[];
53+
54+
const result = getTestStatusIcon(tests);
55+
56+
expect(result).toBe("⚠️");
57+
});
4458
});

Diff for: src/utils/getTestStatusIcon.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ export const getTestStatusIcon = (tests: TestCase[]) => {
88

99
const testOutcomes = tests.map((test) => {
1010
const lastResult = test.results[test.results.length - 1];
11+
const outcome = test.outcome();
12+
if (outcome === "flaky") {
13+
return "flaky";
14+
}
15+
1116
return getTestOutcome(test, lastResult);
1217
});
1318

@@ -17,7 +22,7 @@ export const getTestStatusIcon = (tests: TestCase[]) => {
1722
testOutcomes.includes("timedOut")
1823
) {
1924
return "❌";
20-
} else if (testOutcomes.includes("skipped")) {
25+
} else if (testOutcomes.includes("flaky")) {
2126
return "⚠️";
2227
}
2328

Diff for: src/utils/processResults.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const processResults = async (
1717
options: GitHubActionOptions
1818
) => {
1919
if (process.env.NODE_ENV === "development") {
20-
const summaryFile = join(__dirname, "../summary.html");
20+
const summaryFile = join(__dirname, "../../summary.html");
2121
if (existsSync(summaryFile)) {
2222
unlinkSync(summaryFile);
2323
}

0 commit comments

Comments
 (0)