Deprecate apollo-server-testing; allow ASTs for executeOperation #5238
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
apollo-server-testing
package exports one small function which isjust a tiny wrapper around
server.executeOperation
. The one mainadvantage it provides is that you can pass in operations as ASTs rather
than only as strings.
This extra layer doesn't add much value but does require us to update
things in two places (which cross a package barrier and thus can be
installed at skewed versions). So for example when adding the second
argument to
executeOperation
in #4166 I did not bother to add it toapollo-server-testing
too. We've also found that users have beenconfused by the
createTestClient
API (eg #5111) and that some lintersget confused by the unbound methods it returns (#4724).
So the simplest thing is to just teach people how to use the real
ApolloServer
method instead of an unrelated API.This PR allows you to pass an AST to
server.executeOperation
(justlike with the
apollo-server-testing
API), and changes the docs torecommend
executeOperation
instead ofapollo-server-testing
. It alsomakes some other suggestions about how to test Apollo Server code in a
more end-to-end fashion, and adds some basic tests for
executeOperation
.Fixes #4952.