From a3ea39961eb6a690c8f3a751ed47300c94aaebd3 Mon Sep 17 00:00:00 2001 From: Denis Andrasec Date: Tue, 3 Oct 2023 15:22:25 +0200 Subject: [PATCH] Rename `options.devMode` to `options.automatedTestMode` Closes #1620 --- dart/lib/src/hub.dart | 4 +- dart/lib/src/scope.dart | 4 +- dart/lib/src/sentry.dart | 2 +- dart/lib/src/sentry_client.dart | 4 +- dart/lib/src/sentry_options.dart | 4 +- dart/lib/src/sentry_traces_sampler.dart | 2 +- dart/test/environment_test.dart | 4 +- .../deduplication_event_processor_test.dart | 2 +- .../enricher/io_enricher_test.dart | 2 +- dart/test/initialization_test.dart | 4 +- dart/test/sentry_test.dart | 40 +++++++++---------- e2e_test/bin/e2e_test.dart | 2 +- flutter/test/initialization_test.dart | 8 ++-- flutter/test/sentry_flutter_test.dart | 28 ++++++------- 14 files changed, 55 insertions(+), 55 deletions(-) diff --git a/dart/lib/src/hub.dart b/dart/lib/src/hub.dart index 855f2b9438..2693996d2a 100644 --- a/dart/lib/src/hub.dart +++ b/dart/lib/src/hub.dart @@ -277,7 +277,7 @@ class Hub { exception: exception, stackTrace: stackTrace, ); - if (_options.devMode) { + if (_options.automatedTestMode) { rethrow; } } @@ -377,7 +377,7 @@ class Hub { SentryLevel.error, "Error in the 'configureScope' callback, error: $err", ); - if (_options.devMode) { + if (_options.automatedTestMode) { rethrow; } } diff --git a/dart/lib/src/scope.dart b/dart/lib/src/scope.dart index 0a63badc92..4f36895131 100644 --- a/dart/lib/src/scope.dart +++ b/dart/lib/src/scope.dart @@ -178,7 +178,7 @@ class Scope { exception: exception, stackTrace: stackTrace, ); - if (_options.devMode) { + if (_options.automatedTestMode) { rethrow; } } @@ -345,7 +345,7 @@ class Scope { exception: exception, stackTrace: stackTrace, ); - if (_options.devMode) { + if (_options.automatedTestMode) { rethrow; } } diff --git a/dart/lib/src/sentry.dart b/dart/lib/src/sentry.dart index b3ec82ce10..88fdd42996 100644 --- a/dart/lib/src/sentry.dart +++ b/dart/lib/src/sentry.dart @@ -58,7 +58,7 @@ class Sentry { exception: exception, stackTrace: stackTrace, ); - if (sentryOptions.devMode) { + if (sentryOptions.automatedTestMode) { rethrow; } } diff --git a/dart/lib/src/sentry_client.dart b/dart/lib/src/sentry_client.dart index a2af9c47b2..b3508db4d1 100644 --- a/dart/lib/src/sentry_client.dart +++ b/dart/lib/src/sentry_client.dart @@ -401,7 +401,7 @@ class SentryClient { exception: exception, stackTrace: stackTrace, ); - if (_options.devMode) { + if (_options.automatedTestMode) { rethrow; } } @@ -438,7 +438,7 @@ class SentryClient { exception: exception, stackTrace: stackTrace, ); - if (_options.devMode) { + if (_options.automatedTestMode) { rethrow; } } diff --git a/dart/lib/src/sentry_options.dart b/dart/lib/src/sentry_options.dart index 55450be9dd..76d3365386 100644 --- a/dart/lib/src/sentry_options.dart +++ b/dart/lib/src/sentry_options.dart @@ -353,10 +353,10 @@ class SentryOptions { /// are set. bool? enableTracing; - /// Changed SDK behaviour when set to true: + /// Only for internal use. Changed SDK behaviour when set to true: /// - Rethrow exceptions that occur in user provided closures @internal - bool devMode = false; + bool automatedTestMode = false; SentryOptions({this.dsn, PlatformChecker? checker}) { if (checker != null) { diff --git a/dart/lib/src/sentry_traces_sampler.dart b/dart/lib/src/sentry_traces_sampler.dart index 62d94dc339..06ab2edcea 100644 --- a/dart/lib/src/sentry_traces_sampler.dart +++ b/dart/lib/src/sentry_traces_sampler.dart @@ -40,7 +40,7 @@ class SentryTracesSampler { exception: exception, stackTrace: stackTrace, ); - if (_options.devMode) { + if (_options.automatedTestMode) { rethrow; } } diff --git a/dart/test/environment_test.dart b/dart/test/environment_test.dart index 6a409022c5..e4bf97fea7 100644 --- a/dart/test/environment_test.dart +++ b/dart/test/environment_test.dart @@ -23,7 +23,7 @@ void main() { release: 'release-9.8.7', dist: 'bar', ); - options.devMode = true; + options.automatedTestMode = true; await Sentry.init( (options) => options, @@ -44,7 +44,7 @@ void main() { release: 'release-9.8.7', dist: 'bar', ); - options.devMode = true; + options.automatedTestMode = true; await Sentry.init( (options) => options, diff --git a/dart/test/event_processor/deduplication_event_processor_test.dart b/dart/test/event_processor/deduplication_event_processor_test.dart index 47540cf035..54592351bb 100644 --- a/dart/test/event_processor/deduplication_event_processor_test.dart +++ b/dart/test/event_processor/deduplication_event_processor_test.dart @@ -77,7 +77,7 @@ void main() { final transport = MockTransport(); - final options = SentryOptions(dsn: fakeDsn)..devMode = true; + final options = SentryOptions(dsn: fakeDsn)..automatedTestMode = true; await Sentry.init( (options) { options.dsn = fakeDsn; diff --git a/dart/test/event_processor/enricher/io_enricher_test.dart b/dart/test/event_processor/enricher/io_enricher_test.dart index eb4a821de7..1704960edc 100644 --- a/dart/test/event_processor/enricher/io_enricher_test.dart +++ b/dart/test/event_processor/enricher/io_enricher_test.dart @@ -159,7 +159,7 @@ void main() { }); test('$IoEnricherEventProcessor gets added on init', () async { - final options = SentryOptions(dsn: fakeDsn)..devMode = true; + final options = SentryOptions(dsn: fakeDsn)..automatedTestMode = true; late SentryOptions configuredOptions; await Sentry.init( (options) { diff --git a/dart/test/initialization_test.dart b/dart/test/initialization_test.dart index fae9f26e82..7eb8c15265 100644 --- a/dart/test/initialization_test.dart +++ b/dart/test/initialization_test.dart @@ -14,7 +14,7 @@ void main() { }); test('async re-initilization', () async { - final options = SentryOptions(dsn: fakeDsn)..devMode = true; + final options = SentryOptions(dsn: fakeDsn)..automatedTestMode = true; await Sentry.init( (options) { options.dsn = fakeDsn; @@ -35,7 +35,7 @@ void main() { // This is the failure from // https://github.com/getsentry/sentry-dart/issues/508 test('re-initilization', () async { - final options = SentryOptions(dsn: fakeDsn)..devMode = true; + final options = SentryOptions(dsn: fakeDsn)..automatedTestMode = true; await Sentry.init( (options) { options.dsn = fakeDsn; diff --git a/dart/test/sentry_test.dart b/dart/test/sentry_test.dart index 2705f23161..b041f19527 100644 --- a/dart/test/sentry_test.dart +++ b/dart/test/sentry_test.dart @@ -18,7 +18,7 @@ void main() { var anException = Exception(); setUp(() async { - final options = SentryOptions(dsn: fakeDsn)..devMode = true; + final options = SentryOptions(dsn: fakeDsn)..automatedTestMode = true; await Sentry.init( options: options, (options) => { @@ -137,7 +137,7 @@ void main() { }); test('null DSN', () async { - final options = SentryOptions(dsn: fakeDsn)..devMode = true; + final options = SentryOptions(dsn: fakeDsn)..automatedTestMode = true; expect( () async => await Sentry.init( options: options, @@ -150,7 +150,7 @@ void main() { test('appRunner should be optional', () async { expect(Sentry.isEnabled, false); - final options = SentryOptions(dsn: fakeDsn)..devMode = true; + final options = SentryOptions(dsn: fakeDsn)..automatedTestMode = true; await Sentry.init( options: options, (options) => options.dsn = fakeDsn, @@ -159,7 +159,7 @@ void main() { }); test('empty DSN', () async { - final options = SentryOptions(dsn: fakeDsn)..devMode = true; + final options = SentryOptions(dsn: fakeDsn)..automatedTestMode = true; await Sentry.init( options: options, (options) => options.dsn = '', @@ -170,7 +170,7 @@ void main() { test('empty DSN disables the SDK but runs the integrations', () async { final integration = MockIntegration(); - final options = SentryOptions(dsn: fakeDsn)..devMode = true; + final options = SentryOptions(dsn: fakeDsn)..automatedTestMode = true; await Sentry.init( options: options, (options) { @@ -183,7 +183,7 @@ void main() { }); test('close disables the SDK', () async { - final options = SentryOptions(dsn: fakeDsn)..devMode = true; + final options = SentryOptions(dsn: fakeDsn)..automatedTestMode = true; await Sentry.init( options: options, (options) => options.dsn = fakeDsn, @@ -207,7 +207,7 @@ void main() { test('should install integrations', () async { final integration = MockIntegration(); - final options = SentryOptions(dsn: fakeDsn)..devMode = true; + final options = SentryOptions(dsn: fakeDsn)..automatedTestMode = true; await Sentry.init( options: options, (options) { @@ -221,7 +221,7 @@ void main() { test('should add default integrations', () async { late SentryOptions optionsReference; - final options = SentryOptions(dsn: fakeDsn)..devMode = true; + final options = SentryOptions(dsn: fakeDsn)..automatedTestMode = true; await Sentry.init( options: options, (options) { @@ -245,7 +245,7 @@ void main() { }, onPlatform: {'browser': Skip()}); test('should add only web compatible default integrations', () async { - final options = SentryOptions(dsn: fakeDsn)..devMode = true; + final options = SentryOptions(dsn: fakeDsn)..automatedTestMode = true; await Sentry.init( options: options, (options) { @@ -261,7 +261,7 @@ void main() { test('should close integrations', () async { final integration = MockIntegration(); - final options = SentryOptions(dsn: fakeDsn)..devMode = true; + final options = SentryOptions(dsn: fakeDsn)..automatedTestMode = true; await Sentry.init( options: options, (options) { @@ -277,7 +277,7 @@ void main() { }); test('$DeduplicationEventProcessor is added on init', () async { - final options = SentryOptions(dsn: fakeDsn)..devMode = true; + final options = SentryOptions(dsn: fakeDsn)..automatedTestMode = true; await Sentry.init( options: options, (options) { @@ -294,7 +294,7 @@ void main() { final completer = Completer(); var completed = false; - final options = SentryOptions(dsn: fakeDsn)..devMode = true; + final options = SentryOptions(dsn: fakeDsn)..automatedTestMode = true; final init = Sentry.init( options: options, (options) { @@ -321,7 +321,7 @@ void main() { final completer = Completer(); var completed = false; - final options = SentryOptions(dsn: fakeDsn)..devMode = true; + final options = SentryOptions(dsn: fakeDsn)..automatedTestMode = true; final init = Sentry.init( options: options, (options) { @@ -345,11 +345,11 @@ void main() { test('options.environment debug', () async { final sentryOptions = SentryOptions(dsn: fakeDsn) - ..devMode = true + ..automatedTestMode = true ..platformChecker = FakePlatformChecker.debugMode(); final options = SentryOptions(); - options.devMode = true; + options.automatedTestMode = true; await Sentry.init( (options) { options.dsn = fakeDsn; @@ -363,7 +363,7 @@ void main() { test('options.environment profile', () async { final sentryOptions = SentryOptions(dsn: fakeDsn, checker: FakePlatformChecker.profileMode()) - ..devMode = true; + ..automatedTestMode = true; await Sentry.init( (options) { @@ -378,7 +378,7 @@ void main() { test('options.environment production (defaultEnvironment)', () async { final sentryOptions = SentryOptions(dsn: fakeDsn, checker: FakePlatformChecker.releaseMode()) - ..devMode = true; + ..automatedTestMode = true; await Sentry.init( (options) { options.dsn = fakeDsn; @@ -392,7 +392,7 @@ void main() { test('options.logger is set by setting the debug flag', () async { final sentryOptions = SentryOptions(dsn: fakeDsn, checker: FakePlatformChecker.debugMode()) - ..devMode = true; + ..automatedTestMode = true; await Sentry.init( (options) { @@ -417,7 +417,7 @@ void main() { test('throw is handled and logged', () async { final sentryOptions = SentryOptions(dsn: fakeDsn) - ..devMode = false + ..automatedTestMode = false ..debug = true ..logger = fixture.mockLogger; @@ -439,7 +439,7 @@ void main() { test('throw is handled and logged', () async { final sentryOptions = SentryOptions(dsn: fakeDsn) - ..devMode = false + ..automatedTestMode = false ..debug = true ..logger = fixture.mockLogger; diff --git a/e2e_test/bin/e2e_test.dart b/e2e_test/bin/e2e_test.dart index 785f98ea72..d8d315c5e3 100644 --- a/e2e_test/bin/e2e_test.dart +++ b/e2e_test/bin/e2e_test.dart @@ -20,7 +20,7 @@ void main(List arguments) async { } final options = SentryOptions(dsn: _exampleDsn) // ignore: invalid_use_of_internal_member - ..devMode = true; + ..automatedTestMode = true; await Sentry.init( (options) { options.dsn = _exampleDsn; diff --git a/flutter/test/initialization_test.dart b/flutter/test/initialization_test.dart index cf1374df37..29d5e42c96 100644 --- a/flutter/test/initialization_test.dart +++ b/flutter/test/initialization_test.dart @@ -18,7 +18,7 @@ void main() { (options) { options.dsn = fakeDsn; // ignore: invalid_use_of_internal_member - options.devMode = true; + options.automatedTestMode = true; }, ); @@ -28,7 +28,7 @@ void main() { (options) { options.dsn = fakeDsn; // ignore: invalid_use_of_internal_member - options.devMode = true; + options.automatedTestMode = true; }, ); @@ -42,7 +42,7 @@ void main() { (options) { options.dsn = fakeDsn; // ignore: invalid_use_of_internal_member - options.devMode = true; + options.automatedTestMode = true; }, ); @@ -52,7 +52,7 @@ void main() { (options) { options.dsn = fakeDsn; // ignore: invalid_use_of_internal_member - options.devMode = true; + options.automatedTestMode = true; }, ); diff --git a/flutter/test/sentry_flutter_test.dart b/flutter/test/sentry_flutter_test.dart index 4621ae3b7f..b800d18c8d 100644 --- a/flutter/test/sentry_flutter_test.dart +++ b/flutter/test/sentry_flutter_test.dart @@ -64,7 +64,7 @@ void main() { await SentryFlutter.init( (options) async { options.dsn = fakeDsn; - options.devMode = true; + options.automatedTestMode = true; integrations = options.integrations; transport = options.transport; sentryFlutterOptions = options; @@ -112,7 +112,7 @@ void main() { await SentryFlutter.init( (options) async { options.dsn = fakeDsn; - options.devMode = true; + options.automatedTestMode = true; integrations = options.integrations; transport = options.transport; sentryFlutterOptions = options; @@ -158,7 +158,7 @@ void main() { await SentryFlutter.init( (options) async { options.dsn = fakeDsn; - options.devMode = true; + options.automatedTestMode = true; integrations = options.integrations; transport = options.transport; sentryFlutterOptions = options; @@ -204,7 +204,7 @@ void main() { await SentryFlutter.init( (options) async { options.dsn = fakeDsn; - options.devMode = true; + options.automatedTestMode = true; integrations = options.integrations; transport = options.transport; sentryFlutterOptions = options; @@ -253,7 +253,7 @@ void main() { await SentryFlutter.init( (options) async { options.dsn = fakeDsn; - options.devMode = true; + options.automatedTestMode = true; integrations = options.integrations; transport = options.transport; sentryFlutterOptions = options; @@ -302,7 +302,7 @@ void main() { await SentryFlutter.init( (options) async { options.dsn = fakeDsn; - options.devMode = true; + options.automatedTestMode = true; integrations = options.integrations; transport = options.transport; sentryFlutterOptions = options; @@ -353,7 +353,7 @@ void main() { await SentryFlutter.init( (options) async { options.dsn = fakeDsn; - options.devMode = true; + options.automatedTestMode = true; integrations = options.integrations; transport = options.transport; }, @@ -397,7 +397,7 @@ void main() { await SentryFlutter.init( (options) async { options.dsn = fakeDsn; - options.devMode = true; + options.automatedTestMode = true; integrations = options.integrations; transport = options.transport; }, @@ -440,7 +440,7 @@ void main() { await SentryFlutter.init( (options) async { options.dsn = fakeDsn; - options.devMode = true; + options.automatedTestMode = true; integrations = options.integrations; transport = options.transport; }, @@ -487,7 +487,7 @@ void main() { await SentryFlutter.init( (options) async { options.dsn = fakeDsn; - options.devMode = true; + options.automatedTestMode = true; integrations = options.integrations; }, appRunner: appRunner, @@ -510,7 +510,7 @@ void main() { await SentryFlutter.init( (options) async { options.dsn = fakeDsn; - options.devMode = true; + options.automatedTestMode = true; integrations = options.integrations; }, appRunner: appRunner, @@ -533,7 +533,7 @@ void main() { await SentryFlutter.init( (options) async { options.dsn = fakeDsn; - options.devMode = true; + options.automatedTestMode = true; integrations = options.integrations; }, appRunner: appRunner, @@ -556,7 +556,7 @@ void main() { await SentryFlutter.init( (options) async { options.dsn = fakeDsn; - options.devMode = true; + options.automatedTestMode = true; integrations = options.integrations; }, appRunner: appRunner, @@ -584,7 +584,7 @@ void main() { await SentryFlutter.init( (options) { options.dsn = fakeDsn; - options.devMode = true; + options.automatedTestMode = true; expect(false, options.debug); expect('debug', options.environment);