mardi 23 février 2021

In Jest, how to run a piece of code to do mock before each describe block?

There are hundreds of jest test files, and in each unit test files there could be mutiple describe block.

Is there a config or method to automatically run a block of code to do mock and setup before each describe block?

I know a brutal method which is to put beforeAll() in each describe block in hundreds of files, but it is too much editing. I tried the jest config object, but didn't find any useful option.

Aucun commentaire:

Enregistrer un commentaire