![](/img/trans.png)
[英]Debugging Coffeescript jasmine-node Tests in Webstorm/Intellij
[英]jasmine + coffeescript - jasmine skipping tests
Jasmine跳過了我的所有“ it”測試,但describe塊中的最后一個測試除外-我在測試中使用coffeescript,我相信這可能是原因。 當我查看由.coffee測試創建的已編譯JS時,我看到只有最后一個“ it”測試在其前面帶有“ return”一詞,這可能就是為什么其余測試被跳過的原因。
我的問題是,如何才能“返回”所有測試?
編譯后的最后一個測試是什么樣的:
return it("should filter a range of prices", function() {
看起來像什么(這些被specrunner跳過了):
it("should filter a specific price", function() {
我嘗試以另一種方式填充集合,現在可以正常工作了。
跳過第一個測試時,我的測試是什么樣的(specrunner表示通過了1個規范,此代碼跳過了0個):
describe "Products Collection", ->
it "should filter a specific price", ->
products = new Wishlist.Collections.Products
products.add({name: 'product1', price: 15.99})
products.add({name: 'product2', price: 21.99})
products.add({name: 'product3', price: 21.99})
products.add({name: 'product4', price: 1.99} )
match = products.where({price: 21.99})
expect(match.length).toBe(2)
it "should filter a range of prices", ->
products = new Wishlist.Collections.Products
products.add({name: 'product1', price: 15.99})
products.add({name: 'product2', price: 21.99})
products.add({name: 'product3', price: 21.99})
products.add({name: 'product4', price: 1.99})
expect(products.priceFilter(16,25).size()).toBe(2)
他們現在的樣子(正常工作):
describe "Products Collection", ->
it "should filter a specific price", ->
products = new Wishlist.Collections.Products [{name: 'product1', price: 15.99}, {name: 'product2', price: 21.99}, {name: 'product3', price: 21.99}, {name: 'product4', price: 1.99}]
match = products.where({price: 21.99})
expect(match.length).toBe(2)
it "should filter a range of prices", ->
products = new Wishlist.Collections.Products
products.add({name: 'product1', price: 15.99})
products.add({name: 'product2', price: 21.99})
products.add({name: 'product3', price: 21.99})
products.add({name: 'product4', price: 1.99})
expect(products.priceFilter(16,25).size()).toBe(2)
如您所見,使用products.add()不會引起問題,因為它可以在第二次測試中使用。 我不知道為什么這么重要。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.