Not able to require the chai-http as commonjs() in latest version #336
              
                Unanswered
              
          
                  
                    
                      Nanagoud007
                    
                  
                
                  asked this question in
                Support
              
            Replies: 1 comment
-
| 
         The latest version is esm only. You will need to use a dynamic import or the older version until you migrate your own code to esm  | 
  
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
when i require module like this
const chai = require('chai');
const expect = chai.expect;
chai.use(require('chai-http'));
when i run the test case i am getting this error
my project is all depending on require so i can't go to import
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/nanagoudt/numo_backend_repos/multitenant-cpuptime-service/node_modules/chai-http/index.js from /home/nanagoudt/numo_backend_repos/multitenant-cpuptime-service/test/write-status-logs.test.js not supported.
Instead change the require of index.js in /home/nanagoudt/numo_backend_repos/multitenant-cpuptime-service/test/write-status-logs.test.js to a dynamic import() which is available in all CommonJS modules.
Beta Was this translation helpful? Give feedback.
All reactions