Skip to content Skip to sidebar Skip to footer

Referenceerror: Textencoder Is Not Defined With Mongodb Nodes

I am trying to run jest test cases but I am facing error - ReferenceError: TextEncoder is not defined . Node version -14.18.0. Mongodb NPM - 4.1.3 . Typescript version - 4.4.3. B

Solution 1:

Ok the problem got solved.

I have added at the top --

global.TextEncoder = require("util").TextEncoder;
global.TextDecoder = require("util").TextDecoder;

Not sure why the error was showing.


Post a Comment for "Referenceerror: Textencoder Is Not Defined With Mongodb Nodes"