@vizzly-testing/cli 0.20.1-beta.0 → 0.20.1-beta.1

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 (36) hide show
  1. package/dist/cli.js +177 -2
  2. package/dist/client/index.js +144 -77
  3. package/dist/commands/doctor.js +118 -33
  4. package/dist/commands/finalize.js +8 -3
  5. package/dist/commands/init.js +13 -18
  6. package/dist/commands/login.js +42 -49
  7. package/dist/commands/logout.js +13 -5
  8. package/dist/commands/project.js +95 -67
  9. package/dist/commands/run.js +32 -6
  10. package/dist/commands/status.js +81 -50
  11. package/dist/commands/tdd-daemon.js +61 -32
  12. package/dist/commands/tdd.js +4 -25
  13. package/dist/commands/upload.js +18 -9
  14. package/dist/commands/whoami.js +40 -38
  15. package/dist/reporter/reporter-bundle.css +1 -1
  16. package/dist/reporter/reporter-bundle.iife.js +11 -11
  17. package/dist/server/handlers/tdd-handler.js +113 -7
  18. package/dist/server/http-server.js +9 -3
  19. package/dist/server/routers/baseline.js +58 -0
  20. package/dist/server/routers/dashboard.js +10 -6
  21. package/dist/server/routers/screenshot.js +32 -0
  22. package/dist/server-manager/core.js +5 -2
  23. package/dist/server-manager/operations.js +2 -1
  24. package/dist/tdd/tdd-service.js +190 -126
  25. package/dist/types/client.d.ts +25 -2
  26. package/dist/utils/colors.js +187 -39
  27. package/dist/utils/config-loader.js +3 -6
  28. package/dist/utils/context.js +228 -0
  29. package/dist/utils/output.js +449 -14
  30. package/docs/api-reference.md +173 -8
  31. package/docs/tui-elements.md +560 -0
  32. package/package.json +12 -7
  33. package/dist/report-generator/core.js +0 -315
  34. package/dist/report-generator/index.js +0 -8
  35. package/dist/report-generator/operations.js +0 -196
  36. package/dist/services/static-report-generator.js +0 -65
@@ -84,20 +84,53 @@ await vizzlyScreenshot('homepage', './screenshots/homepage.png', {
84
84
 
85
85
  ### `vizzlyFlush()`
86
86
 
87
- Wait for all queued screenshots to be processed.
87
+ Signal test completion and trigger the results summary. Call this in your test framework's global teardown to see a summary of all visual comparisons.
88
88
 
89
- **Returns:** `Promise<void>`
89
+ **Returns:** `Promise<{ success: boolean, summary: object } | null>`
90
90
 
91
- **Example:**
91
+ **Summary object:**
92
+ ```javascript
93
+ {
94
+ total: number, // Total screenshots compared
95
+ passed: number, // Screenshots that matched baseline
96
+ failed: number, // Screenshots with visual differences
97
+ new: number, // New screenshots (no baseline)
98
+ errors: number // Screenshots that failed to process
99
+ }
100
+ ```
101
+
102
+ **Example - Playwright global teardown:**
92
103
  ```javascript
104
+ // playwright.config.js or global-teardown.js
93
105
  import { vizzlyFlush } from '@vizzly-testing/cli/client';
94
106
 
95
- // Take multiple screenshots
96
- await vizzlyScreenshot('page1', screenshot1);
97
- await vizzlyScreenshot('page2', screenshot2);
107
+ export default async function globalTeardown() {
108
+ await vizzlyFlush();
109
+ }
110
+ ```
111
+
112
+ **Example - Jest/Vitest:**
113
+ ```javascript
114
+ import { vizzlyFlush } from '@vizzly-testing/cli/client';
115
+
116
+ afterAll(async () => {
117
+ await vizzlyFlush();
118
+ });
119
+ ```
120
+
121
+ When `vizzlyFlush()` is called, the TDD server prints a summary like:
98
122
 
99
- // Wait for all to be processed
100
- await vizzlyFlush();
123
+ ```
124
+ [vizzly] 8 screenshots compared
125
+
126
+ + 5 passed
127
+
128
+ ! 3 visual changes detected
129
+ - billing-settings-page
130
+ - checkout-form
131
+ - profile-page
132
+
133
+ > View changes: http://localhost:47392/dashboard
101
134
  ```
102
135
 
103
136
  ### `isVizzlyEnabled()`
@@ -664,6 +697,11 @@ Configuration loaded via cosmiconfig in this order:
664
697
  comparison: {
665
698
  threshold: number, // CIEDE2000 Delta E (default: 2.0)
666
699
  minClusterSize: number // Min cluster size for noise filtering (default: 2)
700
+ },
701
+
702
+ // Output Configuration
703
+ output: {
704
+ logLevel: string // Log level: 'debug', 'info', 'warn', 'error' (default: 'info')
667
705
  }
668
706
  }
669
707
  ```
@@ -727,6 +765,133 @@ These are set automatically when running `vizzly run` or `vizzly tdd`:
727
765
  |----------|-------------|
728
766
  | `VIZZLY_USER_AGENT` | Custom User-Agent string for API requests |
729
767
 
768
+ ## Controlling Output
769
+
770
+ Vizzly is designed to be quiet by default - it won't clutter your test runner output.
771
+
772
+ ### Default Behavior
773
+
774
+ - **During tests**: Zero output from Vizzly (test runner owns the terminal)
775
+ - **After tests**: Summary showing pass/fail counts and dashboard link
776
+
777
+ ### When is the Summary Shown?
778
+
779
+ The summary is automatically displayed in these scenarios:
780
+
781
+ 1. **`vizzly tdd run "npm test"`** - Summary shown when the test command completes
782
+ 2. **`vizzlyFlush()` called** - Summary shown when flush is called (use in global teardown)
783
+
784
+ If you're using `vizzly tdd start` (daemon mode) and running tests directly, add `vizzlyFlush()` to your test framework's global teardown to see the summary.
785
+
786
+ #### Playwright
787
+
788
+ ```javascript
789
+ // playwright.config.js
790
+ export default {
791
+ globalTeardown: './global-teardown.js'
792
+ };
793
+ ```
794
+
795
+ ```javascript
796
+ // global-teardown.js
797
+ import { vizzlyFlush } from '@vizzly-testing/cli/client';
798
+
799
+ export default async function globalTeardown() {
800
+ // Show Vizzly visual test summary (if TDD server is running)
801
+ await vizzlyFlush();
802
+
803
+ // ... your other teardown logic
804
+ }
805
+ ```
806
+
807
+ #### Jest
808
+
809
+ ```javascript
810
+ // jest.config.js
811
+ module.exports = {
812
+ globalTeardown: './global-teardown.js'
813
+ };
814
+ ```
815
+
816
+ ```javascript
817
+ // global-teardown.js
818
+ const { vizzlyFlush } = require('@vizzly-testing/cli/client');
819
+
820
+ module.exports = async () => {
821
+ await vizzlyFlush();
822
+ };
823
+ ```
824
+
825
+ #### Vitest
826
+
827
+ ```javascript
828
+ // vitest.config.js
829
+ export default {
830
+ test: {
831
+ globalSetup: './global-teardown.js'
832
+ }
833
+ };
834
+ ```
835
+
836
+ ```javascript
837
+ // global-teardown.js
838
+ import { vizzlyFlush } from '@vizzly-testing/cli/client';
839
+
840
+ export async function teardown() {
841
+ await vizzlyFlush();
842
+ }
843
+ ```
844
+
845
+ ### Example Output
846
+
847
+ ```
848
+ [vizzly] 8 screenshots compared
849
+
850
+ + 5 passed
851
+
852
+ ! 3 visual changes detected
853
+ - billing-settings-page
854
+ - checkout-form
855
+ - profile-page
856
+
857
+ > View changes: http://localhost:47392/dashboard
858
+ ```
859
+
860
+ ### Verbose Mode
861
+
862
+ Use `--verbose` or `-v` to see per-screenshot details:
863
+
864
+ ```bash
865
+ vizzly tdd run "npm test" --verbose
866
+ ```
867
+
868
+ In verbose mode, each screenshot is listed individually with diff percentages for failures.
869
+
870
+ ### Environment Variables for Output
871
+
872
+ | Variable | Description | Default |
873
+ |----------|-------------|---------|
874
+ | `VIZZLY_LOG_LEVEL` | CLI verbosity: `debug`, `info`, `warn`, `error` | `info` |
875
+ | `VIZZLY_CLIENT_LOG_LEVEL` | Client SDK verbosity (runs in test process) | `error` |
876
+
877
+ The client SDK defaults to `error` to minimize noise in test output. Set to `debug` for troubleshooting:
878
+
879
+ ```bash
880
+ VIZZLY_CLIENT_LOG_LEVEL=debug npm test
881
+ ```
882
+
883
+ ### Config File
884
+
885
+ You can also configure output settings in `vizzly.config.js`:
886
+
887
+ ```javascript
888
+ export default defineConfig({
889
+ output: {
890
+ logLevel: 'debug' // Show detailed per-screenshot output
891
+ }
892
+ });
893
+ ```
894
+
730
895
  ## Error Handling
731
896
 
732
897
  ### Client Errors