@piwitests/reporter 0.40.0 → 0.42.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.
@@ -14,6 +14,7 @@ declare const ATTACHMENT_NAMES: {
14
14
  readonly network: "piwi-network";
15
15
  readonly pageInventory: "piwi-page-inventory";
16
16
  readonly locatorPages: "piwi-locator-pages";
17
+ readonly codeReach: "piwi-code-reach";
17
18
  readonly webVitals: "piwi-web-vitals";
18
19
  readonly locatorSuggestion: "piwi-locator-suggestion";
19
20
  readonly pageState: "piwi-page-state";
@@ -35,6 +35,7 @@ var ATTACHMENT_NAMES = {
35
35
  network: "piwi-network",
36
36
  pageInventory: "piwi-page-inventory",
37
37
  locatorPages: "piwi-locator-pages",
38
+ codeReach: "piwi-code-reach",
38
39
  webVitals: "piwi-web-vitals",
39
40
  locatorSuggestion: "piwi-locator-suggestion",
40
41
  pageState: "piwi-page-state",
@@ -1,7 +1,8 @@
1
1
  import { ProbeArg } from '@piwitests/picker-dom';
2
2
  export { ProbeArg, ProbedAttrs, probeElementAttrs } from '@piwitests/picker-dom';
3
- import { TestType, Fixtures, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, Locator } from '@playwright/test';
3
+ import { Page, TestType, Fixtures, PlaywrightTestArgs, PlaywrightTestOptions, PlaywrightWorkerArgs, PlaywrightWorkerOptions, Locator } from '@playwright/test';
4
4
  import { LocatorPageUse } from '@piwitests/core/wire';
5
+ import { JsCoverageEntry } from '@piwitests/core/code-reach';
5
6
 
6
7
  /** A main-frame navigation, full or same-document: the page starts over. */
7
8
  declare function noteNavigation(page: object): void;
@@ -41,6 +42,30 @@ declare function boxCaptureFrames(extraPrefixes?: readonly string[]): void;
41
42
  */
42
43
  declare function internalCall<T>(owner: unknown, run: () => Promise<T>): Promise<T>;
43
44
 
45
+ /** Where code reach resolves paths. */
46
+ interface CodeReachRoots {
47
+ /** Directories a module path or a map source is tried against, first match wins; the repository root is last. */
48
+ roots: string[];
49
+ /** Paths go out relative to it. */
50
+ repoRoot: string;
51
+ }
52
+ /** Fetches a source map's text; null when it cannot. */
53
+ type MapFetcher = (url: string) => Promise<string | null>;
54
+ /**
55
+ * The roots for a test: `codeReachRoots` when set, else the Playwright config's
56
+ * directory; the repository root always comes last, since bundlers name
57
+ * sources from the project root (Turbopack's `[project]/`).
58
+ */
59
+ declare function codeReachRoots(configDir: string, configured: string[] | null | undefined): CodeReachRoots;
60
+ /** The repository-relative files the covered scripts reached, sorted and capped. */
61
+ declare function resolveCodeReach(entries: JsCoverageEntry[], roots: CodeReachRoots, fetchMap: MapFetcher): Promise<string[]>;
62
+ /** A map fetcher through the page's request context, bounded in size and time. */
63
+ declare function pageMapFetcher(page: Page): MapFetcher;
64
+ /** Start JavaScript coverage on a page; false when the browser has none or it fails. */
65
+ declare function startCodeReach(page: Page): Promise<boolean>;
66
+ /** Stop JavaScript coverage and return its entries; null when it cannot be read. */
67
+ declare function stopCodeReach(page: Page): Promise<JsCoverageEntry[] | null>;
68
+
44
69
  type FixtureArgs = {
45
70
  [key: string]: any;
46
71
  };
@@ -63,6 +88,8 @@ declare function computeCoreVitals(lcpEntries: RawVitalEntry[] | null, shiftEntr
63
88
  cls: number | null;
64
89
  inp: number | null;
65
90
  } | null;
91
+ /** The code reach roots from `PIWI_CODE_REACH_ROOTS` (a JSON array or a path list). */
92
+ declare function configuredCodeReachRoots(): string[] | null;
66
93
  /** Page state captured at test end. Storage values and cookie values are NEVER included. */
67
94
  interface PageState {
68
95
  url: string;
@@ -185,4 +212,4 @@ declare const piwiFixtures: Fixtures<PiwiFixtures, {}, PlaywrightTestArgs & Play
185
212
  */
186
213
  declare function extendPiwiFixtures<TestArgs extends FixtureArgs, WorkerArgs extends FixtureArgs>(test: TestType<TestArgs, WorkerArgs>): TestType<TestArgs & PiwiFixtures, WorkerArgs>;
187
214
 
188
- export { CAPTURED_ATTRS_ARG, LocatorPageLog, type PageState, type PiwiFixtures, type RawPageState, type RawVitalEntry, ariaSnapshotBestEffort, ariaSnapshotJSONBestEffort, boxCaptureFrames, buildPageState, callMethod, computeCoreVitals, extendPiwiFixtures, internalCall, noteLocatorCall, noteNavigation, piwiFixtures };
215
+ export { CAPTURED_ATTRS_ARG, LocatorPageLog, type PageState, type PiwiFixtures, type RawPageState, type RawVitalEntry, ariaSnapshotBestEffort, ariaSnapshotJSONBestEffort, boxCaptureFrames, buildPageState, callMethod, codeReachRoots, computeCoreVitals, configuredCodeReachRoots, extendPiwiFixtures, internalCall, noteLocatorCall, noteNavigation, pageMapFetcher, piwiFixtures, resolveCodeReach, startCodeReach, stopCodeReach };