From a117931f71a9a1418ee1b519e49f2ad0fb1877c4 Mon Sep 17 00:00:00 2001 From: Rikki Schulte Date: Mon, 16 Sep 2024 15:43:42 +0200 Subject: [PATCH] fix test for 15 --- package.json | 3 ++- .../src/__tests__/GraphQLLanguageService.test.ts | 13 +++++++++---- yarn.lock | 8 ++++---- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index 284e1688c13..fc8fa3b9d17 100644 --- a/package.json +++ b/package.json @@ -144,6 +144,7 @@ "resolutions": { "@babel/traverse": "^7.23.2", "vscode-languageserver-types": "3.17.3", - "markdown-it": "14.1.0" + "markdown-it": "14.1.0", + "graphql": "15" } } diff --git a/packages/graphql-language-service-server/src/__tests__/GraphQLLanguageService.test.ts b/packages/graphql-language-service-server/src/__tests__/GraphQLLanguageService.test.ts index 62e14a12a82..cc0bea70ed4 100644 --- a/packages/graphql-language-service-server/src/__tests__/GraphQLLanguageService.test.ts +++ b/packages/graphql-language-service-server/src/__tests__/GraphQLLanguageService.test.ts @@ -14,7 +14,7 @@ import { GraphQLLanguageService } from '../GraphQLLanguageService'; import { SymbolKind } from 'vscode-languageserver-protocol'; import { Position } from 'graphql-language-service'; import { NoopLogger } from '../Logger'; -import { GraphQLEnumType } from 'graphql'; +import { GraphQLEnumType, version } from 'graphql'; const MOCK_CONFIG = { filepath: join(__dirname, '.graphqlrc.yml'), @@ -24,6 +24,8 @@ const MOCK_CONFIG = { }, }; +const majorVersion = parseInt(version.split('.')[0]); + describe('GraphQLLanguageService', () => { const mockCache = { async getSchema() { @@ -45,9 +47,12 @@ describe('GraphQLLanguageService', () => { content: 'fake file content', definition: { kind: 'FragmentDefinition', - name: { - value: 'TestFragment', - }, + name: + majorVersion < 16 + ? 'TestFragment' + : { + value: 'TestFragment', + }, loc: { start: 293, end: 335, diff --git a/yarn.lock b/yarn.lock index e2c7653637e..24b665d824e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10538,10 +10538,10 @@ graphql-ws@5.14.0, graphql-ws@^5.5.5: resolved "https://registry.yarnpkg.com/graphql-ws/-/graphql-ws-5.14.0.tgz#766f249f3974fc2c48fae0d1fb20c2c4c79cd591" integrity sha512-itrUTQZP/TgswR4GSSYuwWUzrE/w5GhbwM2GX3ic2U7aw33jgEsayfIlvaj7/GcIvZgNMzsPTrE5hqPuFUiE5g== -"graphql@^16.8.1 || ^17.0.0-alpha.2", graphql@^16.9.0: - version "16.9.0" - resolved "https://registry.yarnpkg.com/graphql/-/graphql-16.9.0.tgz#1c310e63f16a49ce1fbb230bd0a000e99f6f115f" - integrity sha512-GGTKBX4SD7Wdb8mqeDLni2oaRGYQWjWHGKPQ24ZMnUtKfcsVoiv4uX8+LJr1K6U5VW2Lu1BwJnj7uiori0YtRw== +graphql@15, "graphql@^16.8.1 || ^17.0.0-alpha.2", graphql@^16.9.0: + version "15.9.0" + resolved "https://registry.yarnpkg.com/graphql/-/graphql-15.9.0.tgz#4e8ca830cfd30b03d44d3edd9cac2b0690304b53" + integrity sha512-GCOQdvm7XxV1S4U4CGrsdlEN37245eC8P9zaYCMr6K1BG0IPGy5lUwmJsEOGyl1GD6HXjOtl2keCP9asRBwNvA== gzip-size@^5.0.0: version "5.1.1"