I am working on a Node.js backend application that uses mocha to run unit and integration tests.
As seen here and there (and many other that I do not post here but all say the same) I have the following test script:
"scripts": { "pretest": "eslint .", "test": "mocha --recursive \"tests/**/*.js\"" } Tests are arranged as follow :
tests |_integration | |_endpoint1 | | |_test-endpoint.js |_unit | |_components | | |_test_component1.js | | |_.... | |_services | | |_test-service1.js | | |_test-service2.js | | |_.... |..... When I run the npm test command mocha runs only test-service2.js and stops.
I am currently working on Mac with zsh as shell.
"test": "mocha --require test-setup.js './**/*.spec.js'"such approach seems more reasonable for me. Test files should not have a different file type such as.spec.js