From c4a1bf95d132192dd693f49d52e901c1464d80d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eir=C3=ADkur=20Torfason?= Date: Fri, 8 Nov 2024 11:20:07 +0000 Subject: [PATCH] Skip the CommonJS variants if using GraphQL 17 GraphQL 17 will only be bundled in ESM mode --- packages/load/tests/use-custom-loader.node.mjs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/load/tests/use-custom-loader.node.mjs b/packages/load/tests/use-custom-loader.node.mjs index 36658219557..2de785ee009 100644 --- a/packages/load/tests/use-custom-loader.node.mjs +++ b/packages/load/tests/use-custom-loader.node.mjs @@ -1,15 +1,18 @@ import assert from 'node:assert'; import { describe, it } from 'node:test'; +import { versionInfo as graphqlVersionInfo } from 'graphql'; import { useCustomLoader, useCustomLoaderSync } from '../src/utils/custom-loader.ts'; describe('useCustomLoader', () => { - it('can load a custom cjs loader from a file path', async () => { + const skipCjsTests = graphqlVersionInfo.major >= 17; + + it('can load a custom cjs loader from a file path', { skip: skipCjsTests }, async () => { const loader = await useCustomLoader(`./custom-loader.cjs`, import.meta.dirname); const result = await loader('some-name', { customLoaderContext: {} }); assert.strictEqual(result, 'I like turtles'); }); - it('can load a custom cjs loader synchronously', async () => { + it('can load a custom cjs loader synchronously', { skip: skipCjsTests }, async () => { const loader = useCustomLoaderSync(`./custom-loader.cjs`, import.meta.dirname); const result = await loader('some-name', { customLoaderContext: {} }); assert.strictEqual(result, 'I like turtles');