-
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
Testing utilities cleanup #5514
Conversation
@@ -5,8 +5,8 @@ import { makeReference } from '../utilities/graphql/storeUtils'; | |||
import { ApolloLink } from '../link/core/ApolloLink'; | |||
import { HttpLink } from '../link/http/HttpLink'; | |||
import { InMemoryCache } from '../cache/inmemory/inMemoryCache'; | |||
import { stripSymbols } from './utils/stripSymbols'; | |||
import { withWarning } from './utils/wrap'; | |||
import { stripSymbols } from '../utilities/testing/stripSymbols'; |
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.
@benjamn Just calling this out; I consolidated the testing utilities under a new location of utilities/testing
. The previous __tests__/utils
location worked, but I didn’t like how our rollup config looked when creating a separate testing bundle from the __tests__
dir. Let me know if the new location works - thanks!
Since we're combining all core + React testing utilities, let's get them out of the `__tests__` dir. It seemed a bit strange to create a separate `testing` bundle from a `__tests__` source location.
We're not using it in AC and it's easy enough to re-create if people need it.
The mocking utilities aren't mocks themselves, they're intended to help build mocks.
Make sure the utilities previously exported from the React testing location are included, and remove the old testing directories.
This method will allow us to avoid passing Promise reject functions as the first argument to mockSingleLink and the MockLink constructor, to avoid a breaking change for developers using those testing utilities.
These changes were accomplished using the recently added src/codemods/mockLinkRejection.ts codemod script, via jscodeshift: npm run build npx jscodeshift -t dist/codemods/mockLinkRejection.js src/**/*.ts
9f7c67e
to
5730146
Compare
This PR reduces the overlap we have between Apollo Client and React mock testing utilities. All mock testing utilities have been pruned and moved into a new location (
/utilities/testing
), alongside other testing utilities. The utilities we're exporting are bundled into a separate@apollo/client/testing
bundle, and kept out of the main AC bundle.