How to access describe and it messages in mocha? -
in mocha,
describe('this message text', function(){ it('and message text', function(done){ console.log(this); // {} empty }); }); how access 'this message text' 'and message text' inside tests?
i tried this object it's empty.
this.test.parent.title;
ctx suite has test object represents executing test has parent suite (describe) above it.
you can access title of current test this.test.title etc.
this method allows getting data (and other data) looking without having grab in before() etc functions.
Comments
Post a Comment