-
Notifications
You must be signed in to change notification settings - Fork 2
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
How to register adapters with jest-circus #23
Comments
Hey @stephenh, thanks for reporting the issue! I can confirm that it exists and I think that you probably have the right idea about the root cause. I don't have time to immediately look into it, but will try to see if anything can be done to make global setup-polly-jest/test/integration/jest/index.test.js Lines 18 to 26 in 13db62e
|
Ah great! We can definitely do that, and I confirmed that works for us as well. Thanks for the quick reply! |
…d by mixing `async` and `done` usage
…d by mixing `async` and `done` usage
Hey; we've been using setup-polly-jest for awhile and it's working great, so thanks for the project!
We're trying to upgrade to jest 27 / jest-circus, and for some reason our adapters are no longer being registered, i.e. we have code like:
But our tests are now failing with:
I've put the new jest env at the top of our test files:
Where the
src/setupPolly
file is what has our commonPolly.register
code in it.By adding some console.logs inside of polly itself, it looks like there are two versions of Polly's internal event emitter floating around, i.e. from a test run:
What seems to be happening is:
1627748370545
event emitter is created immediately when the test starts (I assume from thejest-environment-node
)1627748375580
event emitter is also created (I assume this is due to Jest's sandboxing, like b/c oursrc/setupPolly.ts
is imported from within our test, it is getting it's own separate require/vm context)Polly.register(node-adapter)
call is putting the adapter into the 2nd /1627748375580
emitter'register' => [Set]
handleTestEvent
runs and tries to create a polly instance for the test, thePolly.configure
is using the first event emitter,1627748370545
to look for adapters, and not finding anySo, that is what happening. I really don't know why though. :-)
Is there a different way to
Polly.register
in the new jest-circus setup?I've looked through the readme and the commit that added jest-circus support and didn't see anything obvious, but maybe I'm missing something.
Thanks!
The text was updated successfully, but these errors were encountered: