test(auth): use supabase cli where possible - docker for extra tests #1985
+1,002
−401
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.
Summary
This PR migrates the
auth-jstest infrastructure from a multi-instance Docker Compose setup to a single Supabase CLI instance for the majority of tests, while preserving Docker-based tests for edge cases that require specific GoTrue configurations.Motivation
The original
auth-jstest setup used Docker Compose to run 4 separate GoTrue instances with different configurations:We have decided to move our test suites to use the
supabaseCLI wherever possible. It provides a simpler, faster alternative that covers the majority of test scenarios with a single instance.Changes
New Test Structure
Test Distribution
test:authtest:dockerDocker-Only Tests (11 total)
These tests require GoTrue configurations not possible with a single CLI instance:
Signup Disabled (1 test)
GOTRUE_DISABLE_SIGNUP=trueAsymmetric JWT / RS256 (3 tests)
Phone OTP / SMS (6 tests)
Anonymous Sign-in Disabled (1 test)
GOTRUE_EXTERNAL_ANONYMOUS_USERS_ENABLED=falseTargets/Scripts to run
test:authtest:infratest:suitetest:dockertest:docker:infratest:docker:suiteSupabase CLI Configuration
Key settings in
test/supabase/config.toml:How to Test
Run CLI tests locally
Run Docker tests locally
Bug Fixes
This PR also fixes a pre-existing test bug:
fetchJwktests were overridingauthWithSession['fetch']with a mock but never restoring it. This caused subsequent tests (likesignInAnonymously) to fail because they used the mocked fetch that returned JWKS data instead of auth responses. Fixed by addingbeforeEach/afterEachto save and restore the original fetch.