@code-pushup/coverage-plugin 0.53.1 → 0.55.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.
Files changed (3) hide show
  1. package/bin.js +13 -19
  2. package/index.js +15 -22
  3. package/package.json +6 -6
package/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // packages/plugin-coverage/src/lib/runner/index.ts
2
2
  import { bold as bold5 } from "ansis";
3
3
  import { writeFile } from "node:fs/promises";
4
- import { dirname } from "node:path";
4
+ import { dirname as dirname2 } from "node:path";
5
5
 
6
6
  // packages/models/src/lib/implementation/schemas.ts
7
7
  import { MATERIAL_ICONS } from "vscode-material-icons";
@@ -34,7 +34,7 @@ function exists(value) {
34
34
  return value != null;
35
35
  }
36
36
  function getMissingRefsForCategories(categories, plugins) {
37
- if (categories.length === 0) {
37
+ if (!categories || categories.length === 0) {
38
38
  return false;
39
39
  }
40
40
  const auditRefsFromCategory = categories.flatMap(
@@ -111,7 +111,6 @@ var fileNameSchema = z.string().trim().regex(filenameRegex, {
111
111
  message: `The filename has to be valid`
112
112
  }).min(1, { message: "file name is invalid" });
113
113
  var positiveIntSchema = z.number().int().positive();
114
- var nonnegativeIntSchema = z.number().int().nonnegative();
115
114
  var nonnegativeNumberSchema = z.number().nonnegative();
116
115
  function packageVersionSchema(options) {
117
116
  const { versionDescription = "NPM version of the package", required } = options ?? {};
@@ -534,12 +533,9 @@ var unrefinedCoreConfigSchema = z14.object({
534
533
  var coreConfigSchema = refineCoreConfig(unrefinedCoreConfigSchema);
535
534
  function refineCoreConfig(schema) {
536
535
  return schema.refine(
537
- (coreCfg) => !getMissingRefsForCategories(coreCfg.categories ?? [], coreCfg.plugins),
538
- (coreCfg) => ({
539
- message: missingRefsForCategoriesErrorMsg(
540
- coreCfg.categories ?? [],
541
- coreCfg.plugins
542
- )
536
+ ({ categories, plugins }) => !getMissingRefsForCategories(categories, plugins),
537
+ ({ categories, plugins }) => ({
538
+ message: missingRefsForCategoriesErrorMsg(categories, plugins)
543
539
  })
544
540
  );
545
541
  }
@@ -591,19 +587,16 @@ var reportSchema = packageVersionSchema({
591
587
  ).merge(
592
588
  z15.object(
593
589
  {
594
- categories: z15.array(categoryConfigSchema),
595
590
  plugins: z15.array(pluginReportSchema).min(1),
591
+ categories: z15.array(categoryConfigSchema).optional(),
596
592
  commit: commitSchema.describe("Git commit for which report was collected").nullable()
597
593
  },
598
594
  { description: "Collect output data" }
599
595
  )
600
596
  ).refine(
601
- (report) => !getMissingRefsForCategories(report.categories, report.plugins),
602
- (report) => ({
603
- message: missingRefsForCategoriesErrorMsg(
604
- report.categories,
605
- report.plugins
606
- )
597
+ ({ categories, plugins }) => !getMissingRefsForCategories(categories, plugins),
598
+ ({ categories, plugins }) => ({
599
+ message: missingRefsForCategoriesErrorMsg(categories, plugins)
607
600
  })
608
601
  );
609
602
 
@@ -655,7 +648,7 @@ var auditDiffSchema = scorableWithPluginDiffSchema.merge(
655
648
  z16.object({
656
649
  values: makeComparisonSchema(auditValueSchema).merge(
657
650
  z16.object({
658
- diff: z16.number().int().describe("Value change (`values.after - values.before`)")
651
+ diff: z16.number().describe("Value change (`values.after - values.before`)")
659
652
  })
660
653
  ).describe("Audit `value` comparison"),
661
654
  displayValues: makeComparisonSchema(auditDisplayValueSchema).describe(
@@ -740,6 +733,7 @@ function executeProcess(cfg) {
740
733
  return new Promise((resolve, reject) => {
741
734
  const spawnedProcess = spawn(command, args ?? [], {
742
735
  shell: true,
736
+ windowsHide: true,
743
737
  ...options
744
738
  });
745
739
  let stdout = "";
@@ -773,7 +767,7 @@ function executeProcess(cfg) {
773
767
  import { bold, gray } from "ansis";
774
768
  import { bundleRequire } from "bundle-require";
775
769
  import { mkdir, readFile, readdir, rm, stat } from "node:fs/promises";
776
- import { join } from "node:path";
770
+ import { dirname, join } from "node:path";
777
771
 
778
772
  // packages/utils/src/lib/logging.ts
779
773
  import isaacs_cliui from "@isaacs/cliui";
@@ -1234,7 +1228,7 @@ async function executeRunner() {
1234
1228
  }
1235
1229
  }
1236
1230
  const auditOutputs = await lcovResultsToAuditOutputs(reports, coverageTypes);
1237
- await ensureDirectoryExists(dirname(RUNNER_OUTPUT_PATH));
1231
+ await ensureDirectoryExists(dirname2(RUNNER_OUTPUT_PATH));
1238
1232
  await writeFile(RUNNER_OUTPUT_PATH, JSON.stringify(auditOutputs));
1239
1233
  }
1240
1234
 
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // packages/plugin-coverage/src/lib/coverage-plugin.ts
2
- import { dirname as dirname2, join as join3 } from "node:path";
2
+ import { dirname as dirname3, join as join3 } from "node:path";
3
3
  import { fileURLToPath } from "node:url";
4
4
 
5
5
  // packages/models/src/lib/implementation/schemas.ts
@@ -33,7 +33,7 @@ function exists(value) {
33
33
  return value != null;
34
34
  }
35
35
  function getMissingRefsForCategories(categories, plugins) {
36
- if (categories.length === 0) {
36
+ if (!categories || categories.length === 0) {
37
37
  return false;
38
38
  }
39
39
  const auditRefsFromCategory = categories.flatMap(
@@ -110,7 +110,6 @@ var fileNameSchema = z.string().trim().regex(filenameRegex, {
110
110
  message: `The filename has to be valid`
111
111
  }).min(1, { message: "file name is invalid" });
112
112
  var positiveIntSchema = z.number().int().positive();
113
- var nonnegativeIntSchema = z.number().int().nonnegative();
114
113
  var nonnegativeNumberSchema = z.number().nonnegative();
115
114
  function packageVersionSchema(options) {
116
115
  const { versionDescription = "NPM version of the package", required } = options ?? {};
@@ -533,12 +532,9 @@ var unrefinedCoreConfigSchema = z14.object({
533
532
  var coreConfigSchema = refineCoreConfig(unrefinedCoreConfigSchema);
534
533
  function refineCoreConfig(schema) {
535
534
  return schema.refine(
536
- (coreCfg) => !getMissingRefsForCategories(coreCfg.categories ?? [], coreCfg.plugins),
537
- (coreCfg) => ({
538
- message: missingRefsForCategoriesErrorMsg(
539
- coreCfg.categories ?? [],
540
- coreCfg.plugins
541
- )
535
+ ({ categories, plugins }) => !getMissingRefsForCategories(categories, plugins),
536
+ ({ categories, plugins }) => ({
537
+ message: missingRefsForCategoriesErrorMsg(categories, plugins)
542
538
  })
543
539
  );
544
540
  }
@@ -590,19 +586,16 @@ var reportSchema = packageVersionSchema({
590
586
  ).merge(
591
587
  z15.object(
592
588
  {
593
- categories: z15.array(categoryConfigSchema),
594
589
  plugins: z15.array(pluginReportSchema).min(1),
590
+ categories: z15.array(categoryConfigSchema).optional(),
595
591
  commit: commitSchema.describe("Git commit for which report was collected").nullable()
596
592
  },
597
593
  { description: "Collect output data" }
598
594
  )
599
595
  ).refine(
600
- (report) => !getMissingRefsForCategories(report.categories, report.plugins),
601
- (report) => ({
602
- message: missingRefsForCategoriesErrorMsg(
603
- report.categories,
604
- report.plugins
605
- )
596
+ ({ categories, plugins }) => !getMissingRefsForCategories(categories, plugins),
597
+ ({ categories, plugins }) => ({
598
+ message: missingRefsForCategoriesErrorMsg(categories, plugins)
606
599
  })
607
600
  );
608
601
 
@@ -654,7 +647,7 @@ var auditDiffSchema = scorableWithPluginDiffSchema.merge(
654
647
  z16.object({
655
648
  values: makeComparisonSchema(auditValueSchema).merge(
656
649
  z16.object({
657
- diff: z16.number().int().describe("Value change (`values.after - values.before`)")
650
+ diff: z16.number().describe("Value change (`values.after - values.before`)")
658
651
  })
659
652
  ).describe("Audit `value` comparison"),
660
653
  displayValues: makeComparisonSchema(auditDisplayValueSchema).describe(
@@ -713,7 +706,7 @@ var TERMINAL_WIDTH = 80;
713
706
  import { bold, gray } from "ansis";
714
707
  import { bundleRequire } from "bundle-require";
715
708
  import { mkdir, readFile, readdir, rm, stat } from "node:fs/promises";
716
- import { join } from "node:path";
709
+ import { dirname, join } from "node:path";
717
710
 
718
711
  // packages/utils/src/lib/logging.ts
719
712
  import isaacs_cliui from "@isaacs/cliui";
@@ -814,7 +807,7 @@ import { bold as bold4, cyan, cyanBright, green as green2, red } from "ansis";
814
807
 
815
808
  // packages/plugin-coverage/package.json
816
809
  var name = "@code-pushup/coverage-plugin";
817
- var version = "0.53.1";
810
+ var version = "0.55.0";
818
811
 
819
812
  // packages/plugin-coverage/src/lib/config.ts
820
813
  import { z as z17 } from "zod";
@@ -853,7 +846,7 @@ var coveragePluginConfigSchema = z17.object({
853
846
  // packages/plugin-coverage/src/lib/runner/index.ts
854
847
  import { bold as bold5 } from "ansis";
855
848
  import { writeFile } from "node:fs/promises";
856
- import { dirname } from "node:path";
849
+ import { dirname as dirname2 } from "node:path";
857
850
 
858
851
  // packages/plugin-coverage/src/lib/utils.ts
859
852
  var coverageDescription = {
@@ -889,7 +882,7 @@ var parseLcov = "default" in godKnows ? godKnows.default : godKnows;
889
882
 
890
883
  // packages/plugin-coverage/src/lib/runner/index.ts
891
884
  async function createRunnerConfig(scriptPath, config) {
892
- await ensureDirectoryExists(dirname(PLUGIN_CONFIG_PATH));
885
+ await ensureDirectoryExists(dirname2(PLUGIN_CONFIG_PATH));
893
886
  await writeFile(PLUGIN_CONFIG_PATH, JSON.stringify(config));
894
887
  const threshold = config.perfectScoreThreshold;
895
888
  return {
@@ -922,7 +915,7 @@ async function coveragePlugin(config) {
922
915
  }))
923
916
  };
924
917
  const runnerScriptPath = join3(
925
- fileURLToPath(dirname2(import.meta.url)),
918
+ fileURLToPath(dirname3(import.meta.url)),
926
919
  "bin.js"
927
920
  );
928
921
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/coverage-plugin",
3
- "version": "0.53.1",
3
+ "version": "0.55.0",
4
4
  "description": "Code PushUp plugin for tracking code coverage ☂",
5
5
  "license": "MIT",
6
6
  "homepage": "https://github.com/code-pushup/cli/tree/main/packages/plugin-coverage#readme",
@@ -36,16 +36,16 @@
36
36
  "main": "./index.js",
37
37
  "types": "./src/index.d.ts",
38
38
  "dependencies": {
39
- "@code-pushup/models": "0.53.1",
40
- "@code-pushup/utils": "0.53.1",
39
+ "@code-pushup/models": "0.55.0",
40
+ "@code-pushup/utils": "0.55.0",
41
41
  "ansis": "^3.3.0",
42
42
  "parse-lcov": "^1.0.4",
43
43
  "zod": "^3.22.4"
44
44
  },
45
45
  "peerDependencies": {
46
- "@nx/devkit": "^17.0.0 || ^18.0.0 || ^19.0.0",
47
- "@nx/jest": "^17.0.0 || ^18.0.0 || ^19.0.0",
48
- "@nx/vite": "^17.0.0 || ^18.0.0 || ^19.0.0"
46
+ "@nx/devkit": ">=17.0.0",
47
+ "@nx/jest": ">=17.0.0",
48
+ "@nx/vite": ">=17.0.0"
49
49
  },
50
50
  "peerDependenciesMeta": {
51
51
  "@nx/devkit": {