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) => {