Skip to content
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

@shopify/graphql-testing breaks without React installed #2706

Open
1 task
RyanofWoods opened this issue Dec 27, 2023 · 0 comments
Open
1 task

@shopify/graphql-testing breaks without React installed #2706

RyanofWoods opened this issue Dec 27, 2023 · 0 comments
Labels
Type: Bug 🐛 Something isn't working

Comments

@RyanofWoods
Copy link

RyanofWoods commented Dec 27, 2023

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/@apollo+client@3.8.8_graphql@15.8.0/node_modules/@apollo/client/react/context/context.cjs'

    Require stack:
      node_modules/.pnpm/@apollo+client@3.8.8_graphql@15.8.0/node_modules/@apollo/client/react/context/context.cjs
      node_modules/.pnpm/@apollo+client@3.8.8_graphql@15.8.0/node_modules/@apollo/client/react/react.cjs
      node_modules/.pnpm/@apollo+client@3.8.8_graphql@15.8.0/node_modules/@apollo/client/main.cjs
      node_modules/.pnpm/@shopify+graphql-testing@7.0.1/node_modules/@shopify/graphql-testing/build/cjs/graphql-controller.js
      node_modules/.pnpm/@shopify+graphql-testing@7.0.1/node_modules/@shopify/graphql-testing/build/cjs/index.js
      node_modules/.pnpm/@shopify+graphql-testing@7.0.1/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/jest-resolve@29.7.0/node_modules/jest-resolve/build/resolver.js:427:11)
      at Object.<anonymous> (node_modules/.pnpm/@apollo+client@3.8.8_graphql@15.8.0/node_modules/@apollo/client/react/context/context.cjs:6:13)
      at Object.<anonymous> (node_modules/.pnpm/@apollo+client@3.8.8_graphql@15.8.0/node_modules/@apollo/client/react/react.cjs:6:15)
      at Object.<anonymous> (node_modules/.pnpm/@apollo+client@3.8.8_graphql@15.8.0/node_modules/@apollo/client/main.cjs:6:13)
      at Object.<anonymous> (node_modules/.pnpm/@shopify+graphql-testing@7.0.1/node_modules/@shopify/graphql-testing/build/cjs/graphql-controller.js:5:14)
      at Object.<anonymous> (node_modules/.pnpm/@shopify+graphql-testing@7.0.1/node_modules/@shopify/graphql-testing/build/cjs/index.js:5:25)
      at Object.<anonymous> (node_modules/.pnpm/@shopify+graphql-testing@7.0.1/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.
@RyanofWoods RyanofWoods added the Type: Bug 🐛 Something isn't working label Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant