@code-pushup/coverage-plugin 0.49.0 → 0.50.0

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/bin.js CHANGED
@@ -671,6 +671,8 @@ var auditResultSchema = scorableWithPluginMetaSchema.merge(
671
671
  );
672
672
  var reportsDiffSchema = z15.object({
673
673
  commits: makeComparisonSchema(commitSchema).nullable().describe("Commits identifying compared reports"),
674
+ portalUrl: urlSchema.optional().describe("Link to comparison page in Code PushUp portal"),
675
+ label: z15.string().optional().describe("Label (e.g. project name)"),
674
676
  categories: makeArraysComparisonSchema(
675
677
  categoryDiffSchema,
676
678
  categoryResultSchema,
@@ -699,7 +701,9 @@ var reportsDiffSchema = z15.object({
699
701
  );
700
702
 
701
703
  // packages/utils/src/lib/execute-process.ts
702
- import { spawn } from "node:child_process";
704
+ import {
705
+ spawn
706
+ } from "node:child_process";
703
707
 
704
708
  // packages/utils/src/lib/reports/utils.ts
705
709
  import ansis from "ansis";
@@ -726,25 +730,29 @@ var ProcessError = class extends Error {
726
730
  }
727
731
  };
728
732
  function executeProcess(cfg) {
729
- const { observer, cwd, command, args, ignoreExitCode = false } = cfg;
730
- const { onStdout, onError, onComplete } = observer ?? {};
733
+ const { command, args, observer, ignoreExitCode = false, ...options } = cfg;
734
+ const { onStdout, onStderr, onError, onComplete } = observer ?? {};
731
735
  const date = (/* @__PURE__ */ new Date()).toISOString();
732
736
  const start = performance.now();
733
737
  return new Promise((resolve, reject) => {
734
- const process2 = spawn(command, args, { cwd, shell: true });
738
+ const spawnedProcess = spawn(command, args ?? [], {
739
+ shell: true,
740
+ ...options
741
+ });
735
742
  let stdout = "";
736
743
  let stderr = "";
737
- process2.stdout.on("data", (data) => {
744
+ spawnedProcess.stdout.on("data", (data) => {
738
745
  stdout += String(data);
739
- onStdout?.(String(data));
746
+ onStdout?.(String(data), spawnedProcess);
740
747
  });
741
- process2.stderr.on("data", (data) => {
748
+ spawnedProcess.stderr.on("data", (data) => {
742
749
  stderr += String(data);
750
+ onStderr?.(String(data), spawnedProcess);
743
751
  });
744
- process2.on("error", (err) => {
752
+ spawnedProcess.on("error", (err) => {
745
753
  stderr += err.toString();
746
754
  });
747
- process2.on("close", (code2) => {
755
+ spawnedProcess.on("close", (code2) => {
748
756
  const timings = { date, duration: calcDuration(start) };
749
757
  if (code2 === 0 || ignoreExitCode) {
750
758
  onComplete?.();
@@ -857,17 +865,23 @@ import { MultiProgressBars } from "multi-progress-bars";
857
865
  import { MarkdownDocument as MarkdownDocument3, md as md4 } from "build-md";
858
866
 
859
867
  // packages/utils/src/lib/reports/formatting.ts
860
- import { MarkdownDocument, md as md2 } from "build-md";
868
+ import {
869
+ MarkdownDocument,
870
+ md as md2
871
+ } from "build-md";
861
872
 
862
873
  // packages/utils/src/lib/reports/generate-md-report-categoy-section.ts
863
874
  import { MarkdownDocument as MarkdownDocument2, md as md3 } from "build-md";
864
875
 
865
876
  // packages/utils/src/lib/reports/generate-md-reports-diff.ts
866
877
  import {
867
- MarkdownDocument as MarkdownDocument4,
868
- md as md5
878
+ MarkdownDocument as MarkdownDocument5,
879
+ md as md6
869
880
  } from "build-md";
870
881
 
882
+ // packages/utils/src/lib/reports/generate-md-reports-diff-utils.ts
883
+ import { MarkdownDocument as MarkdownDocument4, md as md5 } from "build-md";
884
+
871
885
  // packages/utils/src/lib/reports/log-stdout-summary.ts
872
886
  import { bold as bold4, cyan, cyanBright, green as green2, red } from "ansis";
873
887
 
package/index.js CHANGED
@@ -670,6 +670,8 @@ var auditResultSchema = scorableWithPluginMetaSchema.merge(
670
670
  );
671
671
  var reportsDiffSchema = z15.object({
672
672
  commits: makeComparisonSchema(commitSchema).nullable().describe("Commits identifying compared reports"),
673
+ portalUrl: urlSchema.optional().describe("Link to comparison page in Code PushUp portal"),
674
+ label: z15.string().optional().describe("Label (e.g. project name)"),
673
675
  categories: makeArraysComparisonSchema(
674
676
  categoryDiffSchema,
675
677
  categoryResultSchema,
@@ -787,23 +789,29 @@ import { MultiProgressBars } from "multi-progress-bars";
787
789
  import { MarkdownDocument as MarkdownDocument3, md as md4 } from "build-md";
788
790
 
789
791
  // packages/utils/src/lib/reports/formatting.ts
790
- import { MarkdownDocument, md as md2 } from "build-md";
792
+ import {
793
+ MarkdownDocument,
794
+ md as md2
795
+ } from "build-md";
791
796
 
792
797
  // packages/utils/src/lib/reports/generate-md-report-categoy-section.ts
793
798
  import { MarkdownDocument as MarkdownDocument2, md as md3 } from "build-md";
794
799
 
795
800
  // packages/utils/src/lib/reports/generate-md-reports-diff.ts
796
801
  import {
797
- MarkdownDocument as MarkdownDocument4,
798
- md as md5
802
+ MarkdownDocument as MarkdownDocument5,
803
+ md as md6
799
804
  } from "build-md";
800
805
 
806
+ // packages/utils/src/lib/reports/generate-md-reports-diff-utils.ts
807
+ import { MarkdownDocument as MarkdownDocument4, md as md5 } from "build-md";
808
+
801
809
  // packages/utils/src/lib/reports/log-stdout-summary.ts
802
810
  import { bold as bold4, cyan, cyanBright, green as green2, red } from "ansis";
803
811
 
804
812
  // packages/plugin-coverage/package.json
805
813
  var name = "@code-pushup/coverage-plugin";
806
- var version = "0.49.0";
814
+ var version = "0.50.0";
807
815
 
808
816
  // packages/plugin-coverage/src/lib/config.ts
809
817
  import { z as z16 } from "zod";
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "@code-pushup/coverage-plugin",
3
- "version": "0.49.0",
3
+ "version": "0.50.0",
4
+ "description": "Code PushUp plugin for tracking code coverage ☂",
4
5
  "dependencies": {
5
- "@code-pushup/models": "0.49.0",
6
- "@code-pushup/utils": "0.49.0",
6
+ "@code-pushup/models": "0.50.0",
7
+ "@code-pushup/utils": "0.50.0",
7
8
  "ansis": "^3.3.0",
8
9
  "parse-lcov": "^1.0.4",
9
10
  "zod": "^3.22.4"
@@ -25,7 +26,7 @@
25
26
  }
26
27
  },
27
28
  "license": "MIT",
28
- "homepage": "https://github.com/code-pushup/cli#readme",
29
+ "homepage": "https://github.com/code-pushup/cli/tree/main/packages/plugin-coverage#readme",
29
30
  "bugs": {
30
31
  "url": "https://github.com/code-pushup/cli/issues"
31
32
  },
@@ -34,33 +35,6 @@
34
35
  "url": "git+https://github.com/code-pushup/cli.git",
35
36
  "directory": "packages/plugin-coverage"
36
37
  },
37
- "contributors": [
38
- {
39
- "name": "Igor Katsuba",
40
- "email": "igor@katsuba.dev",
41
- "url": "https://katsuba.dev"
42
- },
43
- {
44
- "name": "Kateřina Pilátová",
45
- "email": "katerina.pilatova@flowup.cz",
46
- "url": "https://github.com/Tlacenka"
47
- },
48
- {
49
- "name": "Matěj Chalk",
50
- "email": "matej.chalk@flowup.cz",
51
- "url": "https://github.com/matejchalk"
52
- },
53
- {
54
- "name": "Michael Hladky",
55
- "email": "michael.hladky@push-based.io",
56
- "url": "https://push-based.io"
57
- },
58
- {
59
- "name": "Michael Seredenko",
60
- "email": "misha.seredenko@push-based.io",
61
- "url": "https://github.com/MishaSeredenkoPushBased"
62
- }
63
- ],
64
38
  "type": "module",
65
39
  "main": "./index.js",
66
40
  "types": "./src/index.d.ts"
@@ -1,5 +1,5 @@
1
1
  import type { PluginConfig } from '@code-pushup/models';
2
- import { CoveragePluginConfig } from './config';
2
+ import { type CoveragePluginConfig } from './config';
3
3
  /**
4
4
  * Instantiates Code PushUp code coverage plugin for core config.
5
5
  *
@@ -1,7 +1,7 @@
1
1
  import type { ProjectConfiguration } from '@nx/devkit';
2
2
  import type { JestExecutorOptions } from '@nx/jest/src/executors/jest/schema';
3
3
  import type { VitestExecutorOptions } from '@nx/vite/executors';
4
- import { CoverageResult } from '../config';
4
+ import type { CoverageResult } from '../config';
5
5
  /**
6
6
  * @param targets nx targets to be used for measuring coverage, test by default
7
7
  * @returns An array of coverage result information for the coverage plugin.
@@ -1,4 +1,4 @@
1
1
  import type { RunnerConfig } from '@code-pushup/models';
2
- import { FinalCoveragePluginConfig } from '../config';
2
+ import type { FinalCoveragePluginConfig } from '../config';
3
3
  export declare function executeRunner(): Promise<void>;
4
4
  export declare function createRunnerConfig(scriptPath: string, config: FinalCoveragePluginConfig): Promise<RunnerConfig>;
@@ -1,6 +1,6 @@
1
1
  import type { LCOVRecord } from 'parse-lcov';
2
- import { AuditOutputs } from '@code-pushup/models';
3
- import { CoverageResult, CoverageType } from '../../config';
2
+ import type { AuditOutputs } from '@code-pushup/models';
3
+ import type { CoverageResult, CoverageType } from '../../config';
4
4
  /**
5
5
  *
6
6
  * @param results Paths to LCOV results
@@ -1,4 +1,4 @@
1
- import { BranchesDetails, FunctionsDetails, LCOVRecord, LinesDetails } from 'parse-lcov';
1
+ import type { BranchesDetails, FunctionsDetails, LCOVRecord, LinesDetails } from 'parse-lcov';
2
2
  export declare function mergeLcovResults(records: LCOVRecord[]): LCOVRecord[];
3
3
  export declare function mergeDuplicateLcovRecords(records: LCOVRecord[]): LCOVRecord;
4
4
  export declare function mergeLcovLineDetails(details: LinesDetails[][]): LinesDetails[];
@@ -1,7 +1,7 @@
1
- import { LCOVRecord } from 'parse-lcov';
2
- import { AuditOutput } from '@code-pushup/models';
3
- import { CoverageType } from '../../config';
4
- import { LCOVStat } from './types';
1
+ import type { LCOVRecord } from 'parse-lcov';
2
+ import type { AuditOutput } from '@code-pushup/models';
3
+ import type { CoverageType } from '../../config';
4
+ import type { LCOVStat } from './types';
5
5
  export declare function lcovReportToFunctionStat(record: LCOVRecord): LCOVStat;
6
6
  export declare function lcovReportToLineStat(record: LCOVRecord): LCOVStat;
7
7
  export declare function lcovReportToBranchStat(record: LCOVRecord): LCOVStat;
@@ -1,5 +1,5 @@
1
1
  import type { Issue } from '@code-pushup/models';
2
- import { CoverageType } from '../../config';
2
+ import type { CoverageType } from '../../config';
3
3
  export type LCOVStat = {
4
4
  totalFound: number;
5
5
  totalHit: number;
@@ -1,4 +1,4 @@
1
- import { NumberRange } from './types';
1
+ import type { NumberRange } from './types';
2
2
  /**
3
3
  * This function calculates coverage as ratio of tested entities vs total
4
4
  * @param hit how many entities were executed in at least one test
@@ -1,5 +1,5 @@
1
1
  import type { AuditOutputs } from '@code-pushup/models';
2
- import { CoverageType } from './config';
2
+ import type { CoverageType } from './config';
3
3
  export declare const coverageDescription: Record<CoverageType, string>;
4
4
  /**
5
5
  * Since more code coverage does not necessarily mean better score, this optional override allows for defining custom coverage goals.