@empiricalrun/reporter
Advanced tools
Comparing version 0.9.2 to 0.11.0
# @empiricalrun/reporter | ||
## 0.11.0 | ||
### Minor Changes | ||
- 48720c0: feat: add support for reporter message to be available in dashboard | ||
## 0.10.1 | ||
### Patch Changes | ||
- 5f343f0: feat: trigger inngest event from create test-run call | ||
## 0.10.0 | ||
### Minor Changes | ||
- bc0d594: feat: expose api to trigger inngest event | ||
## 0.9.2 | ||
@@ -4,0 +22,0 @@ |
import { BaseReportSource, Platform } from "../sources/base"; | ||
import { ReportSink } from "../types"; | ||
export declare class DashboardSink implements ReportSink { | ||
import { DashboardSink } from "./base/dashboard"; | ||
export declare class DashboardReportSink extends DashboardSink implements ReportSink { | ||
private reportSummaryUrl; | ||
@@ -18,5 +19,4 @@ private runLink; | ||
sendTestGenFinished(): Promise<void>; | ||
private send; | ||
sendTestRunToDb(): Promise<void>; | ||
} | ||
//# sourceMappingURL=dashboard.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DashboardSink = void 0; | ||
exports.DashboardReportSink = void 0; | ||
const utils_1 = require("../utils"); | ||
const dashboard_1 = require("./base/dashboard"); | ||
const DOMAIN = process.env.DASHBOARD_DOMAIN || "https://test-generator-dashboard.vercel.app"; | ||
class DashboardSink { | ||
class DashboardReportSink extends dashboard_1.DashboardSink { | ||
reportSummaryUrl; | ||
@@ -16,2 +17,3 @@ runLink; | ||
constructor(reportSummaryUrl, runLink, runId, reportSource, prLink, projectName, runBranch, plaform) { | ||
super(); | ||
this.reportSummaryUrl = reportSummaryUrl; | ||
@@ -78,20 +80,3 @@ this.runLink = runLink; | ||
} | ||
async send(message) { | ||
try { | ||
const body = JSON.stringify(message); | ||
await fetch(`${DOMAIN}/api/github/updates`, { | ||
method: "POST", | ||
headers: { | ||
"Content-Type": "application/json", | ||
// TODO: fix this with authentication of github updates api | ||
Authorization: "weQPMWKT", | ||
}, | ||
body, | ||
}); | ||
} | ||
catch (e) { | ||
console.error(`Error sending message to Dashboard: ${e.code}`); | ||
console.error(e.message); | ||
} | ||
} | ||
// TODO: figure out a way to move this to | ||
async sendTestRunToDb() { | ||
@@ -126,2 +111,2 @@ try { | ||
} | ||
exports.DashboardSink = DashboardSink; | ||
exports.DashboardReportSink = DashboardReportSink; |
@@ -10,2 +10,3 @@ export declare enum WorkflowType { | ||
send(message: any): Promise<void>; | ||
sendUsingMessageBuilder(messageBuilder: MessageBuilder): Promise<void>; | ||
} | ||
@@ -30,2 +31,17 @@ export interface ReportSink { | ||
} | ||
export type DashboardMessagePayload = { | ||
message: string; | ||
pull_request?: string; | ||
testCaseName?: string; | ||
projectRepoName?: string; | ||
testSessionId?: number; | ||
}; | ||
export interface MessageBuilder { | ||
buildDashboardMessage(payload?: { | ||
override?: Partial<DashboardMessagePayload>; | ||
}): DashboardMessagePayload; | ||
} | ||
export interface Reporter { | ||
report(messageBuilder: MessageBuilder): Promise<void>; | ||
} | ||
//# sourceMappingURL=index.d.ts.map |
@@ -31,3 +31,3 @@ "use strict"; | ||
// TODO: add slack / google chat sinks | ||
const sink = new dashboard_1.DashboardSink("", runLink, runId, undefined, prLink); | ||
const sink = new dashboard_1.DashboardReportSink("", runLink, runId, undefined, prLink); | ||
// dispatch sink | ||
@@ -34,0 +34,0 @@ if (messageType === "end") { |
@@ -65,3 +65,3 @@ "use strict"; | ||
const prLink = isAutomatedPr ? (0, utils_1.getGhEventPrLink)(projectName) : undefined; | ||
const dashboardSinkInstance = new dashboard_1.DashboardSink(summaryReportUrl, runLink, runId, reportSource, prLink, projectName, runBranch, platform); | ||
const dashboardSinkInstance = new dashboard_1.DashboardReportSink(summaryReportUrl, runLink, runId, reportSource, prLink, projectName, runBranch, platform); | ||
// when test-run is triggered by a PR created by test-gen package | ||
@@ -68,0 +68,0 @@ if (isAutomatedPr) { |
{ | ||
"name": "@empiricalrun/reporter", | ||
"version": "0.9.2", | ||
"version": "0.11.0", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "registry": "https://registry.npmjs.org/", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
64126
54
1421