alsatian
alsatian copied to clipboard
Setup and teardown hooks that runs before and after ALL test suites executed?
It would be nice to have setup and teardown hooks that executes before ALL fixtures ONCE and teradown after ALL fixtures ONCE in addition to fixture hooks.
For example, it is convenient for setup test environment globally only once before all tests via hooks instead of creating custom singleton
I would say in general this is a bad idea of you can avoid it as there's a risk of making tests flaky or having setup that's unclear in the scope of the test.
Have you got an example use case?
I would say in general this is a bad idea of you can avoid it as there's a risk of making tests flaky or having setup that's unclear in the scope of the test.
Have you got an example use case? A good example is when we need to create and initialize test database, especially if it takes long time for unit tests to run before each suite.
Ah I see. In these cases I usually set this up before Alsatian is even called. Do you think there would be a benefit in having Alsatian handle this?
An example of the above would be
npm run setup:database && alsatian "./**/*.spec.js"