How to test node.js?

Trying to begin testing using Jasmine. All the tutorials show method describe, but do not show how to connect it. If they do not connect, but I write out the error ReferenceError: describe is not defined.
July 2nd 19 at 14:27
2 answers
July 2nd 19 at 14:29
Solution
https://semaphoreci.com/community/tutorials/gettin...
Note the line:
"scripts": {
 "test": "./node_modules/.bin/jasmine-node spec"
 }
Thank you. There is still a question. How module testing: jasmine or jasmine-node? How do they differ? It may be better to use something else? - lavon.Turn commented on July 2nd 19 at 14:32
July 2nd 19 at 14:31
Solution
They don't put it on (alas). jasmine and mocha work, creating its own execution environment, where you pass their tests.
Thank you. There is still a question. Jasmine requires at startup to specify the folder from which to take all js files to run. But tests need to make transitions across levels of the species ../../***/***/ in order to find the needed module. If you try to put the tests next to the executables that jasmine will not be able to distinguish between them. How more competently to build the structure of the project? - lavon.Turn commented on July 2nd 19 at 14:34
:
> jasmine will not be able to distinguish between them

Like if they are called as .test.js it is possible to tell Jasmine to take only the files '*.test.js'. Read more here to delve: https://github.com/jasmine/jasmine-npm#configuration

I advise you to look in the direction https://github.com/tapjs/node-tap -- setup and API is much simpler.
- lavon.Turn commented on July 2nd 19 at 14:37

Find more questions by tags Node.jsnpm