A
A
Alex Khayev2022-01-28 18:21:48
JavaScript
Alex Khayev, 2022-01-28 18:21:48

Jest: Describe.each for asynchronous collection?

It is necessary to make a set of tests for the collection received asynchronously.

I try like this:

let collection = [];
beforeAll( async() => {  collection = await getAsyncCollection() }

describe.each(collection)("Test summary for collection", (item)=>{
     // ...  и вот сюда мы не попадаем, потому  что сначала отрабатывает each на пустой коллекции, а потом уже beforeAll получает коллекци. 
})


How to make Describe for an asynchronous collection and why does each work before beforeAll ?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question