lundi 1 mars 2021

how to run beforeEach before `before` hook

I have the following code.

describe("mytest", () => {

   beforeEach(() => {
      console.log("first");
   })

   context("first context", () => {
      before(() => {
         console.log("second");
      })

   })
 
})

What I want to achieve is that I want first to get printed first and then second. It seems like the problem is before hook. beforeEach runs before each test case, but not before before hook. Any ideas ?

Aucun commentaire:

Enregistrer un commentaire