@dragonshorn-studios/elyseum-cli 1.0.7 → 1.0.9

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.
@@ -1 +1 @@
1
- {"version":3,"file":"diff-coverage-command.d.ts","sourceRoot":"","sources":["../../src/commands/diff-coverage-command.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChD,OAAe,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAMjD,qBAAa,mBAAoB,YAAW,OAAO;IACjD,IAAI,EAAE,MAAM,CAAmB;IAC/B,MAAM,CAAC,EAAE,YAAY,CA2BnB;gBACU,QAAQ,EAAE,UAAU;IAInB,GAAG,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;YAqI5B,qBAAqB;YA2JrB,iBAAiB;YAajB,eAAe;CA4E9B"}
1
+ {"version":3,"file":"diff-coverage-command.d.ts","sourceRoot":"","sources":["../../src/commands/diff-coverage-command.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAChD,OAAe,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAMjD,qBAAa,mBAAoB,YAAW,OAAO;IACjD,IAAI,EAAE,MAAM,CAAmB;IAC/B,MAAM,CAAC,EAAE,YAAY,CA2BnB;gBACU,QAAQ,EAAE,UAAU;IAInB,GAAG,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;YAqI5B,qBAAqB;YA6KrB,iBAAiB;YAajB,eAAe;CA4E9B"}
package/dist/index.js CHANGED
@@ -25094,7 +25094,7 @@ class GithubPRCommentCoverageReporter {
25094
25094
  path: file.file,
25095
25095
  start_line: lineBlock.start,
25096
25096
  end_line: lineBlock.end,
25097
- annotation_level: "failure",
25097
+ annotation_level: qualityGateFailed ? "failure" : "warning",
25098
25098
  title: "Lines not covered",
25099
25099
  message: `Lines not covered`,
25100
25100
  });
@@ -25106,7 +25106,7 @@ class GithubPRCommentCoverageReporter {
25106
25106
  path: file.file,
25107
25107
  start_line: functionDetails.line,
25108
25108
  end_line: functionDetails.line,
25109
- annotation_level: "failure",
25109
+ annotation_level: qualityGateFailed ? "failure" : "warning",
25110
25110
  title: "Function not covered",
25111
25111
  message: `Function ${functionDetails.name} not covered`,
25112
25112
  });
@@ -25118,7 +25118,7 @@ class GithubPRCommentCoverageReporter {
25118
25118
  path: file.file,
25119
25119
  start_line: branchDetails.line,
25120
25120
  end_line: branchDetails.line,
25121
- annotation_level: "failure",
25121
+ annotation_level: qualityGateFailed ? "failure" : "warning",
25122
25122
  title: "Branch not covered",
25123
25123
  message: `Branch not covered`,
25124
25124
  });
@@ -25146,6 +25146,7 @@ class GithubPRCommentCoverageReporter {
25146
25146
  }
25147
25147
  error(message, details) {
25148
25148
  const annotationFilePath = Config$1.getInstance().getFirst(["reporter.coverage.github-pr-comment.annotation-file-path"], "coverage/github.pr.annotations.json");
25149
+ const commentName = Config$1.getInstance().getFirst(["reporter.coverage.github-pr-comment.comment-name"], "coverage/github.pr.coverage.md");
25149
25150
  if (!process.env.GITHUB_ACTIONS || !process.env.GITHUB_EVENT_NAME) {
25150
25151
  console.error("Not running in GitHub CI environment, skipping GitHub PR comment coverage reporter");
25151
25152
  return;
@@ -25153,7 +25154,7 @@ class GithubPRCommentCoverageReporter {
25153
25154
  let repoName = process.env.GITHUB_REPOSITORY || "";
25154
25155
  let repo = repoName.split("/")[1];
25155
25156
  let owner = repoName.split("/")[0];
25156
- let commentResultMd = `# Coverage Quality Gate\n\n> [!CAUTION]\n> ### Coverage Quality Gate Failed 🟥\n`;
25157
+ let commentResultMd = `# ${commentName}\n\n> [!CAUTION]\n> ### Coverage Quality Gate Failed 🟥\n`;
25157
25158
  commentResultMd += `> ${message}\n`;
25158
25159
  commentResultMd += `> ${JSON.stringify(details)}\n`;
25159
25160
  fs$1.writeFileSync(Config$1.getInstance().getFirst(["reporter.coverage.github-pr-comment.comment-file-path"], "coverage/github.pr.coverage.md"), commentResultMd);
@@ -54457,8 +54458,25 @@ class DiffCoverageCommand {
54457
54458
  let changedLineNumbers = new Set();
54458
54459
  let changedLineCount = 0;
54459
54460
  for (let hunk of file.diff.hunks) {
54461
+ let hunkLine = 0;
54460
54462
  for (let line = hunk.newStart; line < hunk.newStart + hunk.newLines; line++) {
54463
+ if (hunk.lines) {
54464
+ if (hunk.lines[hunkLine].startsWith("-")) {
54465
+ continue;
54466
+ }
54467
+ else if (hunk.lines[hunkLine].startsWith("+")) {
54468
+ // ignore comment lines
54469
+ const changedLine = hunk.lines[hunkLine].replace(/^\+/, "");
54470
+ if (changedLine.trim().startsWith("//") ||
54471
+ changedLine.trim() === "" ||
54472
+ changedLine.trim().startsWith("/*") ||
54473
+ changedLine.trim().startsWith("*")) {
54474
+ continue;
54475
+ }
54476
+ }
54477
+ }
54461
54478
  changedLineNumbers.add(line);
54479
+ hunkLine++;
54462
54480
  }
54463
54481
  changedLineCount += hunk.newLines;
54464
54482
  }