File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed
Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change 11import 'dart:async' ;
2+ import 'dart:isolate' ;
23
34import 'package:sentry/sentry.dart' ;
45import 'package:sentry/src/dart_exception_type_identifier.dart' ;
@@ -412,7 +413,37 @@ void main() {
412413 );
413414 expect (options.debug, isFalse);
414415 });
415- });
416+
417+ test ('isolate completes when closing sentry' , () async {
418+ final onExit = ReceivePort ();
419+
420+ Future <void > _runSentry (String message) async {
421+ await Sentry .init ((options) {
422+ options
423+ ..dsn = fakeDsn
424+ ..tracesSampleRate = 1.0 ;
425+ });
426+ await Sentry .close ();
427+ }
428+
429+ final completer = Completer <void >();
430+
431+ await Isolate .spawn <String >(
432+ _runSentry,
433+ 'test' ,
434+ onExit: onExit.sendPort,
435+ );
436+
437+ var completed = false ;
438+ onExit.listen ((message) {
439+ completed = true ;
440+ completer.complete ();
441+ });
442+
443+ await completer.future;
444+ expect (completed, true );
445+ });
446+ }, testOn: 'vm' );
416447
417448 test ('should complete when appRunner is not called in runZonedGuarded' ,
418449 () async {
You can’t perform that action at this time.
0 commit comments