apollographql / apollographql/apollo-server

Test harness for plugin unit testing

Open
#6,905 1 comment 1 reaction 0 assignees View on GitHub
Dominant language
TypeScript
Stars
14k
Forks
2k
Avg merge
2d 14h
Merged PRs (30d)
2

Description

I'm writing a custom plugin for our GraphQL server and would like to write some unit tests for it. I'm finding that I have two choices here: Figure out how to mock out the various objects that are passed into the plugin or spin up an ApolloServer with the plugin installed (and all the dependencies that entails).

It would be nice if there were a test harness that would make it easy to test my plugin in isolation, without having to integrate it into a full Server, somehow. Perhaps something that would make it easier to create the various objects passed to `requestDidStart`, `executionDidStart`, etc.

Contributor guide

Open the contributing guide

Research direction

Start with the plugin lifecycle entry points named in the issue, including requestDidStart and executionDidStart, and compare the current mocking and full ApolloServer approaches. Done would be a defined way to exercise those hooks in isolation without starting a full server or supplying all its dependencies.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
backend-api-design, testing
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.