karma runner - How to get filename of the test in mocha reporter -


is there way filename of current test in mocha reporter?

i couldn't find in base , examples.

actually, file name passed suite in file field in mocha starting this pull request. it's nowadays mocha commonly ran karma plugin (namely, karma-mocha plugin), and, talking of december'14, plugin not pass file name information further.

to make answer self-consistent, here's how suite formed in mocha (it's tdd implementation, it similar bdd):

context.suite = function(title, fn){       var suite = suite.create(suites[0], title);       suite.file = file;       suites.unshift(suite);       fn.call(suite);       suites.shift();       return suite;     }; 

and here's how suits formed in karma-mocha/lib/adapter.js:

 runner.on('test end', function(test) {       var skipped = test.pending === true;        var result = {          id: '',          description: test.title,         suite: [],          success: test.state === 'passed',         skipped: skipped,         time: skipped ? 0 : test.duration,         log: test.$errors || []       };          var pointer = test.parent;       while (!pointer.root) {         result.suite.unshift(pointer.title);         pointer = pointer.parent;       }           tc.result(result);     }); 

but know what, guess nice thing issue feature request in karma-mocha project.


Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

thorough guide for profiling racket code -