Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6a5d2c3
hub interface & instanciation
rxlabz Oct 15, 2020
4f01775
- hub capture event
rxlabz Oct 15, 2020
ea5c55f
- hub capture exception
rxlabz Oct 15, 2020
bd09da0
hub captureMessage
rxlabz Oct 15, 2020
c5317a4
fix some tests
rxlabz Oct 15, 2020
6a8910e
fix more tests
rxlabz Oct 15, 2020
f5d3dd0
changelog
rxlabz Oct 15, 2020
f102ac3
fix all tests
rxlabz Oct 15, 2020
055b9b0
feedbacks
rxlabz Oct 15, 2020
370d2d5
fix test : revert to ArgumentError.notNull('options')
rxlabz Oct 15, 2020
974d1f6
remove required hub methods
rxlabz Oct 15, 2020
c8c1df0
implement `Hub.close()`
rxlabz Oct 16, 2020
6c6c649
feedbacks : remove the IHub interface + minors
rxlabz Oct 16, 2020
a924040
Hub.configureScope
rxlabz Oct 16, 2020
823c91c
Hub.clone and Scope.clone
rxlabz Oct 16, 2020
b04d67c
remove the non required scope methods
rxlabz Oct 16, 2020
37cf83c
replace the ListQueue _stack by a DoubleLinkedQueue
rxlabz Oct 16, 2020
b9f9f9e
rename `response` to `sentryId`
rxlabz Oct 16, 2020
5067a36
serialize the potential error stackTrace
rxlabz Oct 16, 2020
54729ba
Revert the DoubleLinkedQueue to a resourceless ListQueue
rxlabz Oct 16, 2020
729d6bc
fix a json serialization test
rxlabz Oct 16, 2020
4ea1537
add a const SentryId.emptyId
rxlabz Oct 16, 2020
5932534
don't assign a new lastEventId if the client capture method is not ca…
rxlabz Oct 16, 2020
97f6c53
feedbacks:
rxlabz Oct 16, 2020
e89c488
feedbacks:
rxlabz Oct 16, 2020
647f1b0
simplify the captureMessage API
rxlabz Oct 19, 2020
91f709a
capture message
rxlabz Oct 19, 2020
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
feedbacks:
- add a scope comparaison method in tests
- move pkg:collection to dev_depencies
- changelog
  • Loading branch information
rxlabz committed Oct 16, 2020
commit e89c488ecff4f2d1dcfd63c1aea8ec02cefbb16c
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
- new static API : Sentry.init(), Sentry.captureEvent() #108
- expect a sdkName based on the test platform #105
- Added Scope and Breadcrumb ring buffer #109
- Added Hub ring buffer #113
- Added Hub to SDK #113

# `package:sentry` changelog

Expand Down
26 changes: 0 additions & 26 deletions dart/lib/src/scope.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import 'dart:collection';

import 'package:collection/collection.dart';

import 'protocol.dart';
import 'sentry_options.dart';

Expand Down Expand Up @@ -157,28 +155,4 @@ class Scope {

return clone;
}

@override
bool operator ==(Object other) =>
identical(this, other) ||
other is Scope &&
runtimeType == other.runtimeType &&
_level == other.level &&
_transaction == other.transaction &&
_user == other.user &&
IterableEquality().equals(_fingerprint, other.fingerprint) &&
IterableEquality().equals(_breadcrumbs, other.breadcrumbs) &&
MapEquality().equals(_tags, other.tags) &&
MapEquality().equals(_extra, other.extra);

@override
int get hashCode =>
_level.hashCode ^
_transaction.hashCode ^
_user.hashCode ^
_fingerprint.hashCode ^
_breadcrumbs.hashCode ^
_tags.hashCode ^
_extra.hashCode ^
_options.hashCode;
}
2 changes: 1 addition & 1 deletion dart/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ dependencies:
meta: ^1.0.0
stack_trace: ^1.0.0
uuid: ^2.0.0
collection: ^1.14.13

dev_dependencies:
mockito: ^4.1.1
pedantic: ^1.9.2
test: ^1.15.4
yaml: ^2.2.1
test_coverage: ^0.4.1
collection: ^1.14.13
23 changes: 15 additions & 8 deletions dart/test/event_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ void main() {

final error = StateError('test-error');

print('error.stackTrace ${error.stackTrace}');

expect(
Event(
message: Message(
Expand Down Expand Up @@ -93,13 +95,6 @@ void main() {
'exception': [
{'type': 'StateError', 'value': 'Bad state: test-error'}
],
'stacktrace': {
'frames': encodeStackTrace(
error.stackTrace,
stackFrameFilter: null,
origin: null,
)
},
'level': 'debug',
'culprit': 'Professor Moriarty',
'tags': {'a': 'b', 'c': 'd'},
Expand All @@ -122,7 +117,19 @@ void main() {
},
]
},
},
}..addAll(
error.stackTrace == null
? {}
: {
'stacktrace': {
'frames': encodeStackTrace(
error.stackTrace,
stackFrameFilter: null,
origin: null,
)
}
},
),
);
});
});
Expand Down
59 changes: 45 additions & 14 deletions dart/test/hub_test.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:collection/collection.dart';
import 'package:mockito/mockito.dart';
import 'package:sentry/sentry.dart';
import 'package:sentry/src/hub.dart';
Expand All @@ -6,6 +7,17 @@ import 'package:test/test.dart';
import 'mocks.dart';

void main() {
bool scopeEquals(Scope a, Scope b) {
return identical(a, b) ||
a.level == b.level &&
a.transaction == b.transaction &&
a.user == b.user &&
IterableEquality().equals(a.fingerprint, b.fingerprint) &&
IterableEquality().equals(a.breadcrumbs, b.breadcrumbs) &&
MapEquality().equals(a.tags, b.tags) &&
MapEquality().equals(a.extra, b.extra);
}

group('Hub instantiation', () {
test('should not instantiate without a sentryOptions', () {
Hub hub;
Expand Down Expand Up @@ -35,13 +47,25 @@ void main() {
hub.bindClient(client);
});

test('should capture event', () {
hub.captureEvent(fakeEvent);
verify(
client.captureEvent(fakeEvent,
scope: Scope(options), stackFrameFilter: null),
).called(1);
});
test(
'should capture event with the default scope',
() {
hub.captureEvent(fakeEvent);
expect(
scopeEquals(
verify(
client.captureEvent(
fakeEvent,
scope: captureAnyNamed('scope'),
stackFrameFilter: null,
),
).captured.first,
Scope(options),
),
true,
);
},
);

test('should capture exception', () {
hub.captureException(fakeException);
Expand Down Expand Up @@ -76,16 +100,23 @@ void main() {
});
hub.captureEvent(fakeEvent);

verify(
client.captureEvent(
fakeEvent,
scope: Scope(SentryOptions(dsn: fakeDsn))
hub.captureEvent(fakeEvent);
expect(
scopeEquals(
verify(
client.captureEvent(
fakeEvent,
scope: captureAnyNamed('scope'),
stackFrameFilter: null,
),
).captured.first,
Scope(SentryOptions(dsn: fakeDsn))
..level = SeverityLevel.debug
..user = fakeUser
..fingerprint = ['1', '2'],
stackFrameFilter: null,
),
).called(1);
true,
);
});
});

Expand All @@ -108,7 +139,7 @@ void main() {
verify(
client2.captureEvent(
fakeEvent,
scope: Scope(options),
scope: anyNamed('scope'),
stackFrameFilter: null,
),
).called(1);
Expand Down
2 changes: 1 addition & 1 deletion dart/test/sentry_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ void main() {
verify(
client.captureEvent(
fakeEvent,
scope: Scope(SentryOptions(dsn: fakeDsn)) /*anyNamed('scope')*/,
scope: anyNamed('scope'),
stackFrameFilter: null,
),
).called(1);
Expand Down