@piwitests/reporter 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.
@@ -17,6 +17,8 @@ declare const ATTACHMENT_NAMES: {
17
17
  readonly pageInventory: "piwi-page-inventory";
18
18
  readonly locatorPages: "piwi-locator-pages";
19
19
  readonly codeReach: "piwi-code-reach";
20
+ readonly browserCoverage: "piwi-browser-coverage";
21
+ readonly browserFunctions: "piwi-browser-functions";
20
22
  readonly serverCoverageRequests: "piwi-server-coverage-requests";
21
23
  readonly webVitals: "piwi-web-vitals";
22
24
  readonly locatorSuggestion: "piwi-locator-suggestion";
@@ -42,6 +42,8 @@ var ATTACHMENT_NAMES = {
42
42
  pageInventory: "piwi-page-inventory",
43
43
  locatorPages: "piwi-locator-pages",
44
44
  codeReach: "piwi-code-reach",
45
+ browserCoverage: "piwi-browser-coverage",
46
+ browserFunctions: "piwi-browser-functions",
45
47
  serverCoverageRequests: "piwi-server-coverage-requests",
46
48
  webVitals: "piwi-web-vitals",
47
49
  locatorSuggestion: "piwi-locator-suggestion",
@@ -54,9 +54,17 @@ declare function internalCall<T>(owner: unknown, run: () => Promise<T>): Promise
54
54
  interface CodeReachRoots {
55
55
  /** Directories a module path or a map source is tried against, first match wins; the repository root is last. */
56
56
  roots: string[];
57
+ /**
58
+ * Directories tried before `roots` for the scripts an origin serves, or, when the script's own origin has none,
59
+ * that a page at the origin loads: an application served by several dev servers (one per portal) resolves each
60
+ * one's modules against its own directory.
61
+ */
62
+ byOrigin?: Map<string, string[]>;
57
63
  /** Paths go out relative to it. */
58
64
  repoRoot: string;
59
65
  }
66
+ /** The `codeReachRoots` option: directories for every script, or directories per origin, `*` for the rest. */
67
+ type CodeReachRootsOption = string[] | Record<string, string | string[]>;
60
68
  /** Fetches a source map's text; null when it cannot. */
61
69
  type MapFetcher = (url: string) => Promise<string | null>;
62
70
  /**
@@ -67,20 +75,30 @@ type MapFetcher = (url: string) => Promise<string | null>;
67
75
  interface CoveredScript extends JsCoverageEntry {
68
76
  /** V8's content hash of the script; without it, the version is a hash of `source`. */
69
77
  hash?: string;
78
+ /** The address of the page's document as it parsed the script, whose origin's roots it falls back on. */
79
+ pageUrl?: string;
70
80
  }
71
81
  /**
72
- * The roots for a test: `codeReachRoots` when set, else the Playwright config's
73
- * directory; the repository root always comes last, since bundlers name
74
- * sources from the project root (Turbopack's `[project]/`).
82
+ * The roots for a test: `codeReachRoots` when set (an array, or the `*` entry of
83
+ * an object), else the Playwright config's directory; the repository root always
84
+ * comes last, since bundlers name sources from the project root (Turbopack's
85
+ * `[project]/`). An object's other keys are origins, each with the directories
86
+ * tried first for its scripts. Relative directories resolve against the config's.
87
+ */
88
+ declare function codeReachRoots(configDir: string, configured: CodeReachRootsOption | null | undefined): CodeReachRoots;
89
+ /**
90
+ * The repository-relative files the covered scripts reached, sorted and capped.
91
+ * A script whose own origin has no roots takes those of its page's origin: the
92
+ * page's address as it parsed the script, else `pageUrl`.
75
93
  */
76
- declare function codeReachRoots(configDir: string, configured: string[] | null | undefined): CodeReachRoots;
77
- /** The repository-relative files the covered scripts reached, sorted and capped. */
78
- declare function resolveCodeReach(entries: CoveredScript[], roots: CodeReachRoots, fetchMap: MapFetcher): Promise<string[]>;
94
+ declare function resolveCodeReach(entries: CoveredScript[], roots: CodeReachRoots, fetchMap: MapFetcher, pageUrl?: string): Promise<string[]>;
79
95
  /** A map fetcher through the page's request context, bounded in size and time. */
80
96
  declare function pageMapFetcher(page: Page): MapFetcher;
81
97
  /**
82
98
  * Start function coverage on a page, with the debugger on to learn each
83
- * script's version; false when the browser has none or it fails.
99
+ * script's version and to stop as each document is left (its `beforeunload`,
100
+ * from a listener the capture adds in an isolated world); false when the
101
+ * browser has none or it fails.
84
102
  */
85
103
  declare function startCodeReach(page: Page): Promise<boolean>;
86
104
  /**
@@ -481,8 +499,11 @@ declare function computeCoreVitals(lcpEntries: RawVitalEntry[] | null, shiftEntr
481
499
  cls: number | null;
482
500
  inp: number | null;
483
501
  } | null;
484
- /** The code reach roots from `PIWI_CODE_REACH_ROOTS` (a JSON array or a path list). */
485
- declare function configuredCodeReachRoots(): string[] | null;
502
+ /**
503
+ * The code reach roots from `PIWI_CODE_REACH_ROOTS`: a JSON array, a JSON object
504
+ * of directories per origin (`*` for every other origin), or a path list.
505
+ */
506
+ declare function configuredCodeReachRoots(): CodeReachRootsOption | null;
486
507
  /** Page state captured at test end. Storage values and cookie values are NEVER included. */
487
508
  interface PageState extends PageInteraction {
488
509
  url: string;