Skip to content

Commit b777462

Browse files
committed
removing static function
1 parent 064ba03 commit b777462

File tree

3 files changed

+24
-12
lines changed

3 files changed

+24
-12
lines changed

browserstack-report-action/dist/index.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38206,7 +38206,9 @@ async function run() {
3820638206
);
3820738207
}
3820838208

38209-
await ReportProcessor.processReport(reportData);
38209+
const reportProcessor = new ReportProcessor(reportData);
38210+
await reportProcessor.processReport();
38211+
core.info('Report processing completed successfully');
3821038212
} catch (error) {
3821138213
core.setFailed(`Action failed: ${error.message}`);
3821238214
}
@@ -38670,19 +38672,23 @@ const core = __nccwpck_require__(7484);
3867038672
const UploadFileForArtifact = __nccwpck_require__(8751);
3867138673

3867238674
class ReportProcessor {
38673-
static async processReport(reportData) {
38675+
constructor(reportData) {
38676+
this.reportData = reportData;
38677+
}
38678+
38679+
async processReport() {
3867438680
try {
3867538681
const { summary } = core;
3867638682
await summary.addHeading('BrowserStack Test Report');
3867738683

38678-
if (reportData?.report?.basicHtml) {
38679-
await summary.addRaw(`<html>${reportData.report.basicHtml}</html>`);
38684+
if (this.reportData?.report?.basicHtml) {
38685+
await summary.addRaw(`<html>${this.reportData.report.basicHtml}</html>`);
3868038686
} else {
3868138687
await summary.addRaw('⚠️ No report content available');
3868238688
}
3868338689
summary.write();
38684-
if (reportData?.report?.richHtml) {
38685-
const report = `<!DOCTYPE html> <html><head><style>${reportData?.report?.richCss}</style></head> ${reportData?.report?.richHtml}</html>`;
38690+
if (this.reportData?.report?.richHtml) {
38691+
const report = `<!DOCTYPE html> <html><head><style>${this.reportData?.report?.richCss}</style></head> ${this.reportData?.report?.richHtml}</html>`;
3868638692
const artifactObj = new UploadFileForArtifact(report);
3868738693
await artifactObj.saveReportInFile();
3868838694
}

browserstack-report-action/src/main.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ async function run() {
5555
);
5656
}
5757

58-
await ReportProcessor.processReport(reportData);
58+
const reportProcessor = new ReportProcessor(reportData);
59+
await reportProcessor.processReport();
60+
core.info('Report processing completed successfully');
5961
} catch (error) {
6062
core.setFailed(`Action failed: ${error.message}`);
6163
}

browserstack-report-action/src/services/ReportProcessor.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,23 @@ const core = require('@actions/core');
22
const UploadFileForArtifact = require('../utils/UploadFileForArtifact');
33

44
class ReportProcessor {
5-
static async processReport(reportData) {
5+
constructor(reportData) {
6+
this.reportData = reportData;
7+
}
8+
9+
async processReport() {
610
try {
711
const { summary } = core;
812
await summary.addHeading('BrowserStack Test Report');
913

10-
if (reportData?.report?.basicHtml) {
11-
await summary.addRaw(`<html>${reportData.report.basicHtml}</html>`);
14+
if (this.reportData?.report?.basicHtml) {
15+
await summary.addRaw(`<html>${this.reportData.report.basicHtml}</html>`);
1216
} else {
1317
await summary.addRaw('⚠️ No report content available');
1418
}
1519
summary.write();
16-
if (reportData?.report?.richHtml) {
17-
const report = `<!DOCTYPE html> <html><head><style>${reportData?.report?.richCss}</style></head> ${reportData?.report?.richHtml}</html>`;
20+
if (this.reportData?.report?.richHtml) {
21+
const report = `<!DOCTYPE html> <html><head><style>${this.reportData?.report?.richCss}</style></head> ${this.reportData?.report?.richHtml}</html>`;
1822
const artifactObj = new UploadFileForArtifact(report);
1923
await artifactObj.saveReportInFile();
2024
}

0 commit comments

Comments
 (0)