@code-pushup/coverage-plugin 0.54.0 → 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 +11 -17
  2. package/index.js +14 -20
  3. package/package.json +3 -3
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(
@@ -533,12 +533,9 @@ var unrefinedCoreConfigSchema = z14.object({
533
533
  var coreConfigSchema = refineCoreConfig(unrefinedCoreConfigSchema);
534
534
  function refineCoreConfig(schema) {
535
535
  return schema.refine(
536
- (coreCfg) => !getMissingRefsForCategories(coreCfg.categories ?? [], coreCfg.plugins),
537
- (coreCfg) => ({
538
- message: missingRefsForCategoriesErrorMsg(
539
- coreCfg.categories ?? [],
540
- coreCfg.plugins
541
- )
536
+ ({ categories, plugins }) => !getMissingRefsForCategories(categories, plugins),
537
+ ({ categories, plugins }) => ({
538
+ message: missingRefsForCategoriesErrorMsg(categories, plugins)
542
539
  })
543
540
  );
544
541
  }
@@ -590,19 +587,16 @@ var reportSchema = packageVersionSchema({
590
587
  ).merge(
591
588
  z15.object(
592
589
  {
593
- categories: z15.array(categoryConfigSchema),
594
590
  plugins: z15.array(pluginReportSchema).min(1),
591
+ categories: z15.array(categoryConfigSchema).optional(),
595
592
  commit: commitSchema.describe("Git commit for which report was collected").nullable()
596
593
  },
597
594
  { description: "Collect output data" }
598
595
  )
599
596
  ).refine(
600
- (report) => !getMissingRefsForCategories(report.categories, report.plugins),
601
- (report) => ({
602
- message: missingRefsForCategoriesErrorMsg(
603
- report.categories,
604
- report.plugins
605
- )
597
+ ({ categories, plugins }) => !getMissingRefsForCategories(categories, plugins),
598
+ ({ categories, plugins }) => ({
599
+ message: missingRefsForCategoriesErrorMsg(categories, plugins)
606
600
  })
607
601
  );
608
602
 
@@ -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(
@@ -532,12 +532,9 @@ var unrefinedCoreConfigSchema = z14.object({
532
532
  var coreConfigSchema = refineCoreConfig(unrefinedCoreConfigSchema);
533
533
  function refineCoreConfig(schema) {
534
534
  return schema.refine(
535
- (coreCfg) => !getMissingRefsForCategories(coreCfg.categories ?? [], coreCfg.plugins),
536
- (coreCfg) => ({
537
- message: missingRefsForCategoriesErrorMsg(
538
- coreCfg.categories ?? [],
539
- coreCfg.plugins
540
- )
535
+ ({ categories, plugins }) => !getMissingRefsForCategories(categories, plugins),
536
+ ({ categories, plugins }) => ({
537
+ message: missingRefsForCategoriesErrorMsg(categories, plugins)
541
538
  })
542
539
  );
543
540
  }
@@ -589,19 +586,16 @@ var reportSchema = packageVersionSchema({
589
586
  ).merge(
590
587
  z15.object(
591
588
  {
592
- categories: z15.array(categoryConfigSchema),
593
589
  plugins: z15.array(pluginReportSchema).min(1),
590
+ categories: z15.array(categoryConfigSchema).optional(),
594
591
  commit: commitSchema.describe("Git commit for which report was collected").nullable()
595
592
  },
596
593
  { description: "Collect output data" }
597
594
  )
598
595
  ).refine(
599
- (report) => !getMissingRefsForCategories(report.categories, report.plugins),
600
- (report) => ({
601
- message: missingRefsForCategoriesErrorMsg(
602
- report.categories,
603
- report.plugins
604
- )
596
+ ({ categories, plugins }) => !getMissingRefsForCategories(categories, plugins),
597
+ ({ categories, plugins }) => ({
598
+ message: missingRefsForCategoriesErrorMsg(categories, plugins)
605
599
  })
606
600
  );
607
601
 
@@ -712,7 +706,7 @@ var TERMINAL_WIDTH = 80;
712
706
  import { bold, gray } from "ansis";
713
707
  import { bundleRequire } from "bundle-require";
714
708
  import { mkdir, readFile, readdir, rm, stat } from "node:fs/promises";
715
- import { join } from "node:path";
709
+ import { dirname, join } from "node:path";
716
710
 
717
711
  // packages/utils/src/lib/logging.ts
718
712
  import isaacs_cliui from "@isaacs/cliui";
@@ -813,7 +807,7 @@ import { bold as bold4, cyan, cyanBright, green as green2, red } from "ansis";
813
807
 
814
808
  // packages/plugin-coverage/package.json
815
809
  var name = "@code-pushup/coverage-plugin";
816
- var version = "0.54.0";
810
+ var version = "0.55.0";
817
811
 
818
812
  // packages/plugin-coverage/src/lib/config.ts
819
813
  import { z as z17 } from "zod";
@@ -852,7 +846,7 @@ var coveragePluginConfigSchema = z17.object({
852
846
  // packages/plugin-coverage/src/lib/runner/index.ts
853
847
  import { bold as bold5 } from "ansis";
854
848
  import { writeFile } from "node:fs/promises";
855
- import { dirname } from "node:path";
849
+ import { dirname as dirname2 } from "node:path";
856
850
 
857
851
  // packages/plugin-coverage/src/lib/utils.ts
858
852
  var coverageDescription = {
@@ -888,7 +882,7 @@ var parseLcov = "default" in godKnows ? godKnows.default : godKnows;
888
882
 
889
883
  // packages/plugin-coverage/src/lib/runner/index.ts
890
884
  async function createRunnerConfig(scriptPath, config) {
891
- await ensureDirectoryExists(dirname(PLUGIN_CONFIG_PATH));
885
+ await ensureDirectoryExists(dirname2(PLUGIN_CONFIG_PATH));
892
886
  await writeFile(PLUGIN_CONFIG_PATH, JSON.stringify(config));
893
887
  const threshold = config.perfectScoreThreshold;
894
888
  return {
@@ -921,7 +915,7 @@ async function coveragePlugin(config) {
921
915
  }))
922
916
  };
923
917
  const runnerScriptPath = join3(
924
- fileURLToPath(dirname2(import.meta.url)),
918
+ fileURLToPath(dirname3(import.meta.url)),
925
919
  "bin.js"
926
920
  );
927
921
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/coverage-plugin",
3
- "version": "0.54.0",
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,8 +36,8 @@
36
36
  "main": "./index.js",
37
37
  "types": "./src/index.d.ts",
38
38
  "dependencies": {
39
- "@code-pushup/models": "0.54.0",
40
- "@code-pushup/utils": "0.54.0",
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"