@@ -10,8 +10,10 @@ import * as core from "@actions/core";
1010import { basename } from "path" ;
1111import { getHtmlTable } from "./utils/getHtmlTable" ;
1212import { 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" ;
1517
1618interface GitHubActionOptions {
1719 title ?: string ;
@@ -39,6 +41,16 @@ class GitHubAction implements Reporter {
3941 }
4042
4143 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+
4254 if ( process . env . GITHUB_ACTIONS && this . suite ) {
4355 const os = process . platform ;
4456 const summary = core . summary ;
@@ -84,10 +96,10 @@ class GitHubAction implements Reporter {
8496 ) ;
8597
8698 // Check if there are any failed tests
87- const hasFailedTests = checkForFailedTests ( tests [ filePath ] ) ;
99+ const testStatusIcon = getTestStatusIcon ( tests [ filePath ] ) ;
88100
89101 summary . addDetails (
90- `${ hasFailedTests ? "❌" : "✅" } ${ fileName } (${ os } ${
102+ `${ testStatusIcon } ${ fileName } (${ os } ${
91103 project ! . name ? ` / ${ project ! . name } ` : ""
92104 } )`,
93105 content
0 commit comments