Skip to content

No testing framework present — blocks adding automated tests #25

Closed

Description

@nickearnshaw

Summary

The project currently has no testing framework or test suite. package.json defines only compile, watch, and vscode:prepublish scripts, there's no test runner in devDependencies, and there are no test files anywhere in the repo.

This makes it impossible to add automated tests alongside bug fixes and features, which is standard best practice — regressions (like a stale status-bar value, or pricing/aggregation miscalculations) currently can only be caught by manual F5 debugging in the Extension Development Host.

Why it matters

  • Much of the logic is pure and highly testable in isolation: cost/pricing calculation (pricing.ts), data aggregation (daily/weekly/monthly/all-time in dataLoader.ts), quota-window handling (statusBar.ts), and i18n formatting (i18n.ts).
  • Without tests, every change risks silent regressions and reviewers have no automated signal.
  • A test suite would also enable CI to gate PRs.

Proposal

Add a lightweight test setup with minimal new dependencies. A couple of viable options:

  • Node's built-in test runner (node:test + node:assert) — zero new dependencies, run compiled output via node --test out/test/. Best for the pure logic modules that don't import the vscode API.
  • @vscode/test-electron + Mocha — the official VS Code extension testing approach, needed for anything that touches the live vscode API.

A pragmatic split is to extract pure logic into dependency-free modules and cover those with node:test, reserving the heavier electron-based harness for genuinely vscode-coupled code. Adding a test npm script and a CI workflow to run it on PRs would round it out.

Happy to open a PR setting this up if it'd be welcome.

Activity

  1. Carl723000 commented on Jun 8, 2026

    @Carl723000
    Collaborator

    This is a very welcome direction, @nickearnshaw — thank you for the detailed analysis and concrete proposal, and also for your continued, high-quality contributions. Really appreciate it!

    I like the direction you're proposing. Between the two options, I'd lean toward the first one: Node's built‑in node:test runner against compiled output. Keeping zero new runtime dependencies is a big plus for maintainability.

    If you'd still like to open the PR, that would be very welcome. A quick heads‑up: I'm quite busy right now and won't be able to review until next week. When I do, I plan to run some AI‑assisted checks on the test suite — if everything looks good, I'll merge it directly for v2.0.2.

    Thanks again for your thoughtful analysis and consistent contributions. Looking forward to seeing the project get a solid test foundation! 🙌

  2. nickearnshaw commented on Jun 8, 2026

    @nickearnshaw
    ContributorAuthor

    Thanks @Carl723000, no worries on the timing, I'm going to be back at work this week after a break, so not sure when I will get the chance either. Will raise a PR when I do.

  3. Carl723000 commented on Jun 11, 2026

    @Carl723000
    Collaborator

    Just a heads-up that v2.0.2 has landed with a fair few changes. It might be worth branching your test PR off the fresh main. Looking forward to it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions