Skip to content

Enhance error logging test coverage in test-logging-formats.js #38

@phrazzld

Description

@phrazzld

Summary

Improve the error logging validation in test-logging-formats.js to ensure comprehensive verification of error log structure.

Current State

The error format test only checks for the presence of "stack" string in the output, but doesn't validate the complete error log structure as defined by the structured logger.

Missing Validations

  • level: "error" verification
  • error_details object structure validation
  • ✗ Proper error metadata nesting
  • ✗ Error type and message validation

Implementation

// Add to test-logging-formats.js error test section
const logEntry = JSON.parse(errorOutput.trim().split('\n')[0]);

// Verify error level
expect(logEntry.level).toBe('error');

// Verify error_details structure
expect(logEntry.error_details).toBeDefined();
expect(logEntry.error_details.stack).toContain('Error');
expect(logEntry.error_details.message).toBe('Test error message');
expect(logEntry.error_details.type).toBe('Error');

Acceptance Criteria

  • Error logs validated for correct level: "error"
  • error_details object structure verified
  • Stack trace content validated
  • Error message and type verified
  • Test provides clear failure messages for each validation

Priority

Medium - improves test robustness but doesn't block current functionality

Related

Part of structured logging test suite improvements identified in synthesis review.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestsize:SSmall: 2 points - Simple features, bug fixestype:testTesting improvements and test coverage

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions