Skip to content

feat(supabase_flutter): default debug logging off under flutter test#1530

Merged
spydon merged 3 commits into
mainfrom
feat/default-debug-off-in-tests
Jul 6, 2026
Merged

feat(supabase_flutter): default debug logging off under flutter test#1530
spydon merged 3 commits into
mainfrom
feat/default-debug-off-in-tests

Conversation

@spydon

@spydon spydon commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

What

Makes Supabase.initialize's debug option default to false when running under flutter test, so tests no longer emit INFO/CONFIG log noise unless they explicitly opt in with debug: true.

Why

debug defaults to debug ?? kDebugMode. Under flutter test, kDebugMode is true, so every test that doesn't pass debug: false attaches the log subscription and spams the console (***** Supabase init completed *****, etc.). Rather than sprinkling debug: false across every test, this fixes the default at the source.

This is the more general fix behind #1529 (which added debug: false per call). With this change those manual additions are no longer needed, so #1529 can be closed in favor of this.

How

Reuses the existing web-safe isRunningInFlutterTest getter (already used in supabase_auth.dart, defined via the platform_stub.dart / platform_io.dart conditional import, which reads the FLUTTER_TEST env var):

_instance._debugEnable = debug ?? (kDebugMode && !isRunningInFlutterTest);

Production behavior is unchanged: isRunningInFlutterTest is false outside tests (and the web stub returns false), so the expression reduces to the previous debug ?? kDebugMode.

Verification

  • New test/debug_default_test.dart asserts the default is off under flutter test and that explicit debug: true still logs.
  • Full packages/supabase_flutter suite: all 59 tests pass with no stray supabase log output; flutter analyze --no-fatal-infos is clean.

@spydon spydon requested a review from a team as a code owner July 3, 2026 15:04
Comment thread packages/supabase_flutter/test/initialization_test.dart
Comment thread scripts/customer_testing.dart Outdated
@spydon spydon force-pushed the feat/default-debug-off-in-tests branch from 72413d8 to 0f59ac1 Compare July 6, 2026 08:12
@spydon spydon merged commit 941ee80 into main Jul 6, 2026
25 checks passed
@spydon spydon deleted the feat/default-debug-off-in-tests branch July 6, 2026 08:36
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.

3 participants