List "graphql" as a peer dependency
Prerequisites
- I confirm my issue is not in the opened issues
- I confirm the Frequently Asked Questions didn't contain the answer to my issue
Environment check
- I'm using the latest
mswversion - I'm using Node.js version 18 or higher
Browsers
No response
Reproduction repository
https://github.com/apollographql/graphql-testing-library
Reproduction steps
When installing msw, graphql is installed as a transitive dependency at v16. This goes against the expectation in the GraphQL ecosystem that graphql always be treated as a peer dependency: https://github.com/graphql/graphql-js/issues/594#issuecomment-1189850052
From the graphql source:
Ensure that there is only one instance of "graphql" in the node_modules
directory. If different versions of "graphql" are the dependencies of other
relied on modules, use "resolutions" to ensure only one version is installed.This cannot be trivially overridden with all package managers (e.g. npm overrides has open issues), and causes surprising behavior.
Current behavior
graphql is a dependency of MSW.
Here's an example of a project using a number of packages that rely on graphql. All of them list it as a peer dependency with the range of 15 || 16, except for MSW.
The result is my MSW GraphQL handler returning errors about unsupported GraphQL features for a version of GraphQL I haven't installed and don't expect to be executing my queries:
Expected behavior
I'd expect MSW to treat it as a peer dependency.
Source: mswjs/msw