Jasmine2: get current spec name

前端 未结 6 696
天涯浪人
天涯浪人 2020-12-15 19:34

In Jasmine 1.3, we had this option to the get current spec and suite names:

describe(\"name for describe\", function () {
    it(\"name for it\", function ()         


        
6条回答
  •  天涯浪人
    2020-12-15 20:18

    I add a new jasmine reporter, then get the spec name without define N variable on each spec. Hope can help, thanks.

    var reporterCurrentSpec = {
         specStarted: function(result) {
             this.name = result.fullName;
         }
     };
    jasmine.getEnv().addReporter(reporterCurrentSpec);
    

提交回复
热议问题