Skip to content

Commit 541a3a8

Browse files
authored
🎨 Align CLI reporter with BearDen (#280)
## Why The CLI reporter branch was still carrying the old embedded Observatory-era style contract. This brings it forward onto current main and wires the reporter to the released BearDen package while keeping CLI-specific reporter components local. ## What changed - Rebased the existing local TDD reporter branch onto latest main after the pnpm migration. - Added `@vizzly-testing/bear-den@^0.1.1` as a real CLI dependency. - Imported BearDen styles/tokens before CLI reporter-specific styles. - Kept reporter-owned components local for now, but renamed obsolete Observatory comments so BearDen is the current mental model. - Added the fresh BearDen package to the pnpm minimum-release-age allowlist. ## Verification - `pnpm run lint` passes with 3 existing optional-chain warnings. - `pnpm run build` passes. - `pnpm run test:reporter` passes: 35 passed, 5 skipped.
1 parent 63867fc commit 541a3a8

88 files changed

Lines changed: 686 additions & 9472 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

clients/static-site/src/config-schema.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ let screenshotSchema = z.object({
4646
fullPage: z.boolean().default(true),
4747
omitBackground: z.boolean().default(false),
4848
timeout: z.number().int().positive().default(45_000), // 45 seconds
49+
requestTimeout: z.number().int().positive().optional(),
4950
});
5051

5152
/**

clients/static-site/src/screenshot.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,15 @@ let DEFAULT_SCREENSHOT_TIMEOUT = 45_000;
6868
* @param {boolean} [options.fullPage=true] - Capture full page
6969
* @param {boolean} [options.omitBackground=false] - Omit background (transparent)
7070
* @param {number} [options.timeout=45000] - Screenshot timeout in ms
71+
* @param {number} [options.requestTimeout] - Vizzly request timeout in ms
7172
* @returns {Promise<Buffer>} Screenshot buffer
7273
*/
7374
export async function captureScreenshot(page, options = {}) {
7475
let {
7576
fullPage = true,
7677
omitBackground = false,
7778
timeout = DEFAULT_SCREENSHOT_TIMEOUT,
79+
requestTimeout: _requestTimeout,
7880
} = options;
7981

8082
// Playwright has built-in timeout support
@@ -105,6 +107,10 @@ export async function captureAndSendScreenshot(
105107
let properties = generateScreenshotProperties(viewport);
106108
properties.url = page.url();
107109
let screenshot = await captureScreenshot(page, screenshotOptions);
110+
let requestTimeout =
111+
screenshotOptions.requestTimeout ||
112+
screenshotOptions.timeout ||
113+
DEFAULT_SCREENSHOT_TIMEOUT;
108114

109-
await vizzlyScreenshot(name, screenshot, { properties });
115+
await vizzlyScreenshot(name, screenshot, { properties, requestTimeout });
110116
}

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"test": "node --experimental-test-coverage --test --test-concurrency=1 --test-reporter=spec $(find tests -name '*.test.js')",
7474
"test:watch": "node --test --test-reporter=spec --watch $(find tests -name '*.test.js')",
7575
"test:reporter": "playwright test --config=tests/reporter/playwright.config.js",
76-
"test:reporter:visual": "node bin/vizzly.js run \"pnpm run test:reporter\"",
76+
"test:reporter:visual": "node bin/vizzly.js tdd run \"pnpm run test:reporter\" --no-open",
7777
"test:swift:e2e": "pnpm run build && node clients/swift/scripts/run-e2e.js",
7878
"test:tui": "node --test --test-reporter=spec tests/tui/*.test.js",
7979
"test:tui:docker": "./tests/tui/run-tui-tests.sh",
@@ -92,6 +92,7 @@
9292
"registry": "https://registry.npmjs.org/"
9393
},
9494
"dependencies": {
95+
"@vizzly-testing/bear-den": "0.1.2",
9596
"@vizzly-testing/honeydiff": "^0.10.3",
9697
"ansis": "^4.2.0",
9798
"commander": "^14.0.0",

pnpm-lock.yaml

Lines changed: 27 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ minimumReleaseAge: 10080
1414
minimumReleaseAgeStrict: true
1515
minimumReleaseAgeIgnoreMissingTime: false
1616
minimumReleaseAgeExclude:
17+
- '@vizzly-testing/bear-den@0.1.2'
1718
- '@vizzly-testing/honeydiff@0.10.3'
1819
onlyBuiltDependencies:
1920
- canvas

src/cli.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ import { saveUserPath } from './utils/global-config.js';
7979
import * as output from './utils/output.js';
8080
import { getPackageVersion } from './utils/package-info.js';
8181

82-
// Custom help formatting with Observatory design system
82+
// Custom help formatting with BearDen design system
8383
const formatHelp = (cmd, helper) => {
8484
let c = colors;
8585
let lines = [];
@@ -591,7 +591,7 @@ tddCmd
591591
if (reportResult.success) {
592592
const reportUrl = getReportFileUrl(reportResult.reportPath);
593593
output.print(
594-
` ${colors.brand.textTertiary('→')} Report: ${colors.blue(reportUrl)}`
594+
` ${colors.brand.textTertiary('→')} Report: ${colors.info(reportUrl)}`
595595
);
596596
output.blank();
597597

src/client/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ function createSimpleClient(serverUrl) {
199199
let isFilePath = typeof imageBuffer === 'string';
200200
let image = isFilePath ? imageBuffer : imageBuffer.toString('base64');
201201
let type = isFilePath ? 'file-path' : 'base64';
202+
let requestTimeout = options.requestTimeout || DEFAULT_TIMEOUT_MS;
202203

203204
let properties = createScreenshotProperties(options);
204205

@@ -212,7 +213,7 @@ function createSimpleClient(serverUrl) {
212213
type,
213214
properties,
214215
},
215-
DEFAULT_TIMEOUT_MS
216+
requestTimeout
216217
);
217218
let httpMs = Date.now() - httpStart;
218219

src/commands/doctor.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,15 +242,15 @@ export async function doctorCommand(
242242
for (let item of contextItems) {
243243
if (item.type === 'success') {
244244
output.printErr(
245-
` ${colors.green('✓')} ${colors.gray(item.label)} ${colors.white(item.value)}`
245+
` ${colors.success('✓')} ${colors.brand.textMuted(item.label)} ${colors.white(item.value)}`
246246
);
247247
} else if (item.type === 'warning') {
248248
output.printErr(
249-
` ${colors.yellow('!')} ${colors.gray(item.label)} ${colors.yellow(item.value)}`
249+
` ${colors.yellow('!')} ${colors.brand.textMuted(item.label)} ${colors.yellow(item.value)}`
250250
);
251251
} else {
252252
output.printErr(
253-
` ${colors.dim('○')} ${colors.gray(item.label)} ${colors.dim(item.value)}`
253+
` ${colors.dim('○')} ${colors.brand.textMuted(item.label)} ${colors.dim(item.value)}`
254254
);
255255
}
256256
}
@@ -260,7 +260,7 @@ export async function doctorCommand(
260260
output.printErr('');
261261
output.printErr(` ${colors.dim('─'.repeat(52))}`);
262262
output.printErr(
263-
` ${colors.dim('Docs')} ${colors.cyan(colors.underline('docs.vizzly.dev'))} ${colors.dim('GitHub')} ${colors.cyan(colors.underline('github.com/vizzly-testing/cli'))}`
263+
` ${colors.dim('Docs')} ${colors.info(colors.underline('docs.vizzly.dev'))} ${colors.dim('GitHub')} ${colors.info(colors.underline('github.com/vizzly-testing/cli'))}`
264264
);
265265

266266
// Emit structured data in verbose mode (in addition to visual output)

src/commands/preview.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,7 @@ export async function previewCommand(
668668
if (result.reusedBlobs > 0) {
669669
let savedBytes = result.totalBytes - result.newBytes;
670670
output.print(
671-
` ${colors.brand.textTertiary('Deduped')} ${colors.green(result.reusedBlobs)} files (saved ${formatBytes(savedBytes)})`
671+
` ${colors.brand.textTertiary('Deduped')} ${colors.success(result.reusedBlobs)} files (saved ${formatBytes(savedBytes)})`
672672
);
673673
}
674674

@@ -680,7 +680,7 @@ export async function previewCommand(
680680

681681
output.blank();
682682
output.print(
683-
` ${colors.brand.textTertiary('Preview')} ${colors.cyan(colors.underline(result.previewUrl))}`
683+
` ${colors.brand.textTertiary('Preview')} ${colors.info(colors.underline(result.previewUrl))}`
684684
);
685685

686686
// Open in browser if requested

src/commands/run.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ export async function runCommand(
397397

398398
if (displayUrl) {
399399
output.print(
400-
` ${colors.brand.textTertiary('Results')} ${colors.cyan(colors.underline(displayUrl))}`
400+
` ${colors.brand.textTertiary('Results')} ${colors.info(colors.underline(displayUrl))}`
401401
);
402402
} else {
403403
output.print(

0 commit comments

Comments
 (0)