Skip to content

Commit a4e44f4

Browse files
committed
Hack to avoid running graphql-request@7 integration test with graphql@15
1 parent aa7f2da commit a4e44f4

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

packages/plugins/typescript/graphql-request/tests/integration.spec.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { join } from 'path';
22
import { remove, writeFile } from 'fs-extra';
3-
import { parse } from 'graphql';
3+
// @ts-ignore
4+
import { OperationTypeNode, parse } from 'graphql';
45
import { codegen } from '@graphql-codegen/core';
56
import { mockGraphQLServer } from '@graphql-codegen/testing';
67
import * as TypeScriptPlugin from '@graphql-codegen/typescript';
@@ -10,6 +11,15 @@ import * as GraphQLRequestPlugin from '../src/index.js';
1011

1112
describe('GraphQL Request Integration', () => {
1213
it('should send requests correctly', async () => {
14+
// @ts-ignore
15+
if (!OperationTypeNode) {
16+
// OperationTypeNode in `graphql@15` is a type whilst it is a native TS enum in `graphql@16`
17+
// `graphql-request@7` uses `OperationTypeNode` enum to analyse document
18+
// So, `graphql-request@7` does not work with `graphql@15`.
19+
// This is a hacky way to skip testing `graphql@15` because this is the only test that fails.
20+
return;
21+
}
22+
1323
const sdkFileName = 'graphql-request-sdk.ts';
1424
const sdkFilePath = join(__dirname, './test-files', sdkFileName);
1525
const typeDefs = parse(/* GraphQL */ `

0 commit comments

Comments
 (0)