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

bring back jest-nock support #136

Closed
zivl opened this issue Oct 20, 2022 · 1 comment · Fixed by #155
Closed

bring back jest-nock support #136

zivl opened this issue Oct 20, 2022 · 1 comment · Fixed by #155

Comments

@zivl
Copy link
Owner

zivl commented Oct 20, 2022

Unfortunately, due to some race condition or wrong definition, we can't get to run the built-in jest-mock functionality.
To remind, it was possible if you're using Jest for testing, all you have to do in your ***.spec.js file is to import the Jest mock as follows:

// some.spec.js
import { testkit } from 'sentry-testkit/dist/jestMock';

test('something', function () {
    // click
    // clack
    // BOOM!
    expect(testkit.reports().length).toBeGreaterThan(0);
});

But we're having issue with that:

  1. We're getting errors Sentry is not defined and Maximum call stack size exceeded (looks like circular dep): https://github.com/wix/sentry-testkit/runs/2477315004
  2. re-declaring block-scope variables (looks like es imports helps with this, but then we got into first problem): https://github.com/wix/sentry-testkit/pull/78/checks?check_run_id=2826583066

You may refer to the source code of jestMock.ts and we'll be happy for your help and suggestions.

Thank you @sidoruk-sv for pointing this out! 💙

@github-actions
Copy link
Contributor

github-actions bot commented Jan 1, 2023

Stale issue message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant