const expect = require("chai").expect;
class Test
{
constructor(){ this.x= 10;}
run() {
describe("test goes here", function() {
it("sample test", function() {
expect(this.x).to.be.eq(10);
});
});
}
}
new Test().run();
getting x is undefined.
Issue : this inside describe points to complete different context, how to make x available to this inside mocha test