@code-pushup/utils 0.14.0 → 0.14.2

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/index.js CHANGED
@@ -1503,6 +1503,13 @@ function toOrdinal(value) {
1503
1503
  }
1504
1504
 
1505
1505
  // packages/utils/src/lib/reports/scoring.ts
1506
+ var GroupRefInvalidError = class extends Error {
1507
+ constructor(auditSlug, pluginSlug) {
1508
+ super(
1509
+ `Group has invalid ref - audit with slug ${auditSlug} from plugin ${pluginSlug} not found`
1510
+ );
1511
+ }
1512
+ };
1506
1513
  function scoreReport(report) {
1507
1514
  const allScoredAuditsAndGroups = /* @__PURE__ */ new Map();
1508
1515
  const scoredPlugins = report.plugins.map((plugin) => {
@@ -1516,9 +1523,7 @@ function scoreReport(report) {
1516
1523
  `${slug}-${ref.slug}-audit`
1517
1524
  )?.score;
1518
1525
  if (score == null) {
1519
- throw new Error(
1520
- `Group has invalid ref - audit with slug ${ref.slug} from plugin ${slug} not found`
1521
- );
1526
+ throw new GroupRefInvalidError(ref.slug, slug);
1522
1527
  }
1523
1528
  return score;
1524
1529
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-pushup/utils",
3
- "version": "0.14.0",
3
+ "version": "0.14.2",
4
4
  "dependencies": {
5
5
  "@code-pushup/models": "*",
6
6
  "bundle-require": "^4.0.1",
@@ -22,6 +22,9 @@ export type ScoredReport = Omit<Report, 'plugins' | 'categories'> & {
22
22
  })[];
23
23
  categories: ScoredCategoryConfig[];
24
24
  };
25
+ export declare class GroupRefInvalidError extends Error {
26
+ constructor(auditSlug: string, pluginSlug: string);
27
+ }
25
28
  export declare function scoreReport(report: Report): ScoredReport;
26
29
  export declare function calculateScore<T extends {
27
30
  weight: number;