@@ -10,8 +10,10 @@ import * as core from "@actions/core";
10
10
import { basename } from "path" ;
11
11
import { getHtmlTable } from "./utils/getHtmlTable" ;
12
12
import { getTableRows } from "./utils/getTableRows" ;
13
- import { checkForFailedTests } from "./utils/checkForFailedTests" ;
14
- import Convert from "ansi-to-html" ;
13
+ import { getTestStatusIcon } from "./utils/getTestStatusIcon" ;
14
+ import { SUMMARY_ENV_VAR } from "@actions/core/lib/summary" ;
15
+ import { join } from "path" ;
16
+ import { existsSync , unlinkSync , writeFileSync } from "fs" ;
15
17
16
18
interface GitHubActionOptions {
17
19
title ?: string ;
@@ -39,6 +41,16 @@ class GitHubAction implements Reporter {
39
41
}
40
42
41
43
async onEnd ( result : FullResult ) {
44
+ if ( process . env . NODE_ENV === "development" ) {
45
+ const summaryFile = join ( __dirname , "../summary.html" ) ;
46
+ if ( existsSync ( summaryFile ) ) {
47
+ unlinkSync ( summaryFile ) ;
48
+ }
49
+ writeFileSync ( summaryFile , "" , "utf-8" ) ;
50
+ process . env [ SUMMARY_ENV_VAR ] = summaryFile ;
51
+ process . env . GITHUB_ACTIONS = "true" ;
52
+ }
53
+
42
54
if ( process . env . GITHUB_ACTIONS && this . suite ) {
43
55
const os = process . platform ;
44
56
const summary = core . summary ;
@@ -84,10 +96,10 @@ class GitHubAction implements Reporter {
84
96
) ;
85
97
86
98
// Check if there are any failed tests
87
- const hasFailedTests = checkForFailedTests ( tests [ filePath ] ) ;
99
+ const testStatusIcon = getTestStatusIcon ( tests [ filePath ] ) ;
88
100
89
101
summary . addDetails (
90
- `${ hasFailedTests ? "❌" : "✅" } ${ fileName } (${ os } ${
102
+ `${ testStatusIcon } ${ fileName } (${ os } ${
91
103
project ! . name ? ` / ${ project ! . name } ` : ""
92
104
} )`,
93
105
content
0 commit comments