Is there any automation that I can use when a test fails on jasmine to prepare the same environment for a specific failing test? I'm using karma as the spec runner.
For example:
describe("this plugin", function(){
beforeEach(function(){
$("body").append("<input type='text' id='myplugintester'>");
this.plugin = $("#myplugintester").plugin({
cond1: true,
cond2: new Date(),
condetc: null
});
}
afterEach(function(){
$("#myplugintester").data("plugin").destroy();
$("#myplugintester").remove();
}
it("should show the correct value", function(){
expect(this.plugin.value).toEqual("somevalue");
});
it("should display 'disabled' when cond3 is not null", function(){
this.plugin.cond3 = "blabla";
expect(this.plugin.value).toEqual("somevalue");
});
});
When the second case fails, I have to write this to a test page to debug what goes wrong with the code.
$("body").append("<input type='text' id='myplugintester'>");
this.plugin = $("#myplugintester").plugin({
cond1: true,
cond2: new Date(),
condetc: null
});
this.plugin.cond3 = "blabla";
console.log(this.plugin.value);
$("#myplugintester").data("plugin").destroy();
$("#myplugintester").remove();
Does any node package automate this? Or how do other developers react in this cases?
Note: I switched from grunt-jasmine
to grunt-karma
because of the speed. grunt-jasmine
allowed me to run single test cases on browsers which I could debug with Chrome Developer Tools. I looked for several html reporters for karma but they only state the result on output HTML. They are not running the specs which I can interrupt and debug.
Aucun commentaire:
Enregistrer un commentaire