How do I focus on one spec in jasmine.js?

前端 未结 9 1921
借酒劲吻你
借酒劲吻你 2020-11-29 23:41

I have a bunch of failing specs from a rather large architectural change. I\'d like to work on fixing them one by one by tagging each one with \'focus\'.

Does jasmin

9条回答
  •  伪装坚强ぢ
    2020-11-29 23:59

    For anyone stumbling upon this, a better approach, which you can set up from the code itself, is to use this plugin: https://github.com/davemo/jasmine-only

    It allows you set the spec exclusivity right on the code like this:

    describe.only("MySpec", function() { 
      it('function 1', function() { 
        //... 
      }) 
    
      it.only('function 2', function() { 
        //... 
      }
    })
    // This won't be run if there are specs using describe.only/ddescribe or it.only/iit
    describe("Spec 2", function(){}) 
    

    There has been a long discussion to get this added to Jasmine core, see: https://github.com/pivotal/jasmine/pull/309

    If you happen to be using Jasmine via Karma/Testacular you should already have access to ddescribe() and iit()

提交回复
热议问题