Skip to content

Comments

Add e2e adapter harness and restore webview build#65

Merged
jhlagado merged 7 commits intomainfrom
codex/worktree-2026-02-04
Feb 9, 2026
Merged

Add e2e adapter harness and restore webview build#65
jhlagado merged 7 commits intomainfrom
codex/worktree-2026-02-04

Conversation

@jhlagado
Copy link
Owner

@jhlagado jhlagado commented Feb 4, 2026

Summary\n- add DAP e2e test harness with a simple fixture and prebuilt artifacts\n- align fixture paths and mock VS Code workspace to load sources correctly\n- restore webview sources and build script; align ESLint/TS config for webview\n\n## Testing\n- yarn test:e2e:adapter\n- yarn lint\n- yarn build\n

Copy link
Owner Author

@jhlagado jhlagado left a comment

Choose a reason for hiding this comment

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

PR Review: Add e2e adapter harness and restore webview build

CI Status

FAILING - The e2e tests are being picked up by the regular yarn test run, but the vscode mock alias is only defined in vitest.e2e.config.ts.

Error:

Failed to load url vscode (resolved id: vscode) in src/debug/path-resolver.ts

Fix: Exclude e2e tests from the main vitest.config.ts:

// vitest.config.ts
test: {
  exclude: ['tests/e2e/**', ...configDefaults.exclude],
}

Or add the vscode alias to the main config (less clean).

Summary

This PR adds a DAP e2e test harness that exercises the full debug adapter lifecycle in-process. Good foundation for Phase 5 (test coverage).

Changes Reviewed

1. DAP Client (dap-client.ts - 200 LOC)

  • Clean implementation of DAP protocol wire format
  • Request/response with timeout handling
  • Event waiting with predicate support
  • Proper buffer management for streaming

2. Test Harness (adapter.e2e.test.ts - 130 LOC)

  • In-process adapter via PassThrough streams
  • Tests: stopOnEntry, breakpoint hit, stack trace verification
  • Mock workspace setup via vscode-mock.ts

3. Fixture (tests/e2e/fixtures/simple/)

  • Minimal Z80 program (5 lines)
  • Prebuilt artifacts (HEX, LST, d8dbg.json)
  • Complete debug80.json config

4. Separate E2E Config (vitest.e2e.config.ts)

  • Mocks vscode module via alias
  • 20s timeout for adapter startup
  • Separate test run: yarn test:e2e:adapter

Architecture

tests/e2e/
├── adapter/
│   ├── adapter.e2e.test.ts  # Test cases
│   ├── dap-client.ts        # DAP protocol client
│   └── vscode-mock.ts       # Minimal vscode stub
└── fixtures/
    └── simple/              # Minimal test project

Stats

  • 12 files changed
  • +496 / -1 lines

Verdict

Ship it once the test exclusion is fixed. Solid e2e foundation.

@jhlagado
Copy link
Owner Author

jhlagado commented Feb 8, 2026

Pushed fix for CI failure: exclude tests/e2e/** from the default vitest.config.ts run, keeping the vscode alias only in vitest.e2e.config.ts (run via yarn test:e2e:adapter).

Local: yarn test passes; yarn test:e2e:adapter passes.

Initialize protect/expand/shadow flags from SYS_CTRL so SYS_INPUT reflects protectOnReset and other latched bits.
@jhlagado
Copy link
Owner Author

jhlagado commented Feb 8, 2026

Follow-up:

  • Merged latest main into this branch to pick up recent TEC-1G changes/tests.
  • Fixed TEC-1G SYS_INPUT PROTECT/EXPAND reporting on startup by decoding the initial SYS_CTRL latch into state.protectEnabled/state.expandEnabled.
  • Bumped tests/extension/extension.test.ts per-test timeout to 20s to avoid occasional slow-import timeouts.

Local: yarn test + yarn test:e2e:adapter pass.

@jhlagado jhlagado merged commit fc648a3 into main Feb 9, 2026
2 checks 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.

1 participant