Mocha is a JavaScript test framework for Node.js with features like browser support, asynchronous testing, test coverage report, and use of any assertion library.
afterEach()
is a hook or global method provided by Mocha that will execute after each test case in a block. It is usually used to clean-up after your test cases.
afterEach(name, fn)
name
: Optional stringfn
: Function to run after each test caseIn addition to
afterEach()
, there is alsobeforeEach()
, which runs before every test case. Read more in the official docs.
Free Resources