Skip to content

Commit

Permalink
Merge pull request #145 from MuckT/tomm/append-results-fix
Browse files Browse the repository at this point in the history
Fix Append Without Report Already Present
  • Loading branch information
Hargne authored Apr 27, 2022
2 parents e673e84 + 8fb9550 commit f954ac7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/htmlreporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -674,9 +674,10 @@ class HTMLReporter {
public async appendToFile(filePath: string, content: any) {
let parsedContent = content;
// Check if the file exists or not
const fileToAppend = await fs.readFileSync(filePath, "utf8");
const fileExists = fs.existsSync(filePath)
// The file exists - we need to strip all unnecessary html
if (fileToAppend) {
if (fileExists) {
const fileToAppend = await fs.readFileSync(filePath, "utf8");
const contentSearch = /<body>(.*?)<\/body>/gm.exec(content);
if (contentSearch) {
const [strippedContent] = contentSearch;
Expand Down

0 comments on commit f954ac7

Please sign in to comment.