From 2935acb2f0a0855dd11aa8a586dd3bb97d34a824 Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Tue, 2 Apr 2024 15:37:38 +0200 Subject: [PATCH 1/3] try to stabilize flimsy tests --- .../src/AccumulateMultipartResponsesLink.test.ts | 9 +++------ .../src/RemoveMultipartDirectivesLink.test.ts | 13 +++++-------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/packages/client-react-streaming/src/AccumulateMultipartResponsesLink.test.ts b/packages/client-react-streaming/src/AccumulateMultipartResponsesLink.test.ts index 5df1f453..2b5473f9 100644 --- a/packages/client-react-streaming/src/AccumulateMultipartResponsesLink.test.ts +++ b/packages/client-react-streaming/src/AccumulateMultipartResponsesLink.test.ts @@ -10,14 +10,11 @@ import { test, mock } from "node:test"; import assert from "node:assert"; import { fromPartial } from "@total-typescript/shoehorn"; import type { SubscriptionObserver } from "zen-observable-ts"; -import { runInConditions } from "./util/runInConditions.js"; - -runInConditions("node", "browser"); const { DebounceMultipartResponsesLink: AccumulateMultipartResponsesLink } = await import("#bundled"); -test("normal queries can resolve synchronously", () => { +await test("normal queries can resolve synchronously", () => { const query = gql` query { fastField @@ -49,7 +46,7 @@ test("normal queries can resolve synchronously", () => { }); }); -test("deferred query will complete synchonously if maxDelay is 0", () => { +await test("deferred query will complete synchonously if maxDelay is 0", () => { const query = gql` query { fastField @@ -84,7 +81,7 @@ test("deferred query will complete synchonously if maxDelay is 0", () => { }); }); -test("`next` call will be debounced and results will be merged together", () => { +await test("`next` call will be debounced and results will be merged together", () => { mock.timers.enable(); const query = gql` diff --git a/packages/client-react-streaming/src/RemoveMultipartDirectivesLink.test.ts b/packages/client-react-streaming/src/RemoveMultipartDirectivesLink.test.ts index 68f6f784..02a6adc0 100644 --- a/packages/client-react-streaming/src/RemoveMultipartDirectivesLink.test.ts +++ b/packages/client-react-streaming/src/RemoveMultipartDirectivesLink.test.ts @@ -5,9 +5,6 @@ import { gql, Observable } from "@apollo/client/core/index.js"; import { print } from "graphql"; import { it } from "node:test"; import assert from "node:assert"; -import { runInConditions } from "./util/runInConditions.js"; - -runInConditions("node", "browser"); const { RemoveMultipartDirectivesLink } = await import("#bundled"); @@ -51,7 +48,7 @@ const queryWithDeferAndStripAnnotation = gql` } `; -it("removes fields with a @defer directive", () => { +await it("removes fields with a @defer directive", () => { const link = new RemoveMultipartDirectivesLink({ stripDefer: true, }); @@ -69,7 +66,7 @@ query myQuery { ); }); -it("`stripDefer` defaults to `true`", () => { +await it("`stripDefer` defaults to `true`", () => { const link = new RemoveMultipartDirectivesLink({ stripDefer: true, }); @@ -87,7 +84,7 @@ query myQuery { ); }); -it("preserves @defer fields with a `SsrDontStrip` label", () => { +await it("preserves @defer fields with a `SsrDontStrip` label", () => { const link = new RemoveMultipartDirectivesLink({ stripDefer: true, }); @@ -114,7 +111,7 @@ query myQuery { ); }); -it("can be configured to not remove @defer fields", () => { +await it("can be configured to not remove @defer fields", () => { const link = new RemoveMultipartDirectivesLink({ stripDefer: false, }); @@ -138,7 +135,7 @@ query myQuery { ); }); -it("even with `stripDefer: false`, certain fields can be marked for stripping", () => { +await it("even with `stripDefer: false`, certain fields can be marked for stripping", () => { const link = new RemoveMultipartDirectivesLink({ stripDefer: false, }); From 618c91ca1f210e586d34a7185dc39890fba3a765 Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Tue, 2 Apr 2024 16:02:15 +0200 Subject: [PATCH 2/3] use node 21 for unit tests --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f8ae0983..e6ad48e2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -45,7 +45,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: "20.x" + node-version: "21.x" cache: "yarn" - run: yarn install --immutable - run: yarn workspaces foreach --all --include "@apollo/*" add -D -P @apollo/client@${{ matrix.version }} From a4e19844a05d6933a4454ff80ec784394525dc7f Mon Sep 17 00:00:00 2001 From: Lenz Weber-Tronic Date: Tue, 2 Apr 2024 16:12:36 +0200 Subject: [PATCH 3/3] pin specific node version --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e6ad48e2..66eea798 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -45,7 +45,7 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: - node-version: "21.x" + node-version: "20.11.0" cache: "yarn" - run: yarn install --immutable - run: yarn workspaces foreach --all --include "@apollo/*" add -D -P @apollo/client@${{ matrix.version }}