@crvy/rprtr 0.0.3

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.
Files changed (50) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/LICENSE +21 -0
  3. package/README.md +130 -0
  4. package/dist/chunk-BRFA7JCQ.js +729 -0
  5. package/dist/chunk-IEYNAB6M.js +263 -0
  6. package/dist/cli.d.ts +10 -0
  7. package/dist/cli.d.ts.map +1 -0
  8. package/dist/cli.js +61 -0
  9. package/dist/index.css +1335 -0
  10. package/dist/index.html +14 -0
  11. package/dist/index.js +21106 -0
  12. package/dist/is-direct-execution.d.ts +2 -0
  13. package/dist/is-direct-execution.d.ts.map +1 -0
  14. package/dist/offline-reports.d.ts +9 -0
  15. package/dist/offline-reports.d.ts.map +1 -0
  16. package/dist/report-artifact.d.ts +12 -0
  17. package/dist/report-artifact.d.ts.map +1 -0
  18. package/dist/report-state.d.ts +28 -0
  19. package/dist/report-state.d.ts.map +1 -0
  20. package/dist/report-utils.d.ts +5 -0
  21. package/dist/report-utils.d.ts.map +1 -0
  22. package/dist/reporter-utils.d.ts +3 -0
  23. package/dist/reporter-utils.d.ts.map +1 -0
  24. package/dist/reporter.d.ts +34 -0
  25. package/dist/reporter.d.ts.map +1 -0
  26. package/dist/reporter.js +393 -0
  27. package/dist/schemas.d.ts +380 -0
  28. package/dist/schemas.d.ts.map +1 -0
  29. package/dist/server/app.d.ts +16 -0
  30. package/dist/server/app.d.ts.map +1 -0
  31. package/dist/server/bun-adapter.d.ts +3 -0
  32. package/dist/server/bun-adapter.d.ts.map +1 -0
  33. package/dist/server/file-utils.d.ts +7 -0
  34. package/dist/server/file-utils.d.ts.map +1 -0
  35. package/dist/server/handlers.d.ts +21 -0
  36. package/dist/server/handlers.d.ts.map +1 -0
  37. package/dist/server/node-adapter.d.ts +3 -0
  38. package/dist/server/node-adapter.d.ts.map +1 -0
  39. package/dist/server/routes.d.ts +16 -0
  40. package/dist/server/routes.d.ts.map +1 -0
  41. package/dist/server/utils.d.ts +3 -0
  42. package/dist/server/utils.d.ts.map +1 -0
  43. package/dist/server/ws.d.ts +4 -0
  44. package/dist/server/ws.d.ts.map +1 -0
  45. package/dist/server.d.ts +4 -0
  46. package/dist/server.d.ts.map +1 -0
  47. package/dist/server.js +7 -0
  48. package/dist/types.d.ts +116 -0
  49. package/dist/types.d.ts.map +1 -0
  50. package/package.json +102 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,95 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.0.3] - 2026-04-10
9
+
10
+ ### Fixed
11
+
12
+ - Update repository URLs to match renamed GitHub repo
13
+ ## [0.0.2] - 2026-04-10
14
+ ## [0.0.1] - 2026-04-10
15
+
16
+ ### Added
17
+
18
+ - Migrate UI from React to Svelte 5
19
+ - **reporter:** Implement offline mode for reporter
20
+ - **server:** Add offline report loading on startup
21
+ - Migrate React client to Svelte 5 with Tailwind CSS v4
22
+ - Improve server logging and add new view components
23
+ - Approve without page reload, update local state optimistically
24
+ - Rework slide view with per-side card frames and clip-path clipping
25
+ - Attach baseline screenshots for passing toHaveScreenshot tests
26
+ - Extract startServer function, add CLI entry point, fix static asset paths
27
+ - Build pipeline produces reporter, server, CLI, and type declarations
28
+ - Configure package.json for npm publishing
29
+ - Add live UI updates and Git LFS for screenshots
30
+ - Add packaged offline reporter UI
31
+
32
+ ### Changed
33
+
34
+ - Consolidate into single package, fix Svelte build
35
+ - Remove CreeveyContext dependency, use local state for suite UI
36
+ - Replace Storybook naming with Playwright conventions
37
+ - Fix all lint errors, add zod schemas, modularize codebase
38
+ - Make CreeveySuite children optional and add helper functions
39
+ - Rename reporter to crvy rprtr
40
+ - Rename offline report files to shorter pattern
41
+
42
+ ### Documentation
43
+
44
+ - Add offline mode documentation
45
+ - Rewrite README for package consumers
46
+
47
+ ### Fixed
48
+
49
+ - Reporter WS queuing, treeify path, attachments→images mapping
50
+ - Type data field in OfflineEvent for type safety
51
+ - Address race condition and offline event persistence issues
52
+ - Correct assertion logic and rename misleading test
53
+ - Use fs/promises.writeFile instead of Bun.write in reporter
54
+ - Remove unused import and document offline mode limitations
55
+ - UI/UX polish — accessibility, responsive, visual design, build warning
56
+ - UI/UX polish — layout, accessibility, contrast, focus, counters
57
+ - Use CSS grid stacking in SwapView to fix image size mismatch
58
+ - Correct approve navigation, status update, baseline copy, and view fallback
59
+ - Update test selectors and refresh screenshot baselines
60
+ - Show successful screenshot tests in sidebar
61
+ - Show passing screenshot tests in report UI
62
+ - Remove stale tests on run-end and fix diff count log
63
+ - Remove incorrect baseline snapshot association and preserve images correctly
64
+ - Attach passing baseline as expected, not actual
65
+ - Reset approved flag when test fails with new diffs
66
+ - Show passing screenshot baselines after rerun
67
+ - Attach baselines for passing toHaveScreenshot tests via reporter
68
+ - Address publint and arethetypeswrong findings
69
+ - Use p-limit for concurrent file operations and fix eqeqeq errors
70
+ - Stabilize bun tests and offline fallback
71
+ - Resolve dist paths relative to test file in runtime-smoke tests
72
+ - Treat oxfmt exit code 2 as success in staged checks
73
+
74
+ ### Miscellaneous
75
+
76
+ - Add MIT LICENSE
77
+ - Add advanced linting and code quality tools from papai
78
+ - Exclude CHANGELOG.md from oxfmt formatting
79
+
80
+ ### Styling
81
+
82
+ - Format README, package.json, and tsconfig.build.json
83
+
84
+ ### Testing
85
+
86
+ - Add offline mode tests
87
+ - Rewrite offline tests with meaningful behavior validation
88
+ - Add matrix CI integration test with worker-specific offline reports
89
+ - Remove offline report files test
90
+
91
+ ### Ci
92
+
93
+ - Add GitHub Actions workflow for automated checks
94
+ ## [Unreleased]
95
+ # test
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Crvy Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,130 @@
1
+ # @crvy/rprtr
2
+
3
+ Playwright reporter with a visual regression UI for comparing and approving screenshot test diffs.
4
+
5
+ > **Pronunciation:** `crvy` sounds like "creevey," not "curvy."
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ npm install --save-dev @crvy/rprtr
11
+ ```
12
+
13
+ > **Requires:** Playwright ≥1.40, plus **Node 22+ or Bun** for the live UI server/CLI. You can install the package with npm, pnpm, yarn, or Bun.
14
+
15
+ ## Setup
16
+
17
+ Add the reporter to your `playwright.config.ts`:
18
+
19
+ ```ts
20
+ import { defineConfig } from '@playwright/test'
21
+
22
+ export default defineConfig({
23
+ reporter: [['@crvy/rprtr', { screenshotDir: './screenshots' }]],
24
+ })
25
+ ```
26
+
27
+ ## Viewing Results
28
+
29
+ Start the UI server to view and approve screenshot diffs:
30
+
31
+ ```bash
32
+ npx crvy-rprtr
33
+ ```
34
+
35
+ Other package-manager launchers work too: `pnpm dlx crvy-rprtr`, `yarn dlx crvy-rprtr`, and `bunx crvy-rprtr`.
36
+
37
+ Open http://localhost:3000 in your browser.
38
+
39
+ Every test run also writes a browser-openable static artifact:
40
+
41
+ - `./crvy-rprtr.html`
42
+
43
+ Open `crvy-rprtr.html` directly from CI artifacts or your filesystem to review results without starting a server. The static artifact is self-contained except for screenshot image files, and it is read-only; use the server-backed UI to approve screenshots.
44
+
45
+ To open downloaded CI artifacts with the full approval UI, point the CLI at the artifact directory:
46
+
47
+ ```bash
48
+ npx crvy-rprtr ./artifacts
49
+ ```
50
+
51
+ ## Reporter Options
52
+
53
+ | Option | Type | Default | Description |
54
+ | ------------------- | -------- | ------------------------------ | -------------------------------------------------- |
55
+ | `serverUrl` | `string` | `"ws://localhost:3000"` | WebSocket URL of the Crvy Rprtr server |
56
+ | `screenshotDir` | `string` | `"./screenshots"` | Directory for saving screenshot artifacts |
57
+ | `offlineReportPath` | `string` | `"./crvy-rprtr-{worker}.json"` | Path for offline report when server is unavailable |
58
+ | `reportHtmlPath` | `string` | `"./crvy-rprtr.html"` | Path for the browser-openable static report HTML |
59
+
60
+ ## Server CLI Options
61
+
62
+ ```bash
63
+ npx crvy-rprtr [artifact-dir] [options]
64
+ ```
65
+
66
+ If `artifact-dir` is provided, the CLI treats it as the directory containing:
67
+
68
+ - `report.json`
69
+ - `screenshots/`
70
+ - `crvy-rprtr-*.json`
71
+
72
+ Explicit flags override the paths derived from `artifact-dir`.
73
+
74
+ | Option | Short | Default | Description |
75
+ | ------------------ | ----- | --------------- | ----------------------------------------------------------------------------------------- |
76
+ | `--port` | `-p` | `3000` | Server port |
77
+ | `--screenshot-dir` | `-s` | `./screenshots` | Screenshot directory path |
78
+ | `--report-path` | `-r` | `./report.json` | Report JSON file path or directory containing `report.json` and `crvy-rprtr-*.json` files |
79
+
80
+ ## How It Works
81
+
82
+ 1. **During test runs:** The Playwright reporter sends test results to the server via WebSocket in real-time and records the same run for artifact export.
83
+ 2. **After tests complete:** A static `crvy-rprtr.html` artifact is written for direct browser viewing, and offline report JSON is also written if the server was unavailable.
84
+ 3. **In the browser:** The UI shows all screenshot tests with side-by-side, swap, slide, and blend diff views.
85
+ 4. **Approving changes:** Start the UI server and click "Approve" to accept a new screenshot as the baseline. The server copies the actual image to the expected snapshot location.
86
+
87
+ ## Offline Mode
88
+
89
+ When the server isn't running during tests, the reporter automatically falls back to offline mode:
90
+
91
+ - Test events are queued in memory
92
+ - On test completion, events are written to `crvy-rprtr-{index}.json`
93
+ - On test completion, a self-contained `crvy-rprtr.html` is written for direct browser review
94
+ - When the server starts, it loads and merges all `crvy-rprtr-*.json` files from the offline report directory
95
+
96
+ ## Programmatic API
97
+
98
+ ```ts
99
+ import { startServer } from '@crvy/rprtr/server'
100
+
101
+ // reportPath can be a directory (will use report.json inside)
102
+ await startServer({
103
+ port: 3000,
104
+ screenshotDir: './screenshots',
105
+ reportPath: './artifacts',
106
+ })
107
+
108
+ // Or a specific file path
109
+ await startServer({
110
+ port: 3000,
111
+ screenshotDir: './screenshots',
112
+ reportPath: './artifacts/report.json',
113
+ })
114
+ ```
115
+
116
+ The programmatic server API works in both Node 22+ and Bun.
117
+
118
+ ## Development
119
+
120
+ ```bash
121
+ bun install
122
+ bun run dev # Start dev server with HMR
123
+ bun run build # Build for production
124
+ bun run test # Run tests
125
+ bun run lint # Lint with oxlint
126
+ ```
127
+
128
+ ## License
129
+
130
+ MIT