From c4be6c8ba42280e475e02279afe4a1b469d48a41 Mon Sep 17 00:00:00 2001 From: Kathryn Beaty Date: Wed, 2 Oct 2024 15:08:04 -0400 Subject: [PATCH] add TextEncoder to test framework setup for count script test --- client/src/core/client/count/index.ts | 2 -- client/src/core/client/test/setupTestFramework.ts | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/client/src/core/client/count/index.ts b/client/src/core/client/count/index.ts index 669cda06f3..08be562fb5 100644 --- a/client/src/core/client/count/index.ts +++ b/client/src/core/client/count/index.ts @@ -1,5 +1,3 @@ -import { TextEncoder } from "util"; - import { COUNT_SELECTOR } from "coral-framework/constants"; import { bytesToBase64, diff --git a/client/src/core/client/test/setupTestFramework.ts b/client/src/core/client/test/setupTestFramework.ts index 47c4b922ba..4821eee2c5 100644 --- a/client/src/core/client/test/setupTestFramework.ts +++ b/client/src/core/client/test/setupTestFramework.ts @@ -1,5 +1,6 @@ import "@testing-library/jest-dom"; import { toHaveNoViolations } from "jest-axe"; +import { TextEncoder } from "util"; import expectAndFail from "./expectAndFail"; @@ -14,6 +15,9 @@ import "./setupConsole"; // to get around: https://github.com/facebook/jest/issues/3917 (global as any).expectAndFail = expectAndFail; +// we need to have this for count script +(global as any).TextEncoder = TextEncoder; + // Log unhandled rejections. // eslint-disable-next-line no-console process.on("unhandledRejection", (err) => {