{"_id":"@averspec/approvals","_rev":"3-6e9fc14a24f48209dfa612bee9057e09","name":"@averspec/approvals","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.1":{"name":"@averspec/approvals","version":"0.1.1","keywords":["testing","approval-testing","snapshot-testing","visual-regression","aver"],"author":{"name":"Nate Jackson"},"license":"MIT","_id":"@averspec/approvals@0.1.1","maintainers":[{"name":"njackson","email":"nate@natejackson.dev"}],"homepage":"https://averspec.dev","bugs":{"url":"https://github.com/averspec/aver/issues"},"dist":{"shasum":"41f8829460b89dea09a0b79cd1990742cf806257","tarball":"https://registry.npmjs.org/@averspec/approvals/-/approvals-0.1.1.tgz","fileCount":9,"integrity":"sha512-tvmsLfNQdmBkbl6EDTMllnSb4SLKlBtMOcNXyFiiQlK/RY00SgfWcTv279Er0xLkcxh8eMEUGHVBM+t0Qp6QIA==","signatures":[{"sig":"MEYCIQCHiRoW+Q3aMF5b3TjltxIU5BscmxGZNGS8lroiQ8v9PwIhAJp0HfiBdwlkgz5L9YXVrSwGhBJKSLTEII9cxj+KgDG3","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":78660},"main":"./dist/index.cjs","type":"module","_from":"file:averspec-approvals-0.1.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=22.0.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"scripts":{"test":"vitest run","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"njackson","email":"nate@natejackson.dev"},"_resolved":"/private/var/folders/l2/3h69vz_x1t9gpwq92z7jgny80000gn/T/d5a6f65ce35c875810595956ec9a4fb4/averspec-approvals-0.1.1.tgz","_integrity":"sha512-tvmsLfNQdmBkbl6EDTMllnSb4SLKlBtMOcNXyFiiQlK/RY00SgfWcTv279Er0xLkcxh8eMEUGHVBM+t0Qp6QIA==","repository":{"url":"git+https://github.com/averspec/aver.git","type":"git","directory":"packages/approvals"},"_npmVersion":"10.9.2","description":"Approval testing for Aver","directories":{},"sideEffects":false,"_nodeVersion":"23.9.0","dependencies":{"diff":"^8.0.3"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","pngjs":"^7.0.0","vitest":"^3.0.0","pixelmatch":"^5.3.0","typescript":"^5.7.0","@types/pngjs":"^6.0.5","@averspec/core":"^0.1.1","@types/pixelmatch":"^5.2.6"},"peerDependencies":{"pngjs":"^7.0.0","pixelmatch":"^5.3.0","@averspec/core":"^0.1.1"},"peerDependenciesMeta":{"pngjs":{"optional":true},"pixelmatch":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/approvals_0.1.1_1773537239702_0.5354048526860697","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@averspec/approvals","version":"0.1.2","keywords":["testing","approval-testing","snapshot-testing","visual-regression","aver"],"author":{"name":"Nate Jackson"},"license":"MIT","_id":"@averspec/approvals@0.1.2","maintainers":[{"name":"njackson","email":"nate@natejackson.dev"}],"homepage":"https://averspec.dev","bugs":{"url":"https://github.com/averspec/aver/issues"},"dist":{"shasum":"5a310f8a289dba25fcdfdd259f11f5849dcac0d8","tarball":"https://registry.npmjs.org/@averspec/approvals/-/approvals-0.1.2.tgz","fileCount":9,"integrity":"sha512-neEBwaLIrkZ9Pazx6P7Expv/ZfAXZxYVrXWCv03BwcccXFf9Y+nJb/m77GJgEVOlxRgQJpERoqwYnrg2QZoloA==","signatures":[{"sig":"MEUCIFCc2D34oXrPhq1wP7er90ROI7/hp1puxt6ZfEcSpztYAiEAodS+hu2EczMg8yzUL4gC+3YOCvk1IBysMUMt0JHEuek=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":78693},"main":"./dist/index.cjs","type":"module","_from":"file:averspec-approvals-0.1.2.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=22.0.0"},"exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"scripts":{"test":"vitest run","build":"tsup","typecheck":"tsc --noEmit"},"_npmUser":{"name":"njackson","email":"nate@natejackson.dev"},"_resolved":"/private/var/folders/l2/3h69vz_x1t9gpwq92z7jgny80000gn/T/940c9ffe2a132d2d95b48eb281558ab0/averspec-approvals-0.1.2.tgz","_integrity":"sha512-neEBwaLIrkZ9Pazx6P7Expv/ZfAXZxYVrXWCv03BwcccXFf9Y+nJb/m77GJgEVOlxRgQJpERoqwYnrg2QZoloA==","repository":{"url":"git+https://github.com/averspec/aver.git","type":"git","directory":"packages/approvals"},"_npmVersion":"10.9.2","description":"Approval testing for Aver","directories":{},"sideEffects":false,"_nodeVersion":"23.9.0","dependencies":{"diff":"^8.0.3"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsup":"^8.0.0","pngjs":"^7.0.0","vitest":"^3.0.0","pixelmatch":"^5.3.0","typescript":"^5.7.0","@types/pngjs":"^6.0.5","@averspec/core":"^0.1.2","@types/pixelmatch":"^5.2.6"},"peerDependencies":{"pngjs":"^7.0.0","pixelmatch":"^5.3.0","@averspec/core":"^0.1.2"},"peerDependenciesMeta":{"pngjs":{"optional":true},"pixelmatch":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/approvals_0.1.2_1773553919584_0.9802416256510551","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@averspec/approvals","version":"0.1.3","description":"Approval testing for Aver","type":"module","license":"MIT","author":{"name":"Nate Jackson"},"repository":{"type":"git","url":"git+https://github.com/averspec/aver.git","directory":"packages/approvals"},"homepage":"https://averspec.dev","bugs":{"url":"https://github.com/averspec/aver/issues"},"keywords":["testing","approval-testing","snapshot-testing","visual-regression","aver"],"publishConfig":{"access":"public"},"sideEffects":false,"engines":{"node":">=22.0.0"},"main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"peerDependencies":{"pngjs":"^7.0.0","pixelmatch":"^5.3.0","@averspec/core":"^0.1.3"},"peerDependenciesMeta":{"pngjs":{"optional":true},"pixelmatch":{"optional":true}},"dependencies":{"diff":"^8.0.3"},"devDependencies":{"pngjs":"^7.0.0","pixelmatch":"^5.3.0","tsup":"^8.0.0","typescript":"^5.7.0","vitest":"^3.0.0","@types/pngjs":"^6.0.5","@types/pixelmatch":"^5.2.6","@averspec/core":"^0.1.3"},"scripts":{"build":"tsup","test":"vitest run","typecheck":"tsc --noEmit"},"_id":"@averspec/approvals@0.1.3","_integrity":"sha512-pXRSKJXMvDEnBHAZCH518Y5XQiLqcS6N5UbvXOeBwKeBStogfJo7bpf1WvYVVTRDzlKxr4EvNzAvS0lmp9HH8Q==","_resolved":"/private/var/folders/l2/3h69vz_x1t9gpwq92z7jgny80000gn/T/44a473fc7cb8f4e9ab950b2b48fa46dc/averspec-approvals-0.1.3.tgz","_from":"file:averspec-approvals-0.1.3.tgz","_nodeVersion":"23.9.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-pXRSKJXMvDEnBHAZCH518Y5XQiLqcS6N5UbvXOeBwKeBStogfJo7bpf1WvYVVTRDzlKxr4EvNzAvS0lmp9HH8Q==","shasum":"405c943e9cc4f8511cbb603308a6b45199096323","tarball":"https://registry.npmjs.org/@averspec/approvals/-/approvals-0.1.3.tgz","fileCount":9,"unpackedSize":78693,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDT0WX0duBMEHXCJSQolJGD2ggr3Yuko7XeDQNYtuAGLwIhAIZTsd07ZU5YepNUR40j55dOWqauDIiGVms0L0m/AnAJ"}]},"_npmUser":{"name":"njackson","email":"nate@natejackson.dev"},"directories":{},"maintainers":[{"name":"njackson","email":"nate@natejackson.dev"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/approvals_0.1.3_1773556922958_0.9255895736157611"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-15T01:13:59.612Z","modified":"2026-03-15T06:42:03.210Z","0.1.1":"2026-03-15T01:13:59.867Z","0.1.2":"2026-03-15T05:51:59.738Z","0.1.3":"2026-03-15T06:42:03.108Z"},"bugs":{"url":"https://github.com/averspec/aver/issues"},"author":{"name":"Nate Jackson"},"license":"MIT","homepage":"https://averspec.dev","keywords":["testing","approval-testing","snapshot-testing","visual-regression","aver"],"repository":{"type":"git","url":"git+https://github.com/averspec/aver.git","directory":"packages/approvals"},"description":"Approval testing for Aver","maintainers":[{"name":"njackson","email":"nate@natejackson.dev"}],"readme":"# @averspec/approvals\n\n> **Status: Early release.** API is stabilizing. Breaking changes will be noted in release notes.\n\nApproval testing for [Aver](../../README.md) — structural diffs and visual regression.\n\n## Install\n\n```bash\nnpm install @averspec/approvals\n```\n\nRequires `@averspec/core` as a peer dependency.\n\n## Usage\n\n### Structural Approvals\n\nUse `approve(value)` to compare text or JSON output against a saved baseline. On first run, set `AVER_APPROVE=1` to create the baseline file.\n\n```typescript\nimport { approve } from '@averspec/approvals'\n\n// In an assertion handler:\nasync function cartMatchesApproval(ctx) {\n  const cart = await ctx.getCart()\n  await approve(cart) // compares against saved .approved file\n}\n```\n\nObjects are serialized as JSON; strings are compared as plain text. When the received value differs from the approved baseline, the test fails with a diff showing exactly what changed.\n\n### Visual Approvals\n\nUse `approve.visual('name')` for screenshot-based pixel comparison. This requires a protocol with screenshotter support (e.g., `@averspec/protocol-playwright`).\n\n```typescript\nimport { approve } from '@averspec/approvals'\n\n// In an assertion handler (with a visual protocol):\nasync function pageMatchesBaseline(ctx) {\n  await approve.visual('checkout-page')\n}\n```\n\nVisual approvals capture a screenshot, compare it pixel-by-pixel against the baseline, and allow a small tolerance for subpixel rendering differences.\n\nTo create or update baselines for either mode:\n\n```bash\nAVER_APPROVE=1 npx aver run <test-file>\n```\n\n## License\n\n[MIT](../../LICENSE)\n","readmeFilename":"README.md"}