Skip to content

Commit

Permalink
added stackTrace rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Satyam Jha committed Jan 17, 2025
1 parent 6c7c030 commit f265038
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1443,7 +1443,7 @@ packages:
source: hosted
version: "2.5.0+2"
stack_trace:
dependency: transitive
dependency: "direct main"
description:
name: stack_trace
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ dependencies:
shared_preferences: ^2.3.3
shimmer: ^3.0.0
social_share: ^2.2.1
stack_trace: ^1.11.1
syncfusion_flutter_calendar: ^27.2.5
syncfusion_flutter_datepicker: ^27.2.5
timelines: ^0.1.0
Expand Down
11 changes: 11 additions & 0 deletions test/widget_tests/pre_auth_screens/splash_screen_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:stack_trace/stack_trace.dart';
import 'package:talawa/constants/custom_theme.dart';
import 'package:talawa/locator.dart';
import 'package:talawa/router.dart' as router;
Expand Down Expand Up @@ -70,6 +71,13 @@ Widget createSplashScreenDark({ThemeMode themeMode = ThemeMode.dark}) =>
);

Future<void> main() async {
// Disable stack trace demangling for non-standard environments (e.g., CI)
FlutterError.demangleStackTrace = (StackTrace stack) {
if (stack is Trace) return stack.vmTrace;
if (stack is Chain) return stack.toTrace().vmTrace;
return stack;
};

late MockAppLinks mockAppLinks;
late MockUserConfig mockUserConfig;

Expand All @@ -88,6 +96,9 @@ Future<void> main() async {
locator.unregister<UserConfig>();
}
locator.registerSingleton<UserConfig>(mockUserConfig);

when(mockAppLinks.getInitialLink()).thenAnswer((_) async => null);
when(mockAppLinks.uriLinkStream).thenAnswer((_) => const Stream.empty());
});

tearDown(() {
Expand Down

0 comments on commit f265038

Please sign in to comment.