vendredi 5 mars 2021

describe block in test doesn't work as expected

I am using mocha.


describe('test', async function ()  {
  let a;
  

  before(async () => {
    a = 10;
  })


  it("ff", () => {

  })

  describe("nice", () => {
    const b = a;
    console.log(b);
    it("ss", () => {
      console.log("nice")
    })
  })
})

It seems like console.log(b) prints undefined. Even though before block gets executed first .

Any idea b is undefined and not 10 ?

Aucun commentaire:

Enregistrer un commentaire