Relative Content

Tag Archive for javascriptnode.jsexpressmocha.jschai

Can you run Chai tests using Mocha for ES6 modules?

I am trying to run an API test for getting the version using Chai. I have this test in a version.tests.js file inside the src/tests folder. I am using “mocha ./src/tests/**/*.tests.js” to run it.

For some reason I get this error when running the command above:

error when making request in test using mocha with chaiHttp

I try to use chai to make a request to my API on the /login route, but it cannot complete, I can use the same structure to do it for another route but it is not working in the best way.
enter image description here
enter image description here