renderdiff 0.1.0 → 0.3.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.
@@ -6,7 +6,9 @@
6
6
  import type { RenderdiffConfig } from "renderdiff";
7
7
 
8
8
  export default {
9
- // The two origins. The tool has no notion of which is "prod" — it just diffs them.
9
+ // left: the build you changed (usually localhost). right: the reference you must match
10
+ // (usually production). The +/- signs in the output and text.added/removed in
11
+ // results.json are written from left's point of view.
10
12
  left: "http://localhost:3000",
11
13
  right: "https://example.com",
12
14
 
@@ -21,8 +23,33 @@ export default {
21
23
  "/pricing::/plans",
22
24
  { left: "/blog", right: "/posts" },
23
25
  { left: "/pricing", selector: { left: ".plans-v2", right: ".plans" } },
26
+ // `before` runs on each side after the page loads, before it settles and is shot, so
27
+ // the open menu is what gets measured. Replaces the top-level `before` for this route.
28
+ {
29
+ left: "/docs",
30
+ before: async (page) => {
31
+ await page.click("[aria-label=Menu]");
32
+ },
33
+ },
24
34
  ],
25
35
 
36
+ // For every route without its own `before`, CLI routes included. Gets
37
+ // `{ side, route, width }`; use `side` only for markup that legitimately differs per
38
+ // side, never to make the two sides look alike. A throw is a route error, not retried.
39
+ // Actions use Playwright's 30s default timeout, so check first for what may not be
40
+ // there. hideSelectors and extraCss apply after the hook.
41
+ before: async (page) => {
42
+ const accept = page.getByRole("button", { name: "Accept" });
43
+ if (await accept.isVisible()) await accept.click();
44
+ },
45
+
46
+ // Playwright storage state (cookies, localStorage) each side starts with, e.g. signed
47
+ // in: `npx playwright codegen --save-storage=auth.json <url>`. One file, or
48
+ // `{ left, right }`. Relative to this file. It holds live session tokens: never commit
49
+ // it, and add it to .gitignore. The out dir then holds signed-in screenshots and text,
50
+ // so keep it out of git and don't publish it either. `--storage-state` replaces it.
51
+ storageState: "auth.json",
52
+
26
53
  // Replaces the default set (1440, 1152, 896, 704, 375).
27
54
  widths: [1440, 896, 375],
28
55
 
@@ -32,7 +59,8 @@ export default {
32
59
  // Relative to the directory you run in. Wiped at the start of each run.
33
60
  outDir: "renderdiff-out",
34
61
 
35
- // Captures run in parallel. Keep it low if the right origin is someone's live site.
62
+ // Captures run in parallel. Default half the CPU cores, between 2 and 8. Keep it low if
63
+ // the right origin is someone's live site.
36
64
  concurrency: 2,
37
65
 
38
66
  // Appended to the built-in analytics/consent/A-B blocklist. Aborted at the network