apollo-test-utils is a rudimentary JavaScript package specifically designed to facilitate testing with Apollo Client version 1.x. Released with a low version number (0.3.2), it primarily offered functions like `mockNetworkInterfaceWithSchema` to mock the network interface, a core architectural concept prevalent in Apollo Client's early iterations. This package is no longer maintained, with its last commit dating back to 2017, and is completely incompatible with Apollo Client versions 2.x and above. The original `apollo-client` v1, for which this package was intended, has been superseded by `@apollo/client`. Modern testing approaches for Apollo Client, which has since evolved through several major releases, leverage `@apollo/client/testing` for React components (e.g., `MockedProvider`) or directly mock `ApolloLink` instances for headless client testing. Developers should consider `apollo-test-utils` abandoned and migrate to current official Apollo testing utilities for any active projects.
npm install apollo-test-utilsVerified import paths — ran on the pinned version, not inferred.
Demonstrates mocking an Apollo Client v1 network interface with a GraphQL schema for basic query testing.
For testing Apollo Client v2+, v3+, or v4+ applications, use the official `@apollo/client/testing` package (e.g., `MockedProvider` for React components) or mock `ApolloLink` instances.
Migrate to current official Apollo Client testing solutions. For React, `@apollo/client/testing` provides `MockedProvider`. For client-agnostic GraphQL testing, consider `@apollo/graphql-testing-library`.
If strictly needing to run this legacy code, ensure your build setup supports transparent CommonJS interoperability for older packages, but a full migration to modern testing libraries is strongly recommended.
This package is incompatible with Apollo Client v2+. Update your testing strategy to use `@apollo/client/testing` or `ApolloLink` based mocks for modern Apollo Client versions.
Ensure `apollo-test-utils` and `apollo-client@^1.0.0` are correctly installed. More importantly, consider if you are trying to use an abandoned package with a modern setup. If so, switch to `@apollo/client/testing` for modern Apollo Client testing.