-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Added @apollo/client/testing/core entry point #8687
Added @apollo/client/testing/core entry point #8687
Conversation
#8687 (comment) Until now, the `@apollo/client/testing` entry point has merely re-exported the contents of `@apollo/client/utilities/testing`, even though the latter is not an official entry point, leading to "Risky cross-entry-point nested import..." warnings during build. This commit moves the contents of `@apollo/client/utilities/testing` to actually reside within `@apollo/client/testing`, which should be safe because `@apollo/client/testing` was the only safe way to access these modules before now.
#8687 (comment) Until now, the `@apollo/client/testing` entry point has merely re-exported the contents of `@apollo/client/utilities/testing`, even though the latter is not an official entry point, leading to "Risky cross-entry-point nested import..." warnings during build. This commit moves the contents of `@apollo/client/utilities/testing` to reside within `@apollo/client/testing`, which should be safe because `@apollo/client/testing` was the only safe way to access these modules previously.
#8687 (comment) Until now, the `@apollo/client/testing` entry point has merely re-exported the contents of `@apollo/client/utilities/testing`, even though the latter is not an official entry point, leading to "Risky cross-entry-point nested import..." warnings during build. This commit moves the contents of `@apollo/client/utilities/testing` to reside within `@apollo/client/testing`, which should be safe because `@apollo/client/testing` was the only safe way to access these modules previously.
#8687 (comment) Until now, the `@apollo/client/testing` entry point has merely re-exported the contents of `@apollo/client/utilities/testing`, even though the latter is not an official entry point, leading to "Risky cross-entry-point nested import..." warnings during build. This commit moves the contents of `@apollo/client/utilities/testing` to reside within `@apollo/client/testing`, which should be safe because `@apollo/client/testing` was the only safe way to access these modules previously.
9861f01
to
bc9f401
Compare
e175d4b
to
634a86d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
3346ab5
to
e3f5ed9
Compare
These changes are now available in As a sign this is working, you should be able to do this in a browser console: await import("https://esm.run/@apollo/client@3.5.0-beta.13/testing/core") whereas this (still) doesn't work, because of the React dependencies: await import("https://esm.run/@apollo/client@3.5.0-beta.13/testing") |
@benjamn works like a treat, thanks heaps for the great work! |
Hi,
MockLink
andMockSubscriptionLink
from@apollo/client/testing
are quite useful for running unit tests against apollo client logic.The only issue is that
@apollo/client/testing
has a direct dependency onreact
throughMockedProvider
which makes it unusable for other frameworks like Angular that would like to make use of the testing framework without having to pull inreact
and all of its dependencies.This PR introduces a new entry point
@apollo/client/testing/core
which is identical to@apollo/client/testing
except it doesn't exportMockedProvider
allowing other frameworks to make use of it without having to depend onreact
.I made sure non of the existing entry points and exports are affected by this change so everything should work as it always has.
I hope you find this useful and please let me know if you can think of other better ways to solve this issue.
Thanks.