@variance-authority/unit-test 0.1.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.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shape.js","sourceRoot":"","sources":["../src/shape.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,aAAa,EACb,YAAY,GAGb,MAAM,0BAA0B,CAAC;AAElC;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAc,EAAE,IAAY;IAC9D,MAAM,QAAQ,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,QAAQ,KAAK,IAAI,IAAI,QAAQ,CAAC,eAAe,KAAK,CAAC,EAAE,CAAC;QACxD,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,sCAAsC,CAAC,CAAC;IACjE,CAAC;IACD,MAAM,OAAO,GAAG,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC9C,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAI,OAAO,KAAK,IAAI,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;QAC1C,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,6BAA6B,CAAC,CAAC;IACxD,CAAC;IACD,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC9B,UAAU,CAAC,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACjC,SAAS,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;QACtC,OAAO,KAAwB,CAAC;IAClC,CAAC;IACD,IAAI,QAAQ,CAAC,IAAI,KAAK,UAAU,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,GAAG,IAAI,sCAAsC,CAAC,CAAC;IACjE,CAAC;IACD,MAAM,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC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K,CAAC,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC;AACnF,CAAC;AAED,SAAS,cAAc,CAAC,KAAc;IACpC,OAAO,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,KAAK,QAAQ,CAAC;AAC1D,CAAC;AAED,SAAS,YAAY,CAAC,KAAc;IAClC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC7D,CAAC;AAED,SAAS,kBAAkB,CAAC,KAAc;IACxC,OAAO,YAAY,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,MAAM,CAAC,KAAa;IAC3B,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,wBAAwB,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IAClF,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,KAAK,CAAC;AACnE,CAAC","sourcesContent":["import {\n digestBytes,\n digestCombine,\n digestString,\n type CaptureArtifact,\n type RenderResource,\n} from '@variance-authority/core';\n\n/**\n * What a capture file has to be before anything is believed about it.\n *\n * Separate from the directory protocol in [`archive.ts`](./archive.ts) because\n * the two answer different questions and change for different reasons: that one\n * owns which files exist and who may replace them, this one owns whether the\n * bytes in one of them are a capture. The split is also where the size is — a\n * document carries a semantic snapshot, a resource closure and a source index,\n * and every one of those is checked field by field here.\n *\n * Everything is re-derived rather than believed. A digest that arrived in the\n * file is recomputed from the content it claims to describe, so a baseline\n * edited by hand between runs fails here instead of comparing as though the edit\n * had been captured.\n */\nexport function captureArtifactFrom(value: unknown, path: string): CaptureArtifact {\n const artifact = record(value);\n if (artifact === null || artifact.artifactVersion !== 1) {\n throw new Error(`${path} is not a capture artifact version 1`);\n }\n const subject = subjectFrom(artifact.subject);\n const material = record(artifact.material);\n if (subject === null || material === null) {\n throw new Error(`${path} is not a unit-test capture`);\n }\n if (material.kind === 'value') {\n checkValue(material.value, path);\n checkTail(artifact, subject.id, path);\n return value as CaptureArtifact;\n }\n if (material.kind !== 'document') {\n throw new Error(`${path} is not a unit-test document capture`);\n }\n const document = record(material.document);\n if (\n document === null ||\n !documentShape(document) ||\n record(document.resources) === null\n ) {\n throw new Error(`${path} does not contain a resource-closed render document`);\n }\n\n const documentSubject = subjectFrom(document.subject);\n if (documentSubject === null || documentSubject.id !== subject.id) {\n throw new Error(`${path} has different artifact and document subjects`);\n }\n\n for (const [url, value] of Object.entries(document.resources as Record<string, unknown>)) {\n const resource = resourceFrom(value);\n if (resource === null) throw new Error(`${path} contains an invalid resource for ${url}`);\n const actual = digestBytes(Buffer.from(resource.bytes, 'base64'));\n if (actual !== resource.digest) {\n throw new Error(`${path} contains resource bytes that do not match ${url}`);\n }\n }\n\n const assets = record(document.assets);\n if (assets === null) throw new Error(`${path} does not declare its resource digests`);\n for (const [url, expected] of Object.entries(assets)) {\n const resource = (document.resources as Record<string, unknown>)[url];\n const parsed = resourceFrom(resource);\n if (typeof expected !== 'string' || parsed === null || parsed.digest !== expected) {\n throw new Error(`${path} has no matching archived resource for ${url}`);\n }\n }\n\n checkTail(artifact, subject.id, path);\n\n return value as CaptureArtifact;\n}\n\nfunction checkTail(artifact: Record<string, unknown>, subjectId: string, path: string): void {\n if (artifact.snapshot !== undefined && !snapshotShape(artifact.snapshot, subjectId)) {\n throw new Error(`${path} contains an invalid semantic snapshot`);\n }\n if (artifact.source !== undefined && !sourceShape(artifact.source)) {\n throw new Error(`${path} contains an invalid source index`);\n }\n if (artifact.stabilization !== undefined && !stringArray(artifact.stabilization)) {\n throw new Error(`${path} contains an invalid stabilization record`);\n }\n if (artifact.attempt !== undefined && !attemptShape(artifact.attempt)) {\n throw new Error(`${path} contains an invalid capture attempt`);\n }\n}\n\n/**\n * A value capture, re-derived rather than believed.\n *\n * The digest is recomputed from the text on the way in, exactly as a resource's\n * bytes are. A baseline edited by hand between runs would otherwise pass its own\n * identity check and compare as though the edit had been captured.\n */\nfunction checkValue(value: unknown, path: string): void {\n const captured = record(value);\n if (\n captured === null ||\n typeof captured.dialect !== 'string' ||\n typeof captured.text !== 'string' ||\n typeof captured.digest !== 'string' ||\n typeof captured.recipe !== 'string' ||\n (captured.keyed !== undefined && !stringArray(captured.keyed)) ||\n (captured.generator !== undefined && !generatorShape(captured.generator))\n ) {\n throw new Error(`${path} does not contain a captured value`);\n }\n const actual = digestCombine('value/v1', [\n digestString(captured.text),\n digestString(captured.recipe),\n ]);\n if (actual !== captured.digest) {\n throw new Error(`${path} contains value text that does not match its digest`);\n }\n}\n\nfunction generatorShape(value: unknown): boolean {\n const generator = record(value);\n return (\n generator !== null &&\n typeof generator.name === 'string' &&\n typeof generator.version === 'string'\n );\n}\n\nfunction resourceFrom(value: unknown): RenderResource | null {\n const resource = record(value);\n return resource !== null &&\n typeof resource.contentType === 'string' &&\n typeof resource.bytes === 'string' &&\n base64(resource.bytes) &&\n typeof resource.digest === 'string'\n ? (resource as unknown as RenderResource)\n : null;\n}\n\nfunction record(value: unknown): Record<string, unknown> | null {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n ? (value as Record<string, unknown>)\n : null;\n}\n\nfunction subjectFrom(value: unknown): { id: string; kind: string } | null {\n const subject = record(value);\n if (\n subject === null ||\n typeof subject.id !== 'string' ||\n !['story', 'route', 'fixture', 'value'].includes(String(subject.kind)) ||\n (subject.title !== undefined && typeof subject.title !== 'string')\n ) return null;\n return { id: subject.id, kind: String(subject.kind) };\n}\n\nfunction documentShape(document: Record<string, unknown>): boolean {\n const frame = record(document.frame);\n const viewport = record(document.viewport);\n return (\n document.documentVersion === 1 &&\n subjectFrom(document.subject) !== null &&\n typeof document.html === 'string' &&\n frame !== null &&\n stringRecord(frame.html) &&\n stringRecord(frame.body) &&\n Array.isArray(frame.ancestors) &&\n frame.ancestors.every(frameElementShape) &&\n (frame.containerWidth === undefined || finiteNumber(frame.containerWidth)) &&\n stringArray(document.css) &&\n viewport !== null &&\n finiteNumber(viewport.width) &&\n finiteNumber(viewport.height) &&\n finiteNumber(viewport.deviceScaleFactor) &&\n (viewport.colorScheme === 'light' || viewport.colorScheme === 'dark') &&\n stringRecord(document.inherited) &&\n stringArray(document.fonts) &&\n (document.assets === undefined || stringRecord(document.assets)) &&\n (document.baseUrl === undefined || typeof document.baseUrl === 'string') &&\n diagnosticArray(document.diagnostics)\n );\n}\n\nfunction frameElementShape(value: unknown): boolean {\n const element = record(value);\n return element !== null && typeof element.tag === 'string' && stringRecord(element.attributes);\n}\n\nfunction snapshotShape(value: unknown, subjectId: string): boolean {\n const snapshot = record(value);\n const profile = snapshot === null ? null : record(snapshot.profile);\n const environment = snapshot === null ? null : record(snapshot.environment);\n const root = snapshot === null ? null : record(snapshot.root);\n return (\n snapshot !== null &&\n snapshot.formatVersion === 1 &&\n subjectFrom(snapshot.subject)?.id === subjectId &&\n profile !== null &&\n (profile.id === 'jsdom' || profile.id === 'chromium') &&\n ['ariaTree', 'declaredStyle', 'computedStyle', 'layout', 'raster'].every(\n (field) => typeof profile[field] === 'boolean',\n ) &&\n environment !== null &&\n typeof environment.digest === 'string' &&\n typeof environment.semanticDigest === 'string' &&\n environmentInputsShape(environment.inputs) &&\n typeof snapshot.renderHash === 'string' &&\n typeof snapshot.structureHash === 'string' &&\n typeof snapshot.styleHash === 'string' &&\n root !== null &&\n semanticNodeShape(root) &&\n Array.isArray(snapshot.styleProvenance) &&\n snapshot.styleProvenance.every(styleProvenanceShape) &&\n (snapshot.ignoreSites === undefined ||\n (Array.isArray(snapshot.ignoreSites) && snapshot.ignoreSites.every(ignoreSiteShape))) &&\n diagnosticArray(snapshot.diagnostics)\n );\n}\n\nfunction environmentInputsShape(value: unknown): boolean {\n const inputs = record(value);\n const viewport = inputs === null ? null : record(inputs.viewport);\n return inputs !== null &&\n (inputs.profile === 'jsdom' || inputs.profile === 'chromium') &&\n typeof inputs.engine === 'string' &&\n typeof inputs.ruleset === 'string' &&\n typeof inputs.allowlist === 'string' &&\n viewport !== null &&\n finiteNumber(viewport.width) &&\n finiteNumber(viewport.height) &&\n finiteNumber(viewport.deviceScaleFactor) &&\n (viewport.colorScheme === 'light' || viewport.colorScheme === 'dark') &&\n stringArray(inputs.fonts) &&\n scalarRecord(inputs.conditions) &&\n stringRecord(inputs.assets) &&\n (inputs.stabilization === undefined || typeof inputs.stabilization === 'string');\n}\n\nfunction styleProvenanceShape(value: unknown): boolean {\n const entry = record(value);\n if (entry === null ||\n typeof entry.path !== 'string' ||\n typeof entry.property !== 'string' ||\n typeof entry.sheet !== 'string' ||\n typeof entry.selector !== 'string' ||\n (entry.tokenName !== undefined && typeof entry.tokenName !== 'string')) return false;\n if (entry.source === undefined) return true;\n const source = record(entry.source);\n return source !== null && typeof source.file === 'string' && finiteNumber(source.line);\n}\n\nfunction semanticNodeShape(node: Record<string, unknown>): boolean {\n return (\n typeof node.path === 'string' &&\n typeof node.tag === 'string' &&\n optionalString(node.alias) &&\n optionalString(node.role) &&\n optionalString(node.name) &&\n optionalString(node.description) &&\n (node.state === undefined || scalarRecord(node.state)) &&\n stringRecord(node.attributes) &&\n stringRecord(node.style) &&\n (node.tokens === undefined || stringRecord(node.tokens)) &&\n (node.styleTokens === undefined || stringRecord(node.styleTokens)) &&\n (node.rect === undefined || rectShape(node.rect)) &&\n optionalString(node.text) &&\n (node.provenance === undefined || provenanceShape(node.provenance)) &&\n (node.wiring === undefined || wiringShape(node.wiring)) &&\n (node.portalled === undefined || typeof node.portalled === 'boolean') &&\n (node.ignoredBy === undefined || stringArray(node.ignoredBy)) &&\n Array.isArray(node.children) &&\n node.children.every((child) => {\n const parsed = record(child);\n return parsed !== null && semanticNodeShape(parsed);\n })\n );\n}\n\nfunction ignoreSiteShape(value: unknown): boolean {\n const site = record(value);\n return site !== null &&\n typeof site.path === 'string' &&\n typeof site.rule === 'string' &&\n (site.rect === undefined || rectShape(site.rect));\n}\n\nfunction rectShape(value: unknown): boolean {\n const rect = record(value);\n return rect !== null &&\n finiteNumber(rect.x) &&\n finiteNumber(rect.y) &&\n finiteNumber(rect.width) &&\n finiteNumber(rect.height);\n}\n\nfunction provenanceShape(value: unknown): boolean {\n const provenance = record(value);\n return provenance !== null &&\n Array.isArray(provenance.owners) &&\n provenance.owners.every(ownerShape) &&\n optionalString(provenance.createdBy) &&\n (provenance.source === undefined || sourceLocationShape(provenance.source)) &&\n (provenance.stack === undefined ||\n (Array.isArray(provenance.stack) && provenance.stack.every(stackFrameShape)));\n}\n\nfunction ownerShape(value: unknown): boolean {\n const owner = record(value);\n return owner !== null &&\n typeof owner.name === 'string' &&\n typeof owner.propsDigest === 'string' &&\n optionalString(owner.createdBy);\n}\n\nfunction sourceLocationShape(value: unknown): boolean {\n const source = record(value);\n return source !== null &&\n typeof source.file === 'string' &&\n finiteNumber(source.line) &&\n finiteNumber(source.column);\n}\n\nfunction stackFrameShape(value: unknown): boolean {\n const frame = record(value);\n return frame !== null &&\n typeof frame.url === 'string' &&\n finiteNumber(frame.line) &&\n finiteNumber(frame.column) &&\n optionalString(frame.function);\n}\n\nfunction wiringShape(value: unknown): boolean {\n const wiring = record(value);\n return wiring !== null &&\n (wiring.hooks === undefined || stringArray(wiring.hooks)) &&\n (wiring.wrappers === undefined ||\n (Array.isArray(wiring.wrappers) &&\n wiring.wrappers.every((entry) => entry === 'memo' || entry === 'forwardRef'))) &&\n (wiring.contexts === undefined || stringArray(wiring.contexts)) &&\n optionalString(wiring.key);\n}\n\nfunction sourceShape(value: unknown): boolean {\n const source = record(value);\n return source !== null && Object.values(source).every((refs) =>\n Array.isArray(refs) && refs.every((ref) => {\n const parsed = record(ref);\n return parsed !== null &&\n typeof parsed.file === 'string' &&\n finiteNumber(parsed.line) &&\n ['function', 'const', 'class', 'declared'].includes(String(parsed.via));\n }),\n );\n}\n\nfunction attemptShape(value: unknown): boolean {\n const attempt = record(value);\n if (\n attempt === null ||\n !nonNegativeInteger(attempt.retry) ||\n !nonNegativeInteger(attempt.repeat)\n ) return false;\n if (attempt.shard === undefined) return true;\n const shard = record(attempt.shard);\n return shard !== null &&\n nonNegativeInteger(shard.index) &&\n nonNegativeInteger(shard.total) &&\n Number(shard.total) > 0 &&\n Number(shard.index) < Number(shard.total);\n}\n\nfunction diagnosticArray(value: unknown): boolean {\n return Array.isArray(value) && value.every((entry) => {\n const diagnostic = record(entry);\n return diagnostic !== null &&\n (diagnostic.severity === 'warn' || diagnostic.severity === 'error') &&\n typeof diagnostic.code === 'string' &&\n typeof diagnostic.message === 'string' &&\n (diagnostic.nodePath === undefined || typeof diagnostic.nodePath === 'string');\n });\n}\n\nfunction stringRecord(value: unknown): boolean {\n const parsed = record(value);\n return parsed !== null && Object.values(parsed).every((entry) => typeof entry === 'string');\n}\n\nfunction scalarRecord(value: unknown): boolean {\n const parsed = record(value);\n return parsed !== null && Object.values(parsed).every(\n (entry) => ['string', 'boolean', 'number'].includes(typeof entry) &&\n (typeof entry !== 'number' || Number.isFinite(entry)),\n );\n}\n\nfunction stringArray(value: unknown): boolean {\n return Array.isArray(value) && value.every((entry) => typeof entry === 'string');\n}\n\nfunction optionalString(value: unknown): boolean {\n return value === undefined || typeof value === 'string';\n}\n\nfunction finiteNumber(value: unknown): boolean {\n return typeof value === 'number' && Number.isFinite(value);\n}\n\nfunction nonNegativeInteger(value: unknown): boolean {\n return finiteNumber(value) && Number.isInteger(value) && Number(value) >= 0;\n}\n\nfunction base64(value: string): boolean {\n if (value.length % 4 !== 0 || !/^[A-Za-z0-9+/]*={0,2}$/.test(value)) return false;\n return Buffer.from(value, 'base64').toString('base64') === value;\n}\n"]}
@@ -0,0 +1,44 @@
1
+ import { type SubjectRef } from '@variance-authority/core';
2
+ /**
3
+ * Snapshot a value that was never rendered (spec 0031).
4
+ *
5
+ * The floor of the subject list: an API response, a generated manifest, a config
6
+ * file, a route table. It needs no browser, no `jsdom` and no dialect reader —
7
+ * which is why it ships before any of them, and why every dialect degrades to it.
8
+ */
9
+ export interface SnapshotValueOptions {
10
+ readonly subject: string | SubjectRef;
11
+ /** Where the capture is written. One fresh directory per run. */
12
+ readonly directory: string;
13
+ /** How to read the text later. Defaults to `json`. */
14
+ readonly dialect?: string;
15
+ /** JSON Pointers whose values are volatile. Recorded as present, never compared. */
16
+ readonly drop?: readonly string[];
17
+ /** JSON Pointers whose values become a stable token of your choosing. */
18
+ readonly replace?: Readonly<Record<string, string>>;
19
+ /** For an array of records, the member that identifies a row. */
20
+ readonly arrayKey?: Readonly<Record<string, string>>;
21
+ /** What emitted the value, when something did. */
22
+ readonly generator?: {
23
+ readonly name: string;
24
+ readonly version: string;
25
+ };
26
+ }
27
+ /**
28
+ * Shape a value, address it by content, and write it where a later `variance
29
+ * run` will read it. Returns the path written.
30
+ *
31
+ * **It does not compare, and it does not fail your test.** That is the same
32
+ * contract `capture` has, for the same reason: the baseline is not present in a
33
+ * unit-test process, and a comparison written here would be a second, weaker copy
34
+ * of the run — one that could not see the other subjects, could not reach the
35
+ * store, and could not be approved. The loop is `variance run`, which is the same
36
+ * command locally and in CI.
37
+ *
38
+ * What it *will* fail on is a value that cannot be one. A function, a `Date`, a
39
+ * `bigint` or a non-finite number throws, naming the JSON Pointer where it was
40
+ * found — because the alternative is to drop it silently, and a key missing from
41
+ * the text reads downstream as a key that was removed.
42
+ */
43
+ export declare function snapshotValue(value: unknown, options: SnapshotValueOptions): Promise<string>;
44
+ //# sourceMappingURL=value.d.ts.map
package/dist/value.js ADDED
@@ -0,0 +1,37 @@
1
+ import { shapeValue } from '@variance-authority/core';
2
+ import { writeCapture } from './archive.js';
3
+ /**
4
+ * Shape a value, address it by content, and write it where a later `variance
5
+ * run` will read it. Returns the path written.
6
+ *
7
+ * **It does not compare, and it does not fail your test.** That is the same
8
+ * contract `capture` has, for the same reason: the baseline is not present in a
9
+ * unit-test process, and a comparison written here would be a second, weaker copy
10
+ * of the run — one that could not see the other subjects, could not reach the
11
+ * store, and could not be approved. The loop is `variance run`, which is the same
12
+ * command locally and in CI.
13
+ *
14
+ * What it *will* fail on is a value that cannot be one. A function, a `Date`, a
15
+ * `bigint` or a non-finite number throws, naming the JSON Pointer where it was
16
+ * found — because the alternative is to drop it silently, and a key missing from
17
+ * the text reads downstream as a key that was removed.
18
+ */
19
+ export async function snapshotValue(value, options) {
20
+ const subject = typeof options.subject === 'string' ? { id: options.subject, kind: 'value' } : options.subject;
21
+ const artifact = {
22
+ artifactVersion: 1,
23
+ subject,
24
+ material: {
25
+ kind: 'value',
26
+ value: shapeValue(value, {
27
+ ...(options.dialect === undefined ? {} : { dialect: options.dialect }),
28
+ ...(options.drop === undefined ? {} : { drop: options.drop }),
29
+ ...(options.replace === undefined ? {} : { replace: options.replace }),
30
+ ...(options.arrayKey === undefined ? {} : { arrayKey: options.arrayKey }),
31
+ ...(options.generator === undefined ? {} : { generator: options.generator }),
32
+ }),
33
+ },
34
+ };
35
+ return writeCapture(options.directory, artifact);
36
+ }
37
+ //# sourceMappingURL=value.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"value.js","sourceRoot":"","sources":["../src/value.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAyC,MAAM,0BAA0B,CAAC;AAC7F,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AA0B5C;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,KAAc,EACd,OAA6B;IAE7B,MAAM,OAAO,GACX,OAAO,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC;IAEjG,MAAM,QAAQ,GAAoB;QAChC,eAAe,EAAE,CAAC;QAClB,OAAO;QACP,QAAQ,EAAE;YACR,IAAI,EAAE,OAAO;YACb,KAAK,EAAE,UAAU,CAAC,KAAK,EAAE;gBACvB,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;gBACtE,GAAG,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;gBAC7D,GAAG,CAAC,OAAO,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC;gBACtE,GAAG,CAAC,OAAO,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,CAAC;gBACzE,GAAG,CAAC,OAAO,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,CAAC;aAC7E,CAAC;SACH;KACF,CAAC;IAEF,OAAO,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AACnD,CAAC","sourcesContent":["import { shapeValue, type CaptureArtifact, type SubjectRef } from '@variance-authority/core';\nimport { writeCapture } from './archive.js';\n\n/**\n * Snapshot a value that was never rendered (spec 0031).\n *\n * The floor of the subject list: an API response, a generated manifest, a config\n * file, a route table. It needs no browser, no `jsdom` and no dialect reader —\n * which is why it ships before any of them, and why every dialect degrades to it.\n */\n\nexport interface SnapshotValueOptions {\n readonly subject: string | SubjectRef;\n /** Where the capture is written. One fresh directory per run. */\n readonly directory: string;\n /** How to read the text later. Defaults to `json`. */\n readonly dialect?: string;\n /** JSON Pointers whose values are volatile. Recorded as present, never compared. */\n readonly drop?: readonly string[];\n /** JSON Pointers whose values become a stable token of your choosing. */\n readonly replace?: Readonly<Record<string, string>>;\n /** For an array of records, the member that identifies a row. */\n readonly arrayKey?: Readonly<Record<string, string>>;\n /** What emitted the value, when something did. */\n readonly generator?: { readonly name: string; readonly version: string };\n}\n\n/**\n * Shape a value, address it by content, and write it where a later `variance\n * run` will read it. Returns the path written.\n *\n * **It does not compare, and it does not fail your test.** That is the same\n * contract `capture` has, for the same reason: the baseline is not present in a\n * unit-test process, and a comparison written here would be a second, weaker copy\n * of the run — one that could not see the other subjects, could not reach the\n * store, and could not be approved. The loop is `variance run`, which is the same\n * command locally and in CI.\n *\n * What it *will* fail on is a value that cannot be one. A function, a `Date`, a\n * `bigint` or a non-finite number throws, naming the JSON Pointer where it was\n * found — because the alternative is to drop it silently, and a key missing from\n * the text reads downstream as a key that was removed.\n */\nexport async function snapshotValue(\n value: unknown,\n options: SnapshotValueOptions,\n): Promise<string> {\n const subject: SubjectRef =\n typeof options.subject === 'string' ? { id: options.subject, kind: 'value' } : options.subject;\n\n const artifact: CaptureArtifact = {\n artifactVersion: 1,\n subject,\n material: {\n kind: 'value',\n value: shapeValue(value, {\n ...(options.dialect === undefined ? {} : { dialect: options.dialect }),\n ...(options.drop === undefined ? {} : { drop: options.drop }),\n ...(options.replace === undefined ? {} : { replace: options.replace }),\n ...(options.arrayKey === undefined ? {} : { arrayKey: options.arrayKey }),\n ...(options.generator === undefined ? {} : { generator: options.generator }),\n }),\n },\n };\n\n return writeCapture(options.directory, artifact);\n}\n"]}
package/mark.svg ADDED
@@ -0,0 +1,30 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 320" role="img" aria-labelledby="title desc">
2
+ <title id="title">Variance Authority mark</title>
3
+ <desc id="desc">Folded ribbon VA mark in charcoal and orange.</desc>
4
+
5
+ <defs>
6
+ <style>
7
+ .ribbon-dark {
8
+ fill: #24282A;
9
+ }
10
+
11
+ @media (prefers-color-scheme: dark) {
12
+ .ribbon-dark {
13
+ fill: #F3F4F6;
14
+ }
15
+ }
16
+ </style>
17
+ </defs>
18
+
19
+ <!-- Left descending ribbon -->
20
+ <path class="ribbon-dark" d="M64 54H159L256 266H160Z"/>
21
+
22
+ <!-- Right descending ribbon -->
23
+ <path class="ribbon-dark" d="M331 28H419L494 266H397Z"/>
24
+
25
+ <!-- Chosen / variant ribbon -->
26
+ <path d="M256 266L202 152L283 28H376L301 165Z" fill="#FF4A19"/>
27
+
28
+ <!-- Fold shadow -->
29
+ <path d="M202 152L256 266L301 165L264 103Z" fill="#D83A13" opacity="0.72"/>
30
+ </svg>
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@variance-authority/unit-test",
3
+ "version": "0.1.0",
4
+ "description": "Capture a mounted DOM subject in a browserless Jest or Vitest process, then render and observe it later.",
5
+ "keywords": [
6
+ "variance-authority",
7
+ "visual-regression",
8
+ "visual-testing",
9
+ "vitest",
10
+ "jest",
11
+ "jsdom",
12
+ "component-testing"
13
+ ],
14
+ "license": "MIT",
15
+ "author": "Machine Garden",
16
+ "homepage": "https://variance-authority.dev#packages",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/Variance-Authority/variance-authority.git",
20
+ "directory": "packages/unit-test"
21
+ },
22
+ "bugs": "https://github.com/Variance-Authority/variance-authority/issues",
23
+ "engines": {
24
+ "node": ">=22"
25
+ },
26
+ "type": "module",
27
+ "exports": {
28
+ ".": {
29
+ "types": "./dist/index.d.ts",
30
+ "default": "./dist/index.js"
31
+ }
32
+ },
33
+ "main": "./dist/index.js",
34
+ "types": "./dist/index.d.ts",
35
+ "files": [
36
+ "dist",
37
+ "!dist/**/*.d.ts.map",
38
+ "mark.svg"
39
+ ],
40
+ "scripts": {
41
+ "build": "tsc --build"
42
+ },
43
+ "dependencies": {
44
+ "@variance-authority/core": "^0.1.0",
45
+ "@variance-authority/dom": "^0.1.0"
46
+ },
47
+ "devDependencies": {
48
+ "@types/react": "^19.0.0",
49
+ "@types/react-dom": "^19.0.0",
50
+ "@variance-authority/react": "^0.1.0",
51
+ "jsdom": "^30.0.1",
52
+ "react": "^19.0.0",
53
+ "react-dom": "^19.0.0"
54
+ }
55
+ }