@tapjs/before-each
A default tap plugin providing t.beforeEach()
.
USAGE
This plugin is installed with tap by default. If you had
previously removed it, you can tap plugin add @tapjs/before-each
to
bring it back.
import t from 'tap'
t.beforeEach(t => {
})
If the method returns a promise, it will be awaited before moving
on to the next test.
The beforeEach
method is called for all child tests, not just
direct children. "Closer" ancestor beforeEach
methods are called
after further ancestors.
For example, this test:
import t from 'tap'
t.beforeEach(t => {
console.error('root before each', t.name)
})
t.test('parent test', t => {
t.beforeEach(t => {
console.error('parent before each', t.name)
})
t.test('child test', t => t.end())
t.end()
})
will print:
root before each parent test
root before each child test
parent before each child test