Skip to content

feat(annotations): add debug mode with @lytics/kero logger#22

Merged
prosdev merged 1 commit into
mainfrom
feat/annotations-debug-mode
Dec 9, 2025
Merged

feat(annotations): add debug mode with @lytics/kero logger#22
prosdev merged 1 commit into
mainfrom
feat/annotations-debug-mode

Conversation

@prosdev
Copy link
Copy Markdown
Contributor

@prosdev prosdev commented Dec 9, 2025

Summary

Add structured debug logging to @lytics/playwright-annotations using @lytics/kero for troubleshooting annotation issues.

Changes

  • Added @lytics/kero as a dependency - Zero-dependency structured logger with pretty output in dev, JSON in production
  • Updated all annotation helpers with debug logging:
    • pushAnnotations
    • pushSuiteAnnotation
    • pushTestAnnotations
    • pushContentstackAnnotations
  • Updated documentation with troubleshooting section

Usage

PLAYWRIGHT_ANNOTATIONS_DEBUG=true npx playwright test

Output Example

[10:05:11] DEBUG pushSuiteAnnotation called {"testTitle":"user can view tokens","testSuiteName":"ACCOUNT_SECURITY"}
[10:05:11] DEBUG pushTestAnnotations called {...}
[10:05:11] DEBUG Looking for testSuiteName in existing annotations {"found":true,"testSuiteName":"ACCOUNT_SECURITY"}
[10:05:11] DEBUG Validation result {"valid":true,"errors":[],"warnings":[]}

Why

Teams were having trouble debugging annotation issues (e.g., testSuiteName not being set in beforeEach). This debug mode shows exactly what's happening at each step.

Changeset

Minor version bump for @lytics/playwright-annotations since we added a new dependency.

Add structured logging using @lytics/kero for troubleshooting annotation issues.

Set PLAYWRIGHT_ANNOTATIONS_DEBUG=true to enable verbose logging:
- Logs when each annotation helper is called
- Shows existing annotations at each step
- Displays validation results and errors

Features:
- Pretty output in development, JSON in production
- Structured logging with context (pkg: playwright-annotations)
- Error/warn levels for validation failures

This helps diagnose issues like missing testSuiteName in beforeEach.
@prosdev prosdev force-pushed the feat/annotations-debug-mode branch from c2d75db to 5323df6 Compare December 9, 2025 18:08
@prosdev prosdev merged commit 5bc4bdb into main Dec 9, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants