Running init first in NodeUnit - separate file

I am currently developing nodeunit tests and I came across a problem.

I have a folder named "Unit_tests"

In this folder, I have a testIitializer.js file that contains 2 methods: init and the term .

These methods should be run only once and only at the beginning and at the end of all other tests. Other tests are in separate folders under the root "Unit_tests".

How can I make sure this file is run first .

At the moment, this happens mainly, but in some cases it is not. Is there a way in webstormto make sure it works first?

Thank you very much in advance!

+4
source share
1 answer

As far as I know, this is not possible with NodeUnit alone, as it uses an asynchronous approach when callbacks are not executed in a predictable order. This behavior is determined by creation and should provide more realistic testing procedures and prevent dependencies between tests.

However, you can use Grunt JS with the NodeUnit plugin to fully control the testing process.

You can find a great article on this topic here:
http://markdalgleish.com/2012/09/test-driven-node-js-development-with-grunt/

0

Source: https://habr.com/ru/post/1534216/


All Articles