My tests require a promise to be resolved before they start. I have the following:
- before() hook with the asynchronous call
- a test on the same level as the before() hook
- a group of level 2 tests grouped in a nested describe()
The level1 test is correctly synchronized on the promise in the before() hook. However the describe() group is not. Why not and how to synchronize it?
describe('My tests)=> {
const thePromise$ = (asynchronous call here)
before(async () => await thePromise$)
beforeEach(async () => await thePromise$) //an extra safeguard?
if('Test Level1', ()=> {
console.log('Test1')
//won't start until thePromise$ is resolved, excatly as I want
})
describe('Level2 Test group', ()={
console.log('Level2 test group')
//starts right away, does not wait for the promise to be resolved
})
})