I'm having difficulties while executing test script on my node.js
project using Mocha. Problem is that test script never finishes, unless I finish it manually (ctrl+c). This problem started after I added --timeout
parameter to mocha.opts
. Timeout is added because I use mock-mongoose
library, where suggested timeout is 120000 ms
. Here is my mocha.opts
:
--require ts-node/register
--watch-extensions ts
--timeout 120000
tests/**/*.ts
Here's code example:
it("POST '/route' should return OK", async () => {
const result = await routeController.createSomething(data)
expect(result.statusCode).is.equal(HttpStatus.OK)
})
I also tried calling done()
function, but still not helping. My project structure:
node_modules
src
--- source code...
tests
--- tests source...
package.json
package-lock.json
....
Test script: mocha --opts ./tests/mocha.opts
Thanks in advance!
Aucun commentaire:
Enregistrer un commentaire