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

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -