Skip to content

Commit

Permalink
remove devMode param from sdk inits
Browse files Browse the repository at this point in the history
  • Loading branch information
denrase committed Mar 14, 2023
1 parent 7ebcab3 commit 8285403
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 60 deletions.
2 changes: 0 additions & 2 deletions dart/lib/src/sentry.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,8 @@ class Sentry {
@internal bool callAppRunnerInRunZonedGuarded = true,
@internal RunZonedGuardedOnError? runZonedGuardedOnError,
@internal SentryOptions? options,
@internal bool devMode = false,
}) async {
final sentryOptions = options ?? SentryOptions();
sentryOptions.devMode = devMode;

await _initDefaultValues(sentryOptions);

Expand Down
4 changes: 2 additions & 2 deletions dart/test/environment_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ void main() {
release: 'release-9.8.7',
dist: 'bar',
);
options.devMode = true;

await Sentry.init(
(options) => options,
options: options,
devMode: true,
);

expect(options.dsn, fakeDsn);
Expand All @@ -44,11 +44,11 @@ void main() {
release: 'release-9.8.7',
dist: 'bar',
);
options.devMode = true;

await Sentry.init(
(options) => options,
options: options,
devMode: true,
);

expect(options.dsn, 'foo-bar');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,14 @@ void main() {

final transport = MockTransport();

final options = SentryOptions(dsn: fakeDsn)..devMode = true;
await Sentry.init(
(options) {
options.dsn = fakeDsn;
options.transport = transport;
options.enableDeduplication = true;
},
devMode: true,
options: options,
);

// The test doesn't work if `outerTestMethod` is passed as
Expand Down
9 changes: 5 additions & 4 deletions dart/test/event_processor/enricher/io_enricher_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,18 @@ void main() {
});

test('$IoEnricherEventProcessor gets added on init', () async {
late SentryOptions sentryOptions;
final options = SentryOptions(dsn: fakeDsn)..devMode = true;
late SentryOptions configuredOptions;
await Sentry.init(
(options) {
options.dsn = fakeDsn;
sentryOptions = options;
configuredOptions = options;
},
devMode: true,
options: options,
);
await Sentry.close();

final ioEnricherCount = sentryOptions.eventProcessors
final ioEnricherCount = configuredOptions.eventProcessors
.whereType<IoEnricherEventProcessor>()
.length;
expect(ioEnricherCount, 1);
Expand Down
17 changes: 11 additions & 6 deletions dart/test/initialization_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ void main() {
});

test('async re-initilization', () async {
final options = SentryOptions(dsn: fakeDsn)..devMode = true;
await Sentry.init(
(options) {
options.dsn = fakeDsn;
},
devMode: true,
options: options,
);

await Sentry.close();
Expand All @@ -27,24 +28,28 @@ void main() {
(options) {
options.dsn = fakeDsn;
},
devMode: true,
options: options,
);
});

// This is the failure from
// https://github.com/getsentry/sentry-dart/issues/508
test('re-initilization', () async {
final options = SentryOptions(dsn: fakeDsn)..devMode = true;
await Sentry.init(
(options) {
options.dsn = fakeDsn;
},
devMode: true,
options: options,
);

await Sentry.close();

await Sentry.init((options) {
options.dsn = fakeDsn;
});
await Sentry.init(
(options) {
options.dsn = fakeDsn;
},
options: options,
);
});
}
Loading

0 comments on commit 8285403

Please sign in to comment.