Jasmine2: get current spec name

前端 未结 6 707
天涯浪人
天涯浪人 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:39

    This worked for me in jasmine 3.5+

    I know this is a relatively old question but found something which worked for me

    describe('Desc1',() => {
       
        afterEach(() => {
          const myReporter = {
            specDone: (result) => {
              console.log('Spec FullName: ' + result.fullName);
              console.log('Spec Result: ' + result.status);
            }
          };
          jasmine.getEnv().addReporter(myReporter);
        });
    })
    

    Credit for the solution : https://groups.google.com/g/jasmine-js/c/qqOk6Nh7m4c/m/Nyovy2EjAgAJ

提交回复
热议问题