import type { SourceIndex } from '@variance-authority/core/attribute'; import type { Level } from '@variance-authority/core/judge'; import type { SubjectRef } from '@variance-authority/core/format'; /** * What a test declares about one subject, and what each declaration decides. * * Split from `fixture.ts` so the shape an adopter reads is not buried in the * machinery that consumes it: every field here is a fact only the test holds, * and the reason each one could not be defaulted is the documentation. */ export interface VarianceOptions { /** * What the baseline is keyed on. Defaults to the test's title path. * * A default derived from titles means renaming a test orphans its baseline, * which is the right failure — `new` rather than a silent comparison against * something else — and is still worth overriding for anything long-lived. */ readonly subjectId?: string; /** Defaults to `route`, which is what a navigated page is. */ readonly subjectKind?: SubjectRef['kind']; /** * Fonts this machine is asserted to have, as `family/weight/style/hash`. * * Omitted here it stays omitted: the collector says so in a diagnostic rather * than putting a confident value in the environment key. Supplying it is what * makes a baseline written on a machine with a different font stack name the * font stack as the cause of what changed. */ readonly fonts?: readonly string[]; /** Component to file. Without it the docket names components and no lines. */ readonly source?: SourceIndex; /** Milliseconds to wait for the subject's Suspense boundaries. Defaults to 5000. */ readonly suspenseTimeoutMs?: number; /** * This subject's *loading* state is what is being captured. * * The escape hatch. Without it, a subtree still showing a Suspense fallback * **throws** rather than being recorded: a baseline over a skeleton that was * never meant to be one turns every faster machine into a regression, and a * failed assertion here is the only thing that reaches the person who can * decide which of the two states this test is about. */ readonly loading?: boolean; /** * Read the framework wiring of each node — props, context, hook cells, keys. * Defaults to `true`. * * On because the fixture already walks the fiber tree for provenance, and * wiring is the dimension that says *a prop moved* about a subtree whose * markup did not. It is a band of its own rather than part of `rendering`, so * a subject that never had it read still hashes to what it hashed before. * * Off is for a page this project's adapter cannot read anyway — a non-React * surface driven by the same suite — where the walk buys an absent band at the * price of visiting every node. */ readonly wiring?: boolean; /** * Read the held state behind each node — the digests of the application values * a component was rendered with. Defaults to `false`. * * Opt-in rather than symmetric with `wiring`, because it changes what a * `structureHash` is: a node carrying a holding suppresses the inert-wrapper * collapse, so the same subject read with holdings and without produces two * different structures. Both sides of a comparison must therefore be read the * same way, and a test that sets this on one spec and not another is comparing * a subject against a differently-read baseline. */ readonly holdings?: boolean; /** * Stabilization tricks to hold the subject still with, by id. Defaults to * `COLLECT_RECIPE`. * * The default takes the pointer off the page and releases focus before each * observation, so a hover or a focus your test left behind is not read. Name * your own list without `no-hover` or `no-focus` to observe that state. A * baseline made under one list compared with a run made under another names * the list as the cause of what changed. Focus goes back to the element that held it once the observation * and its screenshot are taken, so the test types where it left off. * * `reduced-motion` and `freeze-clock` hold only where something drives the * browser before the page loads, and an observation comes after it has. The * `variance` fixture sets them on the page it hands your test, as * `varianceStabilize` and `varianceNow` say, and an observation records the * ones it set that this list names. On a page the fixture never handed your * test, set them yourself before `page.goto()` with `driveBeforeTest(page)`; * they are left out of what that observation records. */ readonly stabilize?: readonly string[]; /** * How much of this subject is being asserted on, when it has been relaxed. * * The rule that applies *here*, already matched — scoping is a question about * subject ids and tags, and a test knows its own subject. A suite that scopes * by pattern matches the rule itself and passes the one that won. * * This is what a threshold is usually reached for and is not one. A threshold * absorbs anything small enough, including the one-pixel shift that is the * regression; a level absorbs exactly the bands it names, however large they * are, and the observation says which bands it absorbed and under whose id. A * subject left undeclared asserts on everything. */ readonly sensitivity?: { /** Stable name. Appears in the verdict and in every count this rule produces. */ readonly rule: string; /** Why this subject is not asserted on in full. Required, as an ignore's is. */ readonly reason: string; readonly level: Level; }; } export interface InPlaceCaptureOptions { readonly kind: 'in-place'; /** Must describe the browser launch owned by the Playwright configuration. */ readonly browser: { readonly headless: boolean; readonly launchArgs: readonly string[]; }; /** Independent screenshots required to agree. Defaults to 2; minimum 2. */ readonly stabilityChecks?: number; /** * How many times to let a moving subject come to rest. Defaults to 3; minimum 1. * * A subject photographed in place is photographed while the application is * still running, and a finite transition that has not finished is the ordinary * case rather than the pathological one -- a menu that just opened, a snackbar * sliding in, a grid that just received its rows. Refusing the first time two * readings disagree turns every one of those into a failed test, so the cycle * is retried, using the confirming read as the next attempt's acquisition. * * One attempt is the old behaviour, for a suite that wants a subject which * moves at all to be a failure. */ readonly settleAttempts?: number; } export type MaterializationOptions = { readonly kind: 'deferred'; } | InPlaceCaptureOptions; //# sourceMappingURL=options.d.ts.map