TUI Test coverage to avoid regressions #2430

Open
opened 2026-02-16 17:35:34 -05:00 by yindo · 4 comments
Owner

Originally created by @kommander on GitHub (Oct 31, 2025).

Opentui has testing utilities that are used for the solid bindings as well already and exposed from the package via the @opentui/core/testing entrypoint.

It supports mock key/mouse inputs and simple cell character snapshot tests.

Example usage: https://github.com/sst/opentui/blob/main/packages/solid/tests/layout.test.tsx#L7

So it could cover basic flows like:

  • pressKey("p", { ctrl: true })
  • expect snapshot to match or contain something
Originally created by @kommander on GitHub (Oct 31, 2025). Opentui has testing utilities that are used for the solid bindings as well already and exposed from the package via the `@opentui/core/testing` entrypoint. It supports mock key/mouse inputs and simple cell character snapshot tests. Example usage: https://github.com/sst/opentui/blob/main/packages/solid/tests/layout.test.tsx#L7 So it could cover basic flows like: - pressKey("p", { ctrl: true }) - expect snapshot to match or contain something
yindo added the help-wantedopentuienhancement labels 2026-02-16 17:35:34 -05:00
Author
Owner

@veracioux commented on GitHub (Nov 1, 2025):

I'll take a stab at it

@veracioux commented on GitHub (Nov 1, 2025): I'll take a stab at it
Author
Owner

@kommander commented on GitHub (Nov 2, 2025):

@veracioux have you started on this? Otherwise I will Monday morning. There is a lot of complex behaviors in the tui that constantly break because of side effects. Need to get that coverage going to stabilize.

@kommander commented on GitHub (Nov 2, 2025): @veracioux have you started on this? Otherwise I will Monday morning. There is a lot of complex behaviors in the tui that constantly break because of side effects. Need to get that coverage going to stabilize.
Author
Owner

@veracioux commented on GitHub (Nov 2, 2025):

@kommander Yes, see PR https://github.com/sst/opencode/pull/3789

@veracioux commented on GitHub (Nov 2, 2025): @kommander Yes, see PR https://github.com/sst/opencode/pull/3789
Author
Owner

@kommander commented on GitHub (Nov 2, 2025):

Oh nice, then I'll spend some time reviewing at least. For the setup I would try to not mock too much so we are actually testing the implementation and not just the rendering. I was imagining "only" mocking the sdk/server as kind of the lowest level and let the tui do whatever it does depending on the messages and events it gets. Just my two cents.

@kommander commented on GitHub (Nov 2, 2025): Oh nice, then I'll spend some time reviewing at least. For the setup I would try to not mock too much so we are actually testing the implementation and not just the rendering. I was imagining "only" mocking the sdk/server as kind of the lowest level and let the tui do whatever it does depending on the messages and events it gets. Just my two cents.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2430