Skip to content

Commit 37f544b

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

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

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

Lines changed: 12 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,16 @@ 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` is a type in `graphql@15`, but 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+
//
20+
// This block is a hacky way to skip running this test for `graphql@15`.
21+
return;
22+
}
23+
1324
const sdkFileName = 'graphql-request-sdk.ts';
1425
const sdkFilePath = join(__dirname, './test-files', sdkFileName);
1526
const typeDefs = parse(/* GraphQL */ `

0 commit comments

Comments
 (0)