Reputation: 2627
My tests require a promise to be resolved before they start. I have the following:
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
})
})
Upvotes: -1
Views: 88
Reputation: 2627
While I not find a solution to this specific question, I found a way to get done what I really needed, which prompted the question to begin with: how to generate it() tests out of test data that require an asynchronous call to retrieve.
how to generate it() tests after waiting on an asynchronous response
Upvotes: 1