@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.cjs.js CHANGED
@@ -18464,6 +18464,7 @@ const attemptsApi = { create: create$2, update: update$1 };
18464
18464
  const ERRORS = {
18465
18465
  onBegin: {
18466
18466
  failedToGetCommitSha: "Failed to get current commit SHA.",
18467
+ failedToGetBranch: "Failed to get current branch.",
18467
18468
  failedToGetCommitMessage: "Failed to get current commit message.",
18468
18469
  failedToInitializeRun: "Failed to initialize run in reporter",
18469
18470
  },
@@ -18539,6 +18540,10 @@ const getCurrentCommitMessage = () => executeCommandLine({
18539
18540
  command: "git show-branch --no-name HEAD",
18540
18541
  messageOnError: ERRORS.onBegin.failedToGetCommitMessage,
18541
18542
  });
18543
+ const getCurrentBranch = () => executeCommandLine({
18544
+ command: "git branch --show-current",
18545
+ messageOnError: ERRORS.onBegin.failedToGetBranch,
18546
+ });
18542
18547
  const getInitializerData = ({ rootDir }, rootSuite) => rootSuite.allTests().map(test => {
18543
18548
  var _a;
18544
18549
  const { title, parent, id: history_id, location: { file }, } = test;
@@ -18587,6 +18592,7 @@ class MyReporter {
18587
18592
  const runDetails = {
18588
18593
  commit_id: getCurrentCommitSha(),
18589
18594
  commit_name: getCurrentCommitMessage(),
18595
+ branch: getCurrentBranch(),
18590
18596
  ci_build_id: this.ciBuildId,
18591
18597
  configuration: config,
18592
18598
  shards: createShardObject({ currentShard: shard === null || shard === void 0 ? void 0 : shard.current }),
@@ -18617,6 +18623,7 @@ class MyReporter {
18617
18623
  try {
18618
18624
  const formData = new FormData();
18619
18625
  formData.append("attempt[status]", "running");
18626
+ formData.append("attempt[started_at]", new Date().toString());
18620
18627
  retry === 0 &&
18621
18628
  (await attemptsApi.update(this.ciBuildId, id, this.attempts[id], formData));
18622
18629
  }
@@ -18625,9 +18632,12 @@ class MyReporter {
18625
18632
  consoleLogFormatted.error(ERRORS.onTestBegin.failedToReportTest(title, id));
18626
18633
  }
18627
18634
  };
18628
- this.onTestEnd = async ({ id, title }, { status, duration, errors, retry, attachments }) => {
18635
+ this.onTestEnd = async (testCase, { status, duration, errors, retry, attachments }) => {
18636
+ const { id, title, expectedStatus } = testCase;
18629
18637
  try {
18630
18638
  const testResult = {
18639
+ outcome: testCase.outcome(),
18640
+ expected_status: expectedStatus,
18631
18641
  status,
18632
18642
  duration,
18633
18643
  log: errors.map(error => { var _a; return (_a = error.message) !== null && _a !== void 0 ? _a : ""; }).join("\n"),
@@ -18644,6 +18654,8 @@ class MyReporter {
18644
18654
  Object.entries(testResult).map(([resultKey, resultValue]) => {
18645
18655
  formData.append(`attempt[${resultKey}]`, resultValue.toString());
18646
18656
  });
18657
+ retry !== 0 &&
18658
+ formData.append("attempt[started_at]", new Date().toString());
18647
18659
  retry === 0
18648
18660
  ? await attemptsApi.update(this.ciBuildId, id, this.attempts[id], formData)
18649
18661
  : await attemptsApi.create(this.ciBuildId, id, formData);