Output jasmine test results to the console

后端 未结 4 1341
野趣味
野趣味 2020-12-13 08:53


I am using Jasmine (BDD Testing Framework for JavaScript) in my firefox add-on to test the functionality of my code.

The problem is that jasmine is outputing t

4条回答
  •  情书的邮戳
    2020-12-13 09:46

    In newest version of Jasmine (2.0) if you want to get test output to console you need to add following lines.

    var ConsoleReporter = jasmineRequire.ConsoleReporter();
    var options = {
       timer: new jasmine.Timer, 
       print: function () {
          console.log.apply(console,arguments)
    }};
    consoleReporter = new ConsoleReporter(options); // initialize ConsoleReporter
    jasmine.getEnv().addReporter(consoleReporter); //add reporter to execution environment
    

    Output to html is included by default however so if you don't want html output at all you have to edit your boot.js file and remove relevant lines from there. If you want to customize how output is displayed in console edit file console.js. Source

提交回复
热议问题