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

Checks in some tests are broken #1122

Closed
vaind opened this issue Nov 9, 2022 · 6 comments · Fixed by #1315
Closed

Checks in some tests are broken #1122

vaind opened this issue Nov 9, 2022 · 6 comments · Fixed by #1315

Comments

@vaind
Copy link
Collaborator

vaind commented Nov 9, 2022

I've noticed while working on recent PRs that test code sometimes uses expect() and other types of assertions in callbacks to Sentry. E.g. Sentry.init() - these are broken and are actually not being checked at all because Sentry swallows these errors (doesn't propagate them). Minimal repro - the following test passes:

  test('should fail', () async {
    await Sentry.init((options) {
      fail('hello there');
    }, options: SentryOptions(dsn: fakeDsn));
  });

Besides a testing issue, this may also be a design problem - naively, as a User, I'd expect exceptions in user-provided code to be propagated.

@ueman
Copy link
Collaborator

ueman commented Nov 9, 2022

Related #990

@marandaneto
Copy link
Contributor

marandaneto commented Nov 10, 2022

@vaind Sentry should swallow every exception when a user makes a mistake in the callbacks, that's intended and by design.
We'd need to fix those tests for sure, mind checking this out? or giving an example (a test's name)?

@marandaneto
Copy link
Contributor

Related #990

Likely an oversight because of PRs related to this, indeed.

@marandaneto
Copy link
Contributor

@vaind Sentry should swallow every exception when a user makes a mistake in the callbacks, that's intended and by design. We'd need to fix those tests for sure, mind checking this out? or giving an example (a test's name)?

@vaind in case you remember where you have seen this.

@vaind
Copy link
Collaborator Author

vaind commented Nov 17, 2022

e.g. multiple calls to await Sentry.init( in sentry_test.dart have test assertions inside the callback

@vaind
Copy link
Collaborator Author

vaind commented Nov 17, 2022

I'd suggest having a test-mode/dev-mode setting where exceptions are not captured in callbacks. This would could also help users if they're having trouble with reporting some errors, as it's much easier to find errors this way than look for logs.

@marandaneto marandaneto added this to the 7.0.0 milestone Dec 4, 2022
@marandaneto marandaneto removed this from the 7.0.0 milestone Dec 4, 2022
@vaind vaind mentioned this issue Sep 14, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants