javascriptfirefox-addonjavascript-frameworkjasmine

Output jasmine test results to the console



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 the test results to an HTML file,what I need is to Firebug Console or other solution to output the results.


Solution

  • Have you tried the ConsoleReporter?

    jasmine.getEnv().addReporter(new jasmine.ConsoleReporter(console.log));
    

    According to the code Jasmine has the ConsoleReporter class that executes a print function (in this case console.log) that should do what you need.

    If all else fails you could just use this as a starting point to implement your own console.log reporter.

    UPDATE In newer versions of jasmine, ConsoleReporter was removed. You can either use the built-in jsApiReporter, or write your own (console) reporter, as shown in the following link: https://jasmine.github.io/tutorials/custom_reporter