@dragonshorn-studios/elyseum-cli 1.0.9 → 1.0.11

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;YA6KrB,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;YAuLrB,iBAAiB;YAajB,eAAe;CA4E9B"}
package/dist/index.js CHANGED
@@ -24993,6 +24993,10 @@ class GithubPRCommentCoverageReporter {
24993
24993
  type: "int",
24994
24994
  default: 50,
24995
24995
  },
24996
+ "fail-action-on-quality-gate": {
24997
+ help: "Mark the check as failed if the quality gate is not met",
24998
+ action: "store_true",
24999
+ },
24996
25000
  };
24997
25001
  }
24998
25002
  report(diffCoverage) {
@@ -25011,6 +25015,7 @@ class GithubPRCommentCoverageReporter {
25011
25015
  "reporter.coverage.quality-gate-fail",
25012
25016
  "reporter.coverage.github-pr-comment.quality-gate-fail",
25013
25017
  ], 50);
25018
+ const failActionOnQualityGate = Config$1.getInstance().getFirst(["reporter.coverage.github-pr-comment.fail-action-on-quality-gate"], false);
25014
25019
  const commentFilePath = Config$1.getInstance().getFirst(["reporter.coverage.github-pr-comment.comment-file-path"], "coverage/github.pr.coverage.md");
25015
25020
  const annotationFilePath = Config$1.getInstance().getFirst(["reporter.coverage.github-pr-comment.annotation-file-path"], "coverage/github.pr.annotations.json");
25016
25021
  let repoName = process.env.GITHUB_REPOSITORY || "";
@@ -25133,7 +25138,9 @@ class GithubPRCommentCoverageReporter {
25133
25138
  head_sha: diffCoverage.headSha,
25134
25139
  status: "completed",
25135
25140
  conclusion: qualityGateFailed
25136
- ? "failure"
25141
+ ? failActionOnQualityGate
25142
+ ? "failure"
25143
+ : "neutral"
25137
25144
  : qualityGateWarning
25138
25145
  ? "neutral"
25139
25146
  : "success",
@@ -54457,9 +54464,16 @@ class DiffCoverageCommand {
54457
54464
  }
54458
54465
  let changedLineNumbers = new Set();
54459
54466
  let changedLineCount = 0;
54467
+ let coverageFoundLineNumbers = new Set();
54468
+ for (let line of coverageData.lines.details) {
54469
+ coverageFoundLineNumbers.add(line.line);
54470
+ }
54460
54471
  for (let hunk of file.diff.hunks) {
54461
54472
  let hunkLine = 0;
54462
54473
  for (let line = hunk.newStart; line < hunk.newStart + hunk.newLines; line++) {
54474
+ if (!coverageFoundLineNumbers.has(line)) {
54475
+ continue; // this line is not taken into account in coverage
54476
+ }
54463
54477
  if (hunk.lines) {
54464
54478
  if (hunk.lines[hunkLine].startsWith("-")) {
54465
54479
  continue;
@@ -54478,8 +54492,9 @@ class DiffCoverageCommand {
54478
54492
  changedLineNumbers.add(line);
54479
54493
  hunkLine++;
54480
54494
  }
54481
- changedLineCount += hunk.newLines;
54482
54495
  }
54496
+ changedLineCount = changedLineNumbers.size;
54497
+ Logger.debug(`Changed line count for file ${normalizedPath}: ${changedLineCount}`);
54483
54498
  let coveredLines = 0;
54484
54499
  let coveredFunctions = 0;
54485
54500
  let totalFunctions = 0;