Skip to content

Comments

Better linting#53

Merged
ForestMars merged 11 commits intomainfrom
better-linting
Nov 21, 2025
Merged

Better linting#53
ForestMars merged 11 commits intomainfrom
better-linting

Conversation

@ForestMars
Copy link
Owner

@ForestMars ForestMars commented Nov 21, 2025

This PR addresses the critical performance bottleneck caused by running IndexedDB tests in a native runtime environment.

Hybrid Testing Environment Setup

This PR mainly adds the 'db' tags to the ~35 tests that involve Dexie/IndexedDB. These tests cannot be run under jsdom which does not provide support for this API.

The goal here is to be able to majority of the test suite with jsdom, for reasons of speed, avoiding the setup/teardown costs of running them under Bun, while being able to only run the tests that need the API for Dexie/IndexedDB using Bun.

The Problem: Performance vs. Accuracy

Currently, tests that use Dexie/IndexedDB fail when run in the default fast jsdom environment because it lacks the necessary Web APIs (IndexedDB). However, running the entire suite under the bun environment is excessively slow (e.g., 5+ minutes) due to the high setup/teardown cost of the native persistence layer.

The Solution (Phases 1 & 2)

This PR is part one of implementing a Hybrid Testing Strategy.

  1. Phase 1: (This PR) Tagging
    • Adds the db tag to approximately 35 tests (or describe blocks) that directly interact with Dexie or IndexedDB.
  2. Phase 2: (Follow-up PR) Configuration
    • Will introduce a vitest.config.ts change using Vitest Projects
    • We will define two distinct test harnesses:
      • unit-tests: Uses the default jsdom environment for maximum speed.
      • db-tests: Uses the bun environment, runs only tests with the #db tag, and uses a longer timeout.

This allows us to maintain the fast 2-second feedback loop for general unit testing while guaranteeing correctness for the persistence layer.

NB. This is part one that adds the necessary tags. In part two we will define two different test harnesses for these two respective test areas.

@ForestMars ForestMars merged commit 9e36e40 into main Nov 21, 2025
6 of 9 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