-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Labels
🐛 debuggingFeature requests that help users more easily debug issuesFeature requests that help users more easily debug issuesproject-apollo-client (legacy)LEGACY TAG DO NOT USELEGACY TAG DO NOT USE🧪 testingFeature requests related to testingFeature requests related to testing
Description
See discussion in apollographql/react-apollo#3316.
The current error provided by MockLink
is just No more mocked responses for the query:
followed by a dump of the query and arguments provided.
While providing mockResponses
automatically strips out @client
fields (apollographql/react-apollo#2776), there's no such happening for requests. This leads to a situation that is hard to debug, since the seamlessly removed part from one place is the thing that leads to an obfuscated error in another place.
I don't know what the ideal solution is, but a few suggestions of varying quality/usefulness:
- Try to diff all provided responses with the query, instead of requiring the stringified value to be identical, and print a nice diff which will at least highlight why there's "no more mocked responses". Landing Improve mismatched query error message react-apollo#2883 might be enough here? Not sure
- Throw an explicit error if a query contains a
@client
field which has no associated local resolver provided - A simpler version of the above is to throw if there are
@client
fields without anyresolvers
being passed without trying to match them up - provide a way strip out
@client
fields from the query (similar to what happens automatically for responses) - Instead of automatically stripping out
@client
fields from responses, throw an error and require the user to explicitly opt in to it
JamesMcMahon, dturcotte and aleksejkozin
Metadata
Metadata
Assignees
Labels
🐛 debuggingFeature requests that help users more easily debug issuesFeature requests that help users more easily debug issuesproject-apollo-client (legacy)LEGACY TAG DO NOT USELEGACY TAG DO NOT USE🧪 testingFeature requests related to testingFeature requests related to testing