Skip to content

Bring back first-class tests for the TypeScript code #64

@ekroon

Description

@ekroon

The TypeScript part of tabctl no longer has first-class tests, at least not in a way that is wired into package.json and the normal checks.

I ran into this while addressing review comments in background.ts. AGENTS.md still refers to src/tests/unit and extension tests with a chrome stub, and we still have build/tests/unit artifacts, but the source tests and the test runner are not in the repo anymore. npm test and npm run test:unit only run Rust tests right now.

Why

This makes changes in the TypeScript code a bit awkward. Rust tests and browser integration tests cover a lot, and that works well, but for logic in src/extension/background.ts and the other TS files we are missing the fast feedback loop for small regressions.

What

Bring back a small first-class TS unit test setup for the extension and shared TS code, wired into the normal local checks. I do not think this needs to be very big, just enough to test pure logic and chrome-facing helpers with lightweight stubs.

A couple of concrete things:

  • decide what the supported TS unit test surface is
  • add a test runner and wire it into package.json and the hooks
  • either restore or replace the old src/tests/unit setup
  • update AGENTS.md and any other docs so they match reality again
  • add a couple of tests around browser-state sync, reconnect behaviour, and incognito handling, this kind of thing is exactly where the missing tests hurt

Definition of done

  • TS tests live in the repository, not only as generated build artifacts
  • there is a command in package.json that runs them
  • the command is part of normal verification
  • docs describe the real setup

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions