tielushko edited a comment on issue #11662:
URL: https://github.com/apache/arrow/issues/11662#issuecomment-1049166247


   The top answer here: 
   
   
https://stackoverflow.com/questions/57712235/referenceerror-textencoder-is-not-defined-when-running-react-scripts-test/57713960#57713960
 
   
   seemed to resolve my issues. I also added the TextDecoder from utils and ran 
the test with the environment specified. 
   ```
   const Environment = require("jest-environment-jsdom");
   
   /**
    * A custom environment to set the TextEncoder and TextDecoder
    */
   module.exports = class CustomTestEnvironment extends Environment {
     async setup() {
       await super.setup();
       if (typeof this.global.TextEncoder === "undefined") {
         const { TextEncoder } = require("util");
         this.global.TextEncoder = TextEncoder;
       }
   
       if (typeof this.global.TextDecoder === "undefined") {
         const { TextDecoder } = require("util");
         this.global.TextDecoder = TextDecoder;
       }
     }
   };
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to