This repository was archived by the owner on Jan 10, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 225
This repository was archived by the owner on Jan 10, 2025. It is now read-only.
@shopify/graphql-testing breaks without React installed #2706
Copy link
Copy link
Open
Labels
Type: Bug 🐛Something isn't workingSomething isn't working
Description
Overview
When trying import the @shopify/graphql-testing package into a test and not having react installed in the project, it fails with the following error.
Perhaps this package should make react a peerDependency, and possibly state it in the documentation.
I expected that I could use this package for testing in projects where React is not used, such as a microservice project.
Cannot find module 'react' from 'node_modules/.pnpm/@[email protected][email protected]/node_modules/@apollo/client/react/context/context.cjs'
Require stack:
node_modules/.pnpm/@[email protected][email protected]/node_modules/@apollo/client/react/context/context.cjs
node_modules/.pnpm/@[email protected][email protected]/node_modules/@apollo/client/react/react.cjs
node_modules/.pnpm/@[email protected][email protected]/node_modules/@apollo/client/main.cjs
node_modules/.pnpm/@[email protected]/node_modules/@shopify/graphql-testing/build/cjs/graphql-controller.js
node_modules/.pnpm/@[email protected]/node_modules/@shopify/graphql-testing/build/cjs/index.js
node_modules/.pnpm/@[email protected]/node_modules/@shopify/graphql-testing/index.js
<test file>.spec.ts
> 1 | import { createGraphQLFactory } from '@shopify/graphql-testing';
| ^
2 | import { webhookManager } from '.';
3 |
4 | const createGraphQL = createGraphQLFactory({
at Resolver._throwModNotFoundError (node_modules/.pnpm/[email protected]/node_modules/jest-resolve/build/resolver.js:427:11)
at Object.<anonymous> (node_modules/.pnpm/@[email protected][email protected]/node_modules/@apollo/client/react/context/context.cjs:6:13)
at Object.<anonymous> (node_modules/.pnpm/@[email protected][email protected]/node_modules/@apollo/client/react/react.cjs:6:15)
at Object.<anonymous> (node_modules/.pnpm/@[email protected][email protected]/node_modules/@apollo/client/main.cjs:6:13)
at Object.<anonymous> (node_modules/.pnpm/@[email protected]/node_modules/@shopify/graphql-testing/build/cjs/graphql-controller.js:5:14)
at Object.<anonymous> (node_modules/.pnpm/@[email protected]/node_modules/@shopify/graphql-testing/build/cjs/index.js:5:25)
at Object.<anonymous> (node_modules/.pnpm/@[email protected]/node_modules/@shopify/graphql-testing/index.js:1:120)
at Object.<anonymous> (<test file>:1:1)
Consuming repo
What repo were you working in when this issue occurred?
A private one.
Scope
- Is this issue related to a specific package?
@shopify/graphql-testing
- Tag it with the
Package: <package_name>label.
Metadata
Metadata
Assignees
Labels
Type: Bug 🐛Something isn't workingSomething isn't working