Skip to content
This repository was archived by the owner on Jan 10, 2025. It is now read-only.
This repository was archived by the owner on Jan 10, 2025. It is now read-only.

graphql-fixtures no longer works in non-node environments. #2393

Open
@KevinMind

Description

@KevinMind

Overview

graphql-fixtures is used primarily in jest/node environments, however we have been using the library to generate mock data for graphql resolvers in storybooks. This allows us to mock graphql queries with real data that can render in stories which help us validate visual changes to the code.

It seems that a transient dependency of graphql-fixtures -> graphql-tool-utilities -> apollo-codegen-core was bumped and this introduced breaking changes when executing in a browser.

It seems the issue is somehow related to node APIs not being defined, so I thought maybe this was a webpack 4 -> 5 issue, but I can reproduce the issue in webpack4 and webpack5 so seems unrelated.

  • webpack4: link upgrading graphql-tools-utilities to the version where apollo-codegen-core is bumped causes storybook to break
  • webpack5: link hardcoding the earlier version of graphql-tools-utilities makes storybook build pass.

Being able to use graphql fixtures in storybooks is a game changer. Instead of needing to define a lot of static json files with huge data payloads, you can provide simple functions and share fixtures from stories and tests.

NOTE: looking at the apollo-codegen-core repository, it seems that this project is depracated by apollo and they recommend using https://www.graphql-code-generator.com/ instead. Is this something on our radar? We have several quilt packages somewhat related to graphql codegen that could theoretically be replaced/enhanced by this open source toolset.

Consuming repo

https://github.com/Shopify/merchant-to-merchant
https://github.com/Shopify/handshake-web

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions