Skip to content

Commit c5d15e3

Browse files
committed
fix: disable reportIssue in tests
1 parent d91c4cf commit c5d15e3

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

Sources/Auth/AuthClient.swift

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1411,17 +1411,21 @@ public actor AuthClient {
14111411
let session = try? await session
14121412
eventEmitter.emit(.initialSession, session: session, token: token)
14131413

1414-
reportIssue(
1415-
"""
1416-
Initial session emitted after attempting to refresh the local stored session.
1417-
This is incorrect behavior and will be fixed in the next major release since it’s a breaking change.
1418-
For now, if you want to opt-in to the new behavior, add the trait `EmitLocalSessionAsInitialSession` to your Package.swift file when importing the Supabase dependency.
1419-
The new behavior ensures that the locally stored session is always emitted, regardless of its validity or expiration.
1420-
If you rely on the initial session to opt users in, you need to add an additional check for `session.isExpired` in the session.
1421-
1422-
Check https://github.com/supabase/supabase-swift/pull/822 for more information.
1423-
"""
1424-
)
1414+
// Properly expecting issues during tests isn't working as expected, I think because the reportIssue is usually triggered inside an unstructured Task
1415+
// because of this I'm disabling issue reporting during tests, so we can use it only for advising developers when running their applications.
1416+
if !isTesting {
1417+
reportIssue(
1418+
"""
1419+
Initial session emitted after attempting to refresh the local stored session.
1420+
This is incorrect behavior and will be fixed in the next major release since it’s a breaking change.
1421+
For now, if you want to opt-in to the new behavior, add the trait `EmitLocalSessionAsInitialSession` to your Package.swift file when importing the Supabase dependency.
1422+
The new behavior ensures that the locally stored session is always emitted, regardless of its validity or expiration.
1423+
If you rely on the initial session to opt users in, you need to add an additional check for `session.isExpired` in the session.
1424+
1425+
Check https://github.com/supabase/supabase-swift/pull/822 for more information.
1426+
"""
1427+
)
1428+
}
14251429
#endif
14261430
}
14271431

0 commit comments

Comments
 (0)