From 3151f814bad148d8fc4e5c1f515ebd9083940501 Mon Sep 17 00:00:00 2001 From: George Payne Date: Thu, 8 Oct 2020 23:47:00 +0200 Subject: [PATCH 1/2] Allow tests to run on LTS node - inherit test target from project - convert all bigint literals to BigInt(n) --- .../connectToPersistentSubscription.test.ts | 2 +- .../createPersistentSubscription.test.ts | 2 +- src/__test__/streams/deleteStream.test.ts | 4 ++-- src/__test__/streams/readEventsFromStream.test.ts | 8 ++++---- src/__test__/streams/subscribeToStream.test.ts | 2 +- src/__test__/streams/tombstoneStream.test.ts | 4 ++-- src/__test__/streams/writeEventsToStream.test.ts | 10 ++++++---- src/__test__/tsconfig.json | 3 --- 8 files changed, 17 insertions(+), 18 deletions(-) diff --git a/src/__test__/persistentSubscription/connectToPersistentSubscription.test.ts b/src/__test__/persistentSubscription/connectToPersistentSubscription.test.ts index 3931c55d..adbb8db0 100644 --- a/src/__test__/persistentSubscription/connectToPersistentSubscription.test.ts +++ b/src/__test__/persistentSubscription/connectToPersistentSubscription.test.ts @@ -98,7 +98,7 @@ describe("connectToPersistentSubscription", () => { await createPersistentSubscription(STREAM_NAME, GROUP_NAME) .authenticated("admin", "changeit") - .fromRevision(1n) + .fromRevision(BigInt(1)) .execute(connection); const defer = new Defer(); diff --git a/src/__test__/persistentSubscription/createPersistentSubscription.test.ts b/src/__test__/persistentSubscription/createPersistentSubscription.test.ts index d69d4aab..7e29c85f 100644 --- a/src/__test__/persistentSubscription/createPersistentSubscription.test.ts +++ b/src/__test__/persistentSubscription/createPersistentSubscription.test.ts @@ -40,7 +40,7 @@ describe("createPersistentSubscription", () => { await expect( createPersistentSubscription(STREAM_NAME, GROUP_NAME) .authenticated("admin", "changeit") - .fromRevision(1n) + .fromRevision(BigInt(1)) .execute(connection) ).resolves.toBeUndefined(); }); diff --git a/src/__test__/streams/deleteStream.test.ts b/src/__test__/streams/deleteStream.test.ts index c43a3e19..f3525c9d 100644 --- a/src/__test__/streams/deleteStream.test.ts +++ b/src/__test__/streams/deleteStream.test.ts @@ -66,7 +66,7 @@ describe("deleteStream", () => { it("fails", async () => { try { const result = await deleteStream(STREAM) - .expectedRevision(2n) + .expectedRevision(BigInt(2)) .execute(connection); expect(result).toBe("Unreachable"); @@ -74,7 +74,7 @@ describe("deleteStream", () => { expect(error).toBeInstanceOf(WrongExpectedVersionError); if (error instanceof WrongExpectedVersionError) { expect(error.streamName).toBe(STREAM); - expect(error.expectedVersion).toBe(2n); + expect(error.expectedVersion).toBe(BigInt(2)); } } }); diff --git a/src/__test__/streams/readEventsFromStream.test.ts b/src/__test__/streams/readEventsFromStream.test.ts index 7ec7fafe..4153f2ed 100644 --- a/src/__test__/streams/readEventsFromStream.test.ts +++ b/src/__test__/streams/readEventsFromStream.test.ts @@ -59,7 +59,7 @@ describe("readEventsFromStream", () => { describe("Event types", () => { test("json event", async () => { const [resolvedEvent] = await readEventsFromStream(STREAM_NAME) - .fromRevision(1n) + .fromRevision(BigInt(1)) .count(1) .execute(connection); @@ -75,7 +75,7 @@ describe("readEventsFromStream", () => { test("binary event", async () => { const [resolvedEvent] = await readEventsFromStream(STREAM_NAME) - .fromRevision(5n) + .fromRevision(BigInt(5)) .count(1) .execute(connection); @@ -100,7 +100,7 @@ describe("readEventsFromStream", () => { test("from revision", async () => { const events = await readEventsFromStream(STREAM_NAME) - .fromRevision(1n) + .fromRevision(BigInt(1)) .count(Number.MAX_SAFE_INTEGER) .execute(connection); @@ -119,7 +119,7 @@ describe("readEventsFromStream", () => { test("backward from revision", async () => { const events = await readEventsFromStream(STREAM_NAME) - .fromRevision(1n) + .fromRevision(BigInt(1)) .backward() .count(Number.MAX_SAFE_INTEGER) .execute(connection); diff --git a/src/__test__/streams/subscribeToStream.test.ts b/src/__test__/streams/subscribeToStream.test.ts index 9dac1396..4d23c8bd 100644 --- a/src/__test__/streams/subscribeToStream.test.ts +++ b/src/__test__/streams/subscribeToStream.test.ts @@ -148,7 +148,7 @@ describe("subscribeToStream", () => { await subscribeToStream(STREAM_NAME) .authenticated("admin", "changeit") - .fromRevision(2n) + .fromRevision(BigInt(2)) .on("close", handleClose) .on("error", handleError) .on("event", handleEvent) diff --git a/src/__test__/streams/tombstoneStream.test.ts b/src/__test__/streams/tombstoneStream.test.ts index 521992f4..1e29035a 100644 --- a/src/__test__/streams/tombstoneStream.test.ts +++ b/src/__test__/streams/tombstoneStream.test.ts @@ -76,7 +76,7 @@ describe("tombstoneStream", () => { it("fails", async () => { try { const result = await tombstoneStream(STREAM) - .expectedRevision(2n) + .expectedRevision(BigInt(2)) .execute(connection); expect(result).toBe("Unreachable"); @@ -84,7 +84,7 @@ describe("tombstoneStream", () => { expect(error).toBeInstanceOf(WrongExpectedVersionError); if (error instanceof WrongExpectedVersionError) { expect(error.streamName).toBe(STREAM); - expect(error.expectedVersion).toBe(2n); + expect(error.expectedVersion).toBe(BigInt(2)); } } }); diff --git a/src/__test__/streams/writeEventsToStream.test.ts b/src/__test__/streams/writeEventsToStream.test.ts index bc3da09b..faa8ccc3 100644 --- a/src/__test__/streams/writeEventsToStream.test.ts +++ b/src/__test__/streams/writeEventsToStream.test.ts @@ -172,7 +172,7 @@ describe("writeEventsToStream", () => { try { const result = await writeEventsToStream(STREAM_NAME) - .expectedRevision(1n) + .expectedRevision(BigInt(1)) .send(...testEvents()) .execute(connection); @@ -182,7 +182,7 @@ describe("writeEventsToStream", () => { if (error instanceof WrongExpectedVersionError) { expect(error.streamName).toBe(STREAM_NAME); - expect(error.expectedVersion).toBe(1n); + expect(error.expectedVersion).toBe(BigInt(1)); expect(error.actualVersion).toBe(NO_STREAM); } } @@ -199,7 +199,7 @@ describe("writeEventsToStream", () => { try { const result = await writeEventsToStream(STREAM_NAME) - .expectedRevision(nextExpectedVersion + 1n) + .expectedRevision(nextExpectedVersion + BigInt(1)) .send(...testEvents()) .execute(connection); @@ -209,7 +209,9 @@ describe("writeEventsToStream", () => { if (error instanceof WrongExpectedVersionError) { expect(error.streamName).toBe(STREAM_NAME); - expect(error.expectedVersion).toBe(nextExpectedVersion + 1n); + expect(error.expectedVersion).toBe( + nextExpectedVersion + BigInt(1) + ); expect(error.actualVersion).toBe(nextExpectedVersion); } } diff --git a/src/__test__/tsconfig.json b/src/__test__/tsconfig.json index 79e63307..b32e4f5a 100644 --- a/src/__test__/tsconfig.json +++ b/src/__test__/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "../../tsconfig.json", - "compilerOptions": { - "target": "ES2020" - }, "include": ["**/*.test.ts"], "exclude": [] } From bb5bfcfca77313aa9bab7b1f0b0dc51e74502b75 Mon Sep 17 00:00:00 2001 From: George Payne Date: Fri, 9 Oct 2020 11:21:06 +0200 Subject: [PATCH 2/2] run CI on LTS node --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 14270b00..f406a5ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v1 with: - node-version: "14.x" + node-version: "12.x" - name: Login to GitHub Package Registry uses: docker/login-action@v1 with: