Skip to content

Commit ede7321

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

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

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

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

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

0 commit comments

Comments
 (0)