Files
hermes-agent/apps/desktop/electron/desktop-log-line.test.ts
T
Chen Jin 1dbeb47497 fix(desktop): timestamp every desktop.log / RECENT LOGS line
rememberLog prepended only '[hermes] ' to each line, so desktop.log and
the in-app RECENT LOGS view carried no timestamps while agent.log and
gateway.log (Python logging) did.

Extract the line format into a small pure helper (desktop-log-line.ts)
and prefix each line with an ISO-8601 UTC timestamp shared per chunk,
matching the Python-side convention. Regression tests assert the shape
contract: timestamp + [hermes] tag + verbatim message. Fixes #84405.
2026-08-15 01:04:19 -07:00

23 lines
866 B
TypeScript

import { describe, expect, it } from 'vitest'
import { formatDesktopLogLine } from './desktop-log-line'
describe('formatDesktopLogLine', () => {
it('prefixes each line with an ISO-8601 timestamp and the hermes tag', () => {
const line = formatDesktopLogLine('[boot] Resolving Hermes backend')
// Shape contract (not a snapshot): every desktop log line starts with
// an ISO timestamp so multi-surface logs are chronologically readable.
// See #84405.
expect(line).toMatch(
/^\[\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z\] \[hermes\] \[boot\] Resolving Hermes backend$/
)
})
it('keeps the message verbatim after the prefix', () => {
const line = formatDesktopLogLine('Hermes backend exited (0)')
expect(line).toMatch(/^\[\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z\] \[hermes\] Hermes backend exited \(0\)$/)
})
})