lighthouse-reporting 1.6.3 → 1.6.5

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,6 +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@3.2.6
50
51
  const result: LighthouseResult = await playAudit({
51
52
  url: baseURL + po.getPath('123'),
52
53
  port,
@@ -140,6 +141,7 @@ const runLighthouse = async (story: StorybookIndexStory, context: BrowserContext
140
141
  // const page = context.pages()[0]
141
142
  // await page.goto(`/iframe.html?id=${story.id}`)
142
143
 
144
+ // note: importing LighthouseResult is not needed since playwright-lighthouse@3.2.6
143
145
  const result: LighthouseResult = await playAudit({
144
146
  url: baseURL + `/iframe.html?id=${story.id}`,
145
147
  // page, // alternatevely, path the page instead of the `url`
package/dist/hooks.cjs CHANGED
@@ -4,10 +4,11 @@ const os = require("os");
4
4
  const path = require("path");
5
5
  const fse = require("fs-extra");
6
6
  const url = require("url");
7
- const constants = require("./constants-667b8033.cjs");
7
+ const constants = require("./constants-PDApvt-A.cjs");
8
+ var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
8
9
  let dirname;
9
10
  if (typeof __dirname !== "string") {
10
- const filename = url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : document.currentScript && document.currentScript.src || new URL("hooks.cjs", document.baseURI).href);
11
+ const filename = url.fileURLToPath(typeof document === "undefined" ? require("url").pathToFileURL(__filename).href : _documentCurrentScript && _documentCurrentScript.src || new URL("hooks.cjs", document.baseURI).href);
11
12
  dirname = path.dirname(filename);
12
13
  } else {
13
14
  dirname = __dirname;
package/dist/hooks.js CHANGED
@@ -2,7 +2,7 @@ import os from "os";
2
2
  import path from "path";
3
3
  import fse from "fs-extra";
4
4
  import url from "url";
5
- import { L as LH_OUT_DIR, I as INDEX_HTML, P as PW_TMP_DIR } from "./constants-226e9774.js";
5
+ import { L as LH_OUT_DIR, I as INDEX_HTML, P as PW_TMP_DIR } from "./constants-9b_WPkRp.js";
6
6
  let dirname;
7
7
  if (typeof __dirname !== "string") {
8
8
  const filename = url.fileURLToPath(import.meta.url);
package/dist/index.cjs CHANGED
@@ -8,7 +8,7 @@ require("os");
8
8
  require("path");
9
9
  require("fs-extra");
10
10
  require("url");
11
- require("./constants-667b8033.cjs");
11
+ require("./constants-PDApvt-A.cjs");
12
12
  require("get-port");
13
13
  require("@playwright/test");
14
14
  exports.lighthousePlaywrightTeardown = hooks.lighthousePlaywrightTeardown;
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import "os";
6
6
  import "path";
7
7
  import "fs-extra";
8
8
  import "url";
9
- import "./constants-226e9774.js";
9
+ import "./constants-9b_WPkRp.js";
10
10
  import "get-port";
11
11
  import "@playwright/test";
12
12
  export {
@@ -2,12 +2,13 @@
2
2
  typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("os"), require("path"), require("fs-extra"), require("url"), require("net"), require("@playwright/test")) : typeof define === "function" && define.amd ? define(["exports", "os", "path", "fs-extra", "url", "net", "@playwright/test"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.lh_rep = {}, global.os, global.path, global.fse, global.url, global.net, global.test));
3
3
  })(this, function(exports2, os, path, fse, url, net, test) {
4
4
  "use strict";
5
+ var _documentCurrentScript = typeof document !== "undefined" ? document.currentScript : null;
5
6
  const INDEX_HTML = "index.html";
6
7
  const LH_OUT_DIR = "lighthouse";
7
8
  const PW_TMP_DIR = "pwlh";
8
9
  let dirname;
9
10
  if (typeof __dirname !== "string") {
10
- const filename = url.fileURLToPath(typeof document === "undefined" && typeof location === "undefined" ? require("url").pathToFileURL(__filename).href : typeof document === "undefined" ? location.href : document.currentScript && document.currentScript.src || new URL("lighthouse-reporting.umd.cjs", document.baseURI).href);
11
+ const filename = url.fileURLToPath(typeof document === "undefined" && typeof location === "undefined" ? require("url").pathToFileURL(__filename).href : typeof document === "undefined" ? location.href : _documentCurrentScript && _documentCurrentScript.src || new URL("lighthouse-reporting.umd.cjs", document.baseURI).href);
11
12
  dirname = path.dirname(filename);
12
13
  } else {
13
14
  dirname = __dirname;
@@ -57,7 +58,7 @@
57
58
  }
58
59
  throw error;
59
60
  };
60
- const getScores = (result) => Object.entries(result.lhr.categories).reduce(
61
+ const getScores = (result) => Object.entries(result.lhr.categories).filter((c) => typeof c[1].score === "number").reduce(
61
62
  (prev, [key, c]) => {
62
63
  prev[key] = Math.floor(c.score * 100);
63
64
  return prev;
@@ -38,7 +38,7 @@ const writeHtmlListEntryWithRetry = async (htmlFilePath, name, scores, threshold
38
38
  }
39
39
  throw error;
40
40
  };
41
- const getScores = (result) => Object.entries(result.lhr.categories).reduce(
41
+ const getScores = (result) => Object.entries(result.lhr.categories).filter((c) => typeof c[1].score === "number").reduce(
42
42
  (prev, [key, c]) => {
43
43
  prev[key] = Math.floor(c.score * 100);
44
44
  return prev;
@@ -2,9 +2,7 @@ interface NodeDetails {
2
2
  lhId: string;
3
3
  devtoolsNodePath: string;
4
4
  selector: string;
5
- boudingRect: {
6
- [k: string]: number;
7
- };
5
+ boundingRect: unknown;
8
6
  snippet: string;
9
7
  nodeLabel: string;
10
8
  }
@@ -17,8 +15,8 @@ interface AxeRuleResult {
17
15
  impact?: string;
18
16
  tags: Array<string>;
19
17
  nodes: Array<{
20
- target: Array<string>;
21
- failureSummary?: string;
18
+ target: Array<unknown>;
19
+ failureSummary?: unknown;
22
20
  node: NodeDetails;
23
21
  relatedNodes: NodeDetails[];
24
22
  }>;
@@ -28,7 +26,7 @@ export interface LighthouseResult {
28
26
  lhr: {
29
27
  categories: {
30
28
  [k: string]: {
31
- score: number;
29
+ score: number | null;
32
30
  };
33
31
  };
34
32
  audits: {
@@ -36,7 +36,7 @@ const writeHtmlListEntryWithRetry = async (htmlFilePath, name, scores, threshold
36
36
  }
37
37
  throw error;
38
38
  };
39
- const getScores = (result) => Object.entries(result.lhr.categories).reduce(
39
+ const getScores = (result) => Object.entries(result.lhr.categories).filter((c) => typeof c[1].score === "number").reduce(
40
40
  (prev, [key, c]) => {
41
41
  prev[key] = Math.floor(c.score * 100);
42
42
  return prev;
@@ -4,7 +4,7 @@ const os = require("os");
4
4
  const path = require("path");
5
5
  const getPort = require("get-port");
6
6
  const test = require("@playwright/test");
7
- const constants = require("./constants-667b8033.cjs");
7
+ const constants = require("./constants-PDApvt-A.cjs");
8
8
  const playwrightLighthouseTest = test.test.extend({
9
9
  port: [
10
10
  // eslint-disable-next-line no-empty-pattern
@@ -2,7 +2,7 @@ import os from "os";
2
2
  import path from "path";
3
3
  import getPort from "get-port";
4
4
  import { test, chromium } from "@playwright/test";
5
- import { P as PW_TMP_DIR } from "./constants-226e9774.js";
5
+ import { P as PW_TMP_DIR } from "./constants-9b_WPkRp.js";
6
6
  const playwrightLighthouseTest = test.extend({
7
7
  port: [
8
8
  // eslint-disable-next-line no-empty-pattern
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lighthouse-reporting",
3
- "version": "1.6.3",
3
+ "version": "1.6.5",
4
4
  "type": "module",
5
5
  "scripts": {
6
6
  "build": "vite build && vite build -c vite.umd.config.ts && tsc -p ./tsconfig.build.json",
@@ -29,24 +29,24 @@
29
29
  },
30
30
  "devDependencies": {
31
31
  "@playwright/test": "^1.34.3",
32
- "@types/fs-extra": "^11.0.1",
33
- "@types/node": "^20.5.7",
34
- "@typescript-eslint/eslint-plugin": "^6.5.0",
35
- "@typescript-eslint/parser": "^6.5.0",
36
- "eslint": "^8.48.0",
37
- "eslint-config-prettier": "^9.0.0",
38
- "eslint-plugin-prettier": "^5.0.0",
32
+ "@types/fs-extra": "^11.0.4",
33
+ "@types/node": "^20.11.6",
34
+ "@typescript-eslint/eslint-plugin": "^6.19.1",
35
+ "@typescript-eslint/parser": "^6.19.1",
36
+ "eslint": "^8.56.0",
37
+ "eslint-config-prettier": "^9.1.0",
38
+ "eslint-plugin-prettier": "^5.1.3",
39
39
  "get-port": "^7.0.0",
40
40
  "husky": "^8.0.3",
41
41
  "npm-run-all": "^4.1.5",
42
- "prettier": "^3.0.3",
43
- "semantic-release": "^21.1.1",
44
- "typescript": "^5.2.2",
45
- "vite": "^4.4.9",
46
- "vite-plugin-static-copy": "^0.17.0"
42
+ "prettier": "^3.2.4",
43
+ "semantic-release": "^23.0.0",
44
+ "typescript": "^5.3.3",
45
+ "vite": "^5.0.12",
46
+ "vite-plugin-static-copy": "^1.0.0"
47
47
  },
48
48
  "dependencies": {
49
- "fs-extra": "^11.1.1"
49
+ "fs-extra": "^11.2.0"
50
50
  },
51
51
  "repository": {
52
52
  "type": "git",