Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom Sentry.runZoneGuarded zone creation #2088

Merged
merged 34 commits into from
Dec 9, 2024
Merged
Changes from 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
d248b9c
update
buenaflor Jun 6, 2024
34ea139
update
buenaflor Jun 6, 2024
f6fa1ac
Merge branch 'main' into fix/runzoneguarded
buenaflor Jun 24, 2024
e6f647a
Merge branch 'main' into fix/runzoneguarded
denrase Nov 20, 2024
3f0f7d9
remove sample code
denrase Nov 20, 2024
4b77b41
provide sentry wrapped runZonedGuarded
denrase Nov 20, 2024
b8b75a7
Merge branch 'main' into fix/runzoneguarded
denrase Nov 26, 2024
ce1f67c
Refactorings, add missing tests, add documentation
denrase Nov 26, 2024
c622fb5
Merge branch 'main' into fix/runzoneguarded
denrase Nov 26, 2024
5a4b37e
update docs
denrase Nov 26, 2024
d7eb8c3
Update changelog entry
denrase Nov 26, 2024
8fcc89c
format
denrase Nov 26, 2024
ff275ca
format
denrase Nov 26, 2024
1ef5eb2
add check to sentry flutter tests
denrase Nov 26, 2024
846639e
replace flaky debounce tests with completers
denrase Nov 26, 2024
20261fb
Merge branch 'main' into fix/runzoneguarded
buenaflor Nov 28, 2024
30d7800
Merge branch 'main' into fix/runzoneguarded
denrase Dec 2, 2024
f9e4beb
warn user if sentry runZonedGuarded should be used
denrase Dec 2, 2024
cb66907
updated comments
denrase Dec 2, 2024
4e550cc
update changelog
denrase Dec 2, 2024
321b584
remove redundant imports
denrase Dec 2, 2024
6634f0d
fix mock
denrase Dec 2, 2024
2ef2edf
fix docs
denrase Dec 2, 2024
13d245e
Merge branch 'main' into fix/runzoneguarded
denrase Dec 3, 2024
8d4d527
remove flaky warning
denrase Dec 3, 2024
90a88c9
only test for throw
denrase Dec 3, 2024
705a12e
fix import and changelog
denrase Dec 3, 2024
4b1e6c7
fix import
denrase Dec 3, 2024
c530deb
close sdk between tests
denrase Dec 3, 2024
2822764
format
denrase Dec 3, 2024
cc0cedd
run sentry close in test
denrase Dec 3, 2024
3da310e
format
denrase Dec 3, 2024
15f8d73
Merge branch 'main' into fix/runzoneguarded
buenaflor Dec 5, 2024
d23edf9
update test group name
denrase Dec 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
close sdk between tests
  • Loading branch information
denrase committed Dec 3, 2024
commit c530deb3eceb48c71ce7b2d027e46d56203ad25f
33 changes: 26 additions & 7 deletions dart/test/sentry_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,10 @@ void main() {
group('Sentry init optionsConfiguration', () {
final fixture = Fixture();

tearDown(() async {
await Sentry.close();
});

test('throw is handled and logged', () async {
final sentryOptions = defaultTestOptions()
..automatedTestMode = false
Expand All @@ -468,15 +472,30 @@ void main() {
expect(fixture.loggedLevel, SentryLevel.error);
});
});

group('Sentry runZonedGuarded', () {

test('calling runZonedGuarded before init does not throw', () async {
final completer = Completer<void>();
Sentry.runZonedGuarded(() {
throw Exception("run zoned guarded exception");
}, (error, stackTrace) {
completer.complete();
tearDown(() async {
await Sentry.close();
});

test('calling runZonedGuarded before init does not throw', () async {
var expected = Exception("run zoned guarded exception");
Object? actual;

final completer = Completer<void>();
Sentry.runZonedGuarded(() {
throw expected;
}, (error, stackTrace) {
actual = error;
completer.complete();
});

await completer.future;

expect(actual, isNotNull);
expect(actual, expected);
});
await completer.future;
});
}

Expand Down
Loading