Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@pothos/test-utils

hayes117ISC2.1.1TypeScript support: included

shared test utils for testing Pothos packages

readme

Pothos

Pothos GraphQL

Pothos is a plugin based GraphQL schema builder for typescript.

It makes building graphql schemas in typescript easy, fast and enjoyable. The core of Pothos adds 0 overhead at runtime, and has graphql as its only dependency.

Pothos is the most type-safe way to build GraphQL schemas in typescript, and by leveraging type inference and typescript's powerful type system Pothos requires very few manual type definitions and no code generation.

Pothos has a unique and powerful plugin system that makes every plugin feel like its features are built into the core library. Plugins can extend almost any part of the API by adding new options or methods that can take full advantage of the Pothos type system.

Hello, World

import { createYoga } from 'graphql-yoga';
import { createServer } from 'node:http';
import SchemaBuilder from '@pothos/core';

const builder = new SchemaBuilder({});

builder.queryType({
  fields: (t) => ({
    hello: t.string({
      args: {
        name: t.arg.string(),
      },
      resolve: (parent, { name }) => `hello, ${name || 'World'}`,
    }),
  }),
});

const yoga = createYoga({
  schema: builder.toSchema(),
});

const server = createServer(yoga);

server.listen(3000);

What sets Pothos apart

  • Pothos was built from the start to leverage typescript for best-in-class type-safety.
  • Pothos has a clear separation between the shape of your external GraphQL API, and the internal representation of your data.
  • Pothos comes with a large plugin ecosystem that provides a wide variety of features while maintaining great interoperability between plugins.
  • Pothos does not depend on code-generation or experimental decorators for type-safety.
  • Pothos has been designed to work at every scale from small prototypes to huge Enterprise applications, and is in use at some of the largest tech companies including Airbnb and Netflix.

Plugins that make Pothos even better

  • Add GraphQL

    Add existing GraphQL types to your schema

  • Auth

    Add global, type level, or field level authorization checks to your schema

  • Complexity

    A plugin for defining and limiting complexity of queries

  • Directives

    Integrate with existing schema graphql directives in a type-safe way.

  • Errors

    A plugin for easily including error types in your GraphQL schema and hooking up error types to resolvers.

  • Dataloader

    Quickly define data-loaders for your types and fields to avoid n+1 queries.

  • Mocks

    Add mock resolvers for easier testing

  • Prisma

    A plugin for more efficient integration with prisma that can help solve n+1 issues and more efficiently resolve queries

  • Relay

    Easy to use builder methods for defining relay style nodes and connections, and helpful utilities for cursor based pagination.

  • Simple Objects

    Define simple object types without resolvers or manual type definitions.

  • Smart Subscriptions

    Make any part of your graph subscribable to get live updates as your data changes.

  • Sub-Graph

    Build multiple subsets of your graph to easily share code between internal and external APIs.

  • Tracing

    Add tracing for resolver execution, with support for opentelemetry, newrelic, century, logging, and custom tracers

  • With-Input

    Define fields with inline input objects

  • Zod Validation

    Validating your inputs and arguments

Sponsors

Pothos development supported by sponsorships from these generous people and organizations:

changelog

@giraphql/test-utils

2.1.1

Patch Changes

  • cd7f309: Update dependencies

2.1.0

Minor Changes

  • 27af377: replace eslint and prettier with biome

2.0.1

Patch Changes

  • 9bd203e: Fix graphql peer dependency version to match documented minumum version

2.0.0

Major Changes

Patch Changes

  • c1e6dcb: update readmes

2.0.0-next.1

Patch Changes

  • update readmes

2.0.0-next.0

Major Changes

1.4.9

Patch Changes

  • 1ecea46: revert accidental pinning of graphql peer dependency

1.4.8

Patch Changes

  • 4c6bc638: Add provinance to npm releases

1.4.7

Patch Changes

  • d4d41796: Update dev dependencies

1.4.6

Patch Changes

  • 6f00194c: Fix an issue with esm import transform

1.4.5

Patch Changes

  • b12f9122: Fix issue with esm build script

1.4.4

Patch Changes

  • d350f842: update dev deps

1.4.3

Patch Changes

  • 9fa27cf7: Transform dynamic type imports in d.ts files

1.4.2

Patch Changes

  • 3a82d645: Apply esm transform to esm d.ts definitions

1.4.1

Patch Changes

  • 218fc68b: Fix script for copying ems d.ts definitions

1.4.1

Patch Changes

  • 67531f1e: Create separate typescript definitions for esm files

1.4.0

Minor Changes

  • 11929311: Update type definitions to work with module: "nodeNext"

1.3.1

Patch Changes

  • aa18acb7: update dev dependencies

1.3.0

Minor Changes

  • 3a7ff291: Refactor internal imports to remove import cycles

Patch Changes

  • 3a7ff291: Update dev dependencies

1.2.3

Patch Changes

  • c8f75aa1: Update dev dependencies

1.2.2

Patch Changes

  • 4e5756ca: Update dev dependencies

1.2.1

Patch Changes

  • 4b24982f: Update dev dependencies

1.2.0

Minor Changes

  • ecb2714c: Add types entry to export map in package.json and update dev dependencies

    This should fix compatibility with typescripts new "moduleResolution": "node12"

1.1.1

Patch Changes

  • 971f1aad: Update dev dependencies

1.1.0

Minor Changes

  • 6279235f: Update build process to use swc and move type definitions to dts directory

Patch Changes

  • 21a2454e: update dev dependencies

1.0.2

Patch Changes

  • 03aecf76: update .npmignore

1.0.1

Patch Changes

  • ab4a9ae4: Fix some type compatibility issues when skipLibCheck is false

1.0.0

Major Changes

  • 4caad5e4: Rename GiraphQL to Pothos

0.6.0

Minor Changes

  • 9307635a: Migrate build process to use turborepo

0.5.1

Patch Changes

  • c6aa732: graphql@15 type compatibility fix

0.5.0

Minor Changes

  • 6d2a6d9: Update to support typescript 4.5. typescript@>4.5.2 is now required for code generation in the prisma plugin

0.4.1

Patch Changes

  • c85dc33: Add types entry in package.json

0.4.0

Minor Changes

  • aeef5e5: Update dependencies

0.3.0

Minor Changes

  • 9107f29: Update dependencies (includes graphql 16)

0.2.0

Minor Changes

  • 17db3bd: Make type refs extendable by plugins

0.1.3

Patch Changes

  • 045e4ec: Fix a bug in argMapper that caused mappings to be omitted if the only mappings were for fields for input types without nested mappings

0.1.2

Patch Changes

  • c976bfe: Update dependencies

0.1.1

Patch Changes

  • 4150f92: Fixed esm transformer for path-imports from dependencies