@bigbinary/neeto-playwright-reporter 1.2.0 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.d.ts CHANGED
@@ -13,7 +13,7 @@ declare class MyReporter implements Reporter {
13
13
  constructor(options: ReporterOptionParams);
14
14
  onBegin: (config: FullConfig, rootSuite: Suite) => Promise<void>;
15
15
  onTestBegin: ({ id, title }: TestCase, { retry }: TestResult) => Promise<void>;
16
- onTestEnd: ({ id, title }: TestCase, { status, duration, errors, retry, attachments }: TestResult) => Promise<void>;
16
+ onTestEnd: (testCase: TestCase, { status, duration, errors, retry, attachments }: TestResult) => Promise<void>;
17
17
  onEnd: ({ status, duration }: FullResult) => Promise<void>;
18
18
  }
19
19
 
package/index.js CHANGED
@@ -18446,6 +18446,7 @@ const attemptsApi = { create: create$2, update: update$1 };
18446
18446
  const ERRORS = {
18447
18447
  onBegin: {
18448
18448
  failedToGetCommitSha: "Failed to get current commit SHA.",
18449
+ failedToGetBranch: "Failed to get current branch.",
18449
18450
  failedToGetCommitMessage: "Failed to get current commit message.",
18450
18451
  failedToInitializeRun: "Failed to initialize run in reporter",
18451
18452
  },
@@ -18521,6 +18522,10 @@ const getCurrentCommitMessage = () => executeCommandLine({
18521
18522
  command: "git show-branch --no-name HEAD",
18522
18523
  messageOnError: ERRORS.onBegin.failedToGetCommitMessage,
18523
18524
  });
18525
+ const getCurrentBranch = () => executeCommandLine({
18526
+ command: "git branch --show-current",
18527
+ messageOnError: ERRORS.onBegin.failedToGetBranch,
18528
+ });
18524
18529
  const getInitializerData = ({ rootDir }, rootSuite) => rootSuite.allTests().map(test => {
18525
18530
  var _a;
18526
18531
  const { title, parent, id: history_id, location: { file }, } = test;
@@ -18569,6 +18574,7 @@ class MyReporter {
18569
18574
  const runDetails = {
18570
18575
  commit_id: getCurrentCommitSha(),
18571
18576
  commit_name: getCurrentCommitMessage(),
18577
+ branch: getCurrentBranch(),
18572
18578
  ci_build_id: this.ciBuildId,
18573
18579
  configuration: config,
18574
18580
  shards: createShardObject({ currentShard: shard === null || shard === void 0 ? void 0 : shard.current }),
@@ -18599,6 +18605,7 @@ class MyReporter {
18599
18605
  try {
18600
18606
  const formData = new FormData();
18601
18607
  formData.append("attempt[status]", "running");
18608
+ formData.append("attempt[started_at]", new Date().toString());
18602
18609
  retry === 0 &&
18603
18610
  (await attemptsApi.update(this.ciBuildId, id, this.attempts[id], formData));
18604
18611
  }
@@ -18607,9 +18614,12 @@ class MyReporter {
18607
18614
  consoleLogFormatted.error(ERRORS.onTestBegin.failedToReportTest(title, id));
18608
18615
  }
18609
18616
  };
18610
- this.onTestEnd = async ({ id, title }, { status, duration, errors, retry, attachments }) => {
18617
+ this.onTestEnd = async (testCase, { status, duration, errors, retry, attachments }) => {
18618
+ const { id, title, expectedStatus } = testCase;
18611
18619
  try {
18612
18620
  const testResult = {
18621
+ outcome: testCase.outcome(),
18622
+ expected_status: expectedStatus,
18613
18623
  status,
18614
18624
  duration,
18615
18625
  log: errors.map(error => { var _a; return (_a = error.message) !== null && _a !== void 0 ? _a : ""; }).join("\n"),
@@ -18626,6 +18636,8 @@ class MyReporter {
18626
18636
  Object.entries(testResult).map(([resultKey, resultValue]) => {
18627
18637
  formData.append(`attempt[${resultKey}]`, resultValue.toString());
18628
18638
  });
18639
+ retry !== 0 &&
18640
+ formData.append("attempt[started_at]", new Date().toString());
18629
18641
  retry === 0
18630
18642
  ? await attemptsApi.update(this.ciBuildId, id, this.attempts[id], formData)
18631
18643
  : await attemptsApi.create(this.ciBuildId, id, formData);