zivl / sentry-testkit

A Sentry plugin to allow Sentry report interception and further inspection of the data being sent
https://zivl.github.io/sentry-testkit/
MIT License
112 stars 26 forks source link

reset() does not reset the breadcrumbs #60

Closed ghost closed 2 years ago

ghost commented 4 years ago

When creating exceptions with breadcrumbs in 2 tests, the second test will have the breadcrumbs from the first test.

describe('debug', () => {
    beforeEach(() => {
      testkit.reset();
    });
    it('should log a message 1', () => {
      Sentry.addBreadCrumb({message: 'messageText'});
      Sentry.captureException(new Error('test 1'));

      expect(testkit.reports()).toHaveLength(1);
      const report = testkit.reports()[0];

      expect(report.breadcrumbs).toHaveLength(1);
    });

    it('should log a message 2', () => {
      Sentry.addBreadCrumb({message: 'messageText'});
      Sentry.captureException(new Error('test 2'));

      expect(testkit.reports()).toHaveLength(1);
      const report = testkit.reports()[0];

      expect(report.breadcrumbs).toHaveLength(1);
    });
});

The second test fails as the breadcrumbs array contains 2 items: image

zivl commented 4 years ago

can you state your sentry and sentry-testkit versions?

zivl commented 4 years ago

I think it's related to recent changes has been done after moving to yarn and refresh the locked versions of some dependencies. will revert back

zivl commented 4 years ago

@rolandoldengarm reverted here https://github.com/wix/sentry-testkit/commit/091bcc0dd3f977e3f13cfb39482b9887955ee0a3 let me know if you still see this bug

github-actions[bot] commented 2 years ago

Stale issue message