Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
jsdomenvironment because it lacks the necessary Web APIs (IndexedDB). However, running the entire suite under thebunenvironment 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.
dbtag to approximately 35 tests (ordescribeblocks) that directly interact with Dexie or IndexedDB.vitest.config.tschange using Vitest Projectsunit-tests: Uses the defaultjsdomenvironment for maximum speed.db-tests: Uses thebunenvironment, runs only tests with the#dbtag, 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.