Skip to content

ci: add static feature self-tests that run on every PR#24

Merged
oahsiao merged 1 commit into
mainfrom
ci/feature-selftest
Jun 17, 2026
Merged

ci: add static feature self-tests that run on every PR#24
oahsiao merged 1 commit into
mainfrom
ci/feature-selftest

Conversation

@oahsiao

@oahsiao oahsiao commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a fast, dependency-free self-test that runs as a check on every PR, so modifying one thing can't silently break another (e.g. the keyboard shortcuts).

It is pure static analysis — no Electron, no DOM, no npm install — so it finishes in seconds on ubuntu-latest via Node's built-in test runner.

What it guards (5 checks)

  1. Syntax — every src/**/*.js passes node --check.
  2. No duplicate methods — a class can't define the same method twice. This is the exact bug that broke "Select Folder" + Alt+F (two _selectFolder methods; the later one silently shadowed the first). Verified: the pre-fix file had 2 defs, current has 1.
  3. Hotkey contract — Ctrl+F/D/T/W, Alt+F, Alt+Down, Esc stay wired, Alt+F and Esc are handled before the "user is typing" guard, and the methods they call exist on Tab.
  4. Button wiring — every data-action in index.html has a matching act() handler (no dead buttons).
  5. Signature icon — stays an inline <svg class="gh-icon"> (guards the "GH" text regression).

Runs as a PR check

.github/workflows/selftest.yml triggers on pull_request + push to main, so it shows up as a required-style status check on PRs automatically. Run locally with npm test.

Files

  • test/selftest.test.js — the suite (node --test)
  • package.json — adds the test script
  • .github/workflows/selftest.yml — the PR workflow

Extending

Add another test(...) block in test/selftest.test.js — the helpers (classesIn, tabMethodNames) are reusable.

Adds a fast, dependency-free guard (Node's built-in test runner, no Electron/DOM) that runs as a PR check to catch regressions before merge - e.g. the duplicate _selectFolder method that silently broke the Select Folder button and Alt+F.

Checks: (1) all src JS parses; (2) no class defines the same method twice; (3) global hotkeys stay wired and Alt+F/Esc are handled before the typing-target guard; (4) every data-action button has an act() handler; (5) the author signature stays an inline SVG.

- test/selftest.test.js: the suite (node --test)

- package.json: npm test script

- .github/workflows/selftest.yml: runs node --test on push/PR to main (ubuntu, no npm install)
@oahsiao oahsiao merged commit 0cadebb into main Jun 17, 2026
3 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