-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Consider removing apollo-server-testing
#4952
Comments
Additionally, many users want to test their actual HTTP pipeline rather than direct execution. There's a separate library https://github.com/zapier/apollo-server-integration-testing that (for Express users at least) supports this. It may be the right move to endorse this package as a replacement. |
This card is largely just getting rid of a-s-t in the docs, which we could quickly do in AS2 too. |
Hey @glasser. I have been spending a lot of time recently working on integration tests, so I have some thoughts on this if you don't mind me sharing. I have read through the issue that motivated this ticket, so am aware of the problem. We were using We wanted to improve our integration tests to be representative of production behaviour, and based on this ticket and the issue earlier, I tried using https://github.com/zapier/apollo-server-integration-testing as suggested. What I learned is that that library isn't doing "real" integration tests either; it is simply providing an API to more conveniently provide the What I ended up doing was building a very thin wrapper around If you like, I can try to "isolate" this utility, and maybe this can become a core maintained I can submit a (perhaps rough) PR for this, if this is something you would be interested in. I don't want to tell you what to do or how to maintain your project, but maybe I can try to change your mind 😛 . Let me know if that interests you at all. If it does... please bear with me, as I am a bit of an OS newbie, so this type of thing is a bit daunting for me... but I'm sure I can get over it. I would also ask that you reconsider deprecating |
@moberegger Thanks for the feedabck! The package you mentions sounds pretty useful. I think a good pattern here might be for you to publish it under your own namespace (or top level) and we can recommend it in docs; if it becomes quite popular then we could do a "friendly takeover". I don't follow your concern about custom scalars — how does the separate package |
I actually don't know, I just know that it currently works well for things like that. I was more so addressing "It's not clear to me that it's independently valuable" and I was trying to give an example of a situation where it is valuable. I am very unfamiliar with the inner workings of Apollo Server, so I don't understand what "documenting executeOperation" ultimately means, or if it means that the same things won't possible; my initial thought was that I would have to understand core implementation details to do testing, which felt a bit daunting. If that's not the case and it does the same thing with a superficial API change, then my worries are unfounded and it's just uncertainty on my part. If that's the case, please ignore my ramblings! |
The `apollo-server-testing` package exports one small function which is just a tiny wrapper around `server.executeOperation`. The one main advantage 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 to `apollo-server-testing` too. We've also found that users have been confused by the `createTestClient` API (eg #5111) and that some linters get 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` (just like with the `apollo-server-testing` API), and changes the docs to recommend `executeOperation` instead of `apollo-server-testing`. It also makes 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.
The `apollo-server-testing` package exports one small function which is just a tiny wrapper around `server.executeOperation`. The one main advantage 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 to `apollo-server-testing` too. We've also found that users have been confused by the `createTestClient` API (eg #5111) and that some linters get 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` (just like with the `apollo-server-testing` API), and changes the docs to recommend `executeOperation` instead of `apollo-server-testing`. It also makes 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.
apollo-server-testing
provides a very thin wrapper aroundApolloServer.executeOperation
(which was introduced specifically to be used byapollo-server-testing
. It's not clear to me that it's independently valuable, vs just documentingexecuteOperation
.The text was updated successfully, but these errors were encountered: