Skip to content

test: add 16 unit tests for session-parser module#218

Open
TerminalGravity wants to merge 2 commits intomainfrom
test/session-parser-coverage
Open

test: add 16 unit tests for session-parser module#218
TerminalGravity wants to merge 2 commits intomainfrom
test/session-parser-coverage

Conversation

@TerminalGravity
Copy link
Collaborator

@TerminalGravity TerminalGravity commented Mar 11, 2026

What

Adds comprehensive test coverage for src/lib/session-parser.ts — the core module that parses Claude Code session JSONL files into timeline events.

Tests (16)

  • findSessionFiles: non-existent dir, subagent discovery
  • parseSession: prompts, assistant+tool_use, corrections, errors, compaction, sub_agent_spawn, malformed JSON, empty content, epoch timestamps, unique IDs
  • parseSessionAsync: sync/async parity
  • parseAllSessions: multi-file parse, since-date filter, missing dir

Impact

Test count: 43 → 59 (+16). All pass.

Copy link
Collaborator Author

@TerminalGravity TerminalGravity left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

17 tests for session-parser — nice coverage. Combined with the state.ts tests in #208 and the git/files tests in #203, test coverage is getting solid. LGTM, ready to merge.

@TerminalGravity TerminalGravity force-pushed the test/session-parser-coverage branch from 6082ce5 to 599c6b0 Compare March 13, 2026 15:13
@TerminalGravity TerminalGravity changed the title test: add 17 unit tests for lib/session-parser.ts test: add session-parser test coverage (16 tests) Mar 13, 2026
@TerminalGravity TerminalGravity force-pushed the test/session-parser-coverage branch from 599c6b0 to 24ac25d Compare March 16, 2026 16:37
@TerminalGravity TerminalGravity changed the title test: add session-parser test coverage (16 tests) test: add 18 unit tests for session-parser.ts Mar 16, 2026
Adds a ready-to-use CLAUDE.md template that makes Claude Code
automatically run preflight_check on prompts. Users can copy it
into their project to get preflight working without manual tool calls.

Referenced from Quick Start in README and examples/README.
Covers: findSessionFiles, parseSession, parseSessionAsync, parseAllSessions
Tests include: prompt/correction detection, tool_call + sub_agent_spawn extraction,
error handling, compaction events, malformed JSON resilience, epoch timestamp
normalization, since-date filtering, and sync/async parity.
@TerminalGravity TerminalGravity force-pushed the test/session-parser-coverage branch from 24ac25d to d5bc4bc Compare March 19, 2026 15:15
@TerminalGravity TerminalGravity changed the title test: add 18 unit tests for session-parser.ts test: add 16 unit tests for session-parser module Mar 19, 2026
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.

1 participant