dimanche 1 mars 2015

How to pass parameter from spec to reporter in Jasmine?

I am writing a jasmine reporter, and I want to be able to pass parameters from individual specs to the reporter. For example:


the spec:



// I prefer this way
it("my spec 1", function() { ... }, { myParam: true });

// But this way would also be fine if it can work
it("my spec 2", function() {
this.myParam = true;
...
});


the reporter:



this.specDone = function(specResult) {
var myParam = // some way to access myParam
...
}


I haven't found any documentation for something like this, nor any example of something similar in other reporters.


I also tried debugging the flow of jasmine to see what objects get passed to each method but so far I had no luck in finding a simple solution.


How can this be done?


Aucun commentaire:

Enregistrer un commentaire