Skip to content

ts: used named export for 'Maybe' type#2586

Merged
IvanGoncharov merged 1 commit intographql:masterfrom
IvanGoncharov:pr_branch
May 25, 2020
Merged

ts: used named export for 'Maybe' type#2586
IvanGoncharov merged 1 commit intographql:masterfrom
IvanGoncharov:pr_branch

Conversation

@IvanGoncharov
Copy link
Copy Markdown
Member

No description provided.

@IvanGoncharov IvanGoncharov added the PR: polish 💅 PR doesn't change public API or any observed behaviour label May 24, 2020
@IvanGoncharov IvanGoncharov merged commit 1dbf65b into graphql:master May 25, 2020
@IvanGoncharov IvanGoncharov deleted the pr_branch branch May 25, 2020 20:08
step2this added a commit to step2this/social-media-app that referenced this pull request Nov 12, 2025
Added comprehensive schema snapshot tests to catch breaking changes and
enforced single GraphQL module instance to prevent realm errors.

**Changes:**

1. **Schema Snapshot Test** (src/schema/__tests__/schema-snapshot.test.ts):
   - Snapshots schema structure as plain object (avoids printSchema() realm issues)
   - Tests all root types (Query, Mutation) and core domain types
   - Validates Relay cursor pagination spec compliance
   - Checks reasonable API complexity (type/field counts)
   - 8 comprehensive test cases

2. **pnpm Override** (package.json):
   - Added pnpm.overrides to guarantee [email protected] across all packages
   - Prevents "Cannot use GraphQLSchema from another module or realm" errors
   - Industry best practice for monorepos with GraphQL

**GraphQL Module Realm Problem - Root Cause:**

The error occurs when multiple instances of the 'graphql' package exist in
node_modules. GraphQL uses instanceof checks internally, which fail when
comparing objects from different module instances.

Common in:
- pnpm monorepos (strict dependency isolation)
- Projects mixing Apollo Server, Pothos, and graphql-tools
- Transitive dependencies pulling different graphql versions

**Industry Solutions Applied:**

1. ✅ pnpm overrides - Force single graphql version across workspace
2. ✅ Avoid direct graphql-js functions - Use Apollo Server methods
3. ✅ Snapshot schema structure - Not raw SDL via printSchema()

**References:**
- graphql/graphql-js#2586
- https://www.apollographql.com/docs/apollo-server/testing
- https://pnpm.io/package_json#pnpmoverrides

**Impact:**
- ✅ All 8 schema snapshot tests passing
- ✅ TypeScript compilation clean
- ✅ Breaking change detection now in place
- ✅ Aligns with testing strategy assessment recommendations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: polish 💅 PR doesn't change public API or any observed behaviour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant