Skip to content

Commit

Permalink
#11 - Unset header
Browse files Browse the repository at this point in the history
  • Loading branch information
estruyf committed Mar 8, 2024
1 parent d5dea29 commit 622faf3
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ The reporter supports the following configuration options:

| Option | Description | Default |
| --- | --- | --- |
| title | Title of the report | `Test results` |
| title | Title of the report. Use an empty string (`""`) to remove the heading. | `Test results` |
| useDetails | Use details in summary which creates expandable content | `false` |
| showAnnotations | Show annotations from tests | `true` |
| showTags | Show tags from tests | `true` |
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,7 @@ const config: PlaywrightTestConfig<{}, {}> = {
showError: true,
},
],
[
"./src/index.ts",
{ title: "Reporter testing with details", useDetails: true },
],
["./src/index.ts", { title: "", useDetails: true }],
],
use: {
actionTimeout: 0,
Expand Down
13 changes: 10 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ class GitHubAction implements Reporter {

onStdOut(
chunk: string | Buffer,
test: void | TestCase,
result: void | TestResult
_: void | TestCase,
__: void | TestResult
): void {
console.log(chunk.toString());
}
Expand All @@ -75,7 +75,14 @@ class GitHubAction implements Reporter {
if (process.env.GITHUB_ACTIONS && this.suite) {
const os = process.platform;
const summary = core.summary;
summary.addHeading(this.options.title || `Test results`, 1);

const summaryTitle =
typeof this.options.title === "undefined"
? "Test results"
: this.options.title;
if (summaryTitle) {
summary.addHeading(summaryTitle, 1);
}

const totalStatus = getTotalStatus(this.suite?.suites);

Expand Down

0 comments on commit 622faf3

Please sign in to comment.