lighthouse-reporting 1.6.4 → 1.6.6

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/README.md CHANGED
@@ -47,7 +47,7 @@ lighthousePages.forEach(({ name, po, thresholds, swimlanes }) => {
47
47
  // to let playwright initialize context!
48
48
  context // this is enough to make the test work
49
49
 
50
- // note: importing LighthouseResult is not needed since playwright-lighthouse release after v3.2.5 (not including)
50
+ // note: importing LighthouseResult is not needed since playwright-lighthouse@3.2.6
51
51
  const result: LighthouseResult = await playAudit({
52
52
  url: baseURL + po.getPath('123'),
53
53
  port,
@@ -141,7 +141,7 @@ const runLighthouse = async (story: StorybookIndexStory, context: BrowserContext
141
141
  // const page = context.pages()[0]
142
142
  // await page.goto(`/iframe.html?id=${story.id}`)
143
143
 
144
- // note: importing LighthouseResult is not needed since playwright-lighthouse release after v3.2.5 (not including)
144
+ // note: importing LighthouseResult is not needed since playwright-lighthouse@3.2.6
145
145
  const result: LighthouseResult = await playAudit({
146
146
  url: baseURL + `/iframe.html?id=${story.id}`,
147
147
  // page, // alternatevely, path the page instead of the `url`
@@ -58,9 +58,10 @@
58
58
  }
59
59
  throw error;
60
60
  };
61
- const getScores = (result) => Object.entries(result.lhr.categories).filter((c) => typeof c[1].score === "number").reduce(
61
+ const getScores = (result) => Object.entries(result.lhr.categories).reduce(
62
62
  (prev, [key, c]) => {
63
- prev[key] = Math.floor(c.score * 100);
63
+ const score = typeof c.score === "number" ? c.score : 0;
64
+ prev[key] = Math.floor(score * 100);
64
65
  return prev;
65
66
  },
66
67
  {}
@@ -38,9 +38,10 @@ const writeHtmlListEntryWithRetry = async (htmlFilePath, name, scores, threshold
38
38
  }
39
39
  throw error;
40
40
  };
41
- const getScores = (result) => Object.entries(result.lhr.categories).filter((c) => typeof c[1].score === "number").reduce(
41
+ const getScores = (result) => Object.entries(result.lhr.categories).reduce(
42
42
  (prev, [key, c]) => {
43
- prev[key] = Math.floor(c.score * 100);
43
+ const score = typeof c.score === "number" ? c.score : 0;
44
+ prev[key] = Math.floor(score * 100);
44
45
  return prev;
45
46
  },
46
47
  {}
@@ -15,8 +15,8 @@ interface AxeRuleResult {
15
15
  impact?: string;
16
16
  tags: Array<string>;
17
17
  nodes: Array<{
18
- target: Array<string>;
19
- failureSummary?: string;
18
+ target: Array<unknown>;
19
+ failureSummary?: unknown;
20
20
  node: NodeDetails;
21
21
  relatedNodes: NodeDetails[];
22
22
  }>;
@@ -36,9 +36,10 @@ const writeHtmlListEntryWithRetry = async (htmlFilePath, name, scores, threshold
36
36
  }
37
37
  throw error;
38
38
  };
39
- const getScores = (result) => Object.entries(result.lhr.categories).filter((c) => typeof c[1].score === "number").reduce(
39
+ const getScores = (result) => Object.entries(result.lhr.categories).reduce(
40
40
  (prev, [key, c]) => {
41
- prev[key] = Math.floor(c.score * 100);
41
+ const score = typeof c.score === "number" ? c.score : 0;
42
+ prev[key] = Math.floor(score * 100);
42
43
  return prev;
43
44
  },
44
45
  {}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lighthouse-reporting",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "vite build && vite build -c vite.umd.config.ts && tsc -p ./tsconfig.build.json",
@@ -30,20 +30,20 @@
30
30
  "devDependencies": {
31
31
  "@playwright/test": "^1.34.3",
32
32
  "@types/fs-extra": "^11.0.4",
33
- "@types/node": "^20.10.8",
34
- "@typescript-eslint/eslint-plugin": "^6.18.1",
35
- "@typescript-eslint/parser": "^6.18.1",
33
+ "@types/node": "^20.11.16",
34
+ "@typescript-eslint/eslint-plugin": "^6.20.0",
35
+ "@typescript-eslint/parser": "^6.20.0",
36
36
  "eslint": "^8.56.0",
37
37
  "eslint-config-prettier": "^9.1.0",
38
38
  "eslint-plugin-prettier": "^5.1.3",
39
39
  "get-port": "^7.0.0",
40
- "husky": "^8.0.3",
40
+ "husky": "^9.0.10",
41
41
  "npm-run-all": "^4.1.5",
42
- "prettier": "^3.1.1",
43
- "semantic-release": "^22.0.12",
42
+ "prettier": "^3.2.4",
43
+ "semantic-release": "^23.0.0",
44
44
  "typescript": "^5.3.3",
45
- "vite": "^5.0.11",
46
- "vite-plugin-static-copy": "^1.0.0"
45
+ "vite": "^5.0.12",
46
+ "vite-plugin-static-copy": "^1.0.1"
47
47
  },
48
48
  "dependencies": {
49
49
  "fs-extra": "^11.2.0"