Open ASaiAnudeep opened 3 years ago
Thanks :)
Wouldn't pretest
and posttest
scripts work for this? Or running uvu programmatically
pretest
and posttest
doesn't work in my scenario. I need to have shared context between pretest
, test
and posttest
.
Example:
before(() => { /* add reporters*/ });
/*
suites/tests that uses above added reporters
*/
after(() => { /* end reporter*/ });
Not sure how to achieve this in pretest
& posttest
scripts.
This would be super useful for setting up/terminating DB connections as well!
I'm having a problem where I want to tear down connections after the last test has run. Since I want to be able to run tests in isolation and with the CLI, a global hook that always runs after the last test is done would work really well here
Maybe something like this?
Only a POC! If it gets implemented properly, it would probably look a little different
uvu.before
should run before all suites, uvu.beforeEach
should run before each suite
uvu.after
should run after all suites, uvu.afterEach
should run before each suite
Any movement on this feature ?
Having global before & after hooks that will run before & after all the tests/suites will help running tests that requires one/many global setups & one/many global teardowns.
Use Case: Running service level tests with pactum, where I need to start & stop a mock server before & after the test execution.
By the way, thank you for this awesome library. ❤️