Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

@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/@[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.
@RyanofWoods RyanofWoods added the Type: Bug 🐛 Something isn't working label Dec 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Type: Bug 🐛 Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant