2
我想要介紹應該斷言庫,工作測試我的node.js應用程序,我的附加功能。如何擴展'應該'庫
喜歡的東西在這個僞
should = require "should"
myExists = (obj, msg) ->
# my special exist logic
containSomething = (obj, msg) ->
# my special assert logic
should.myExists = myExists
should.containSomething = containSomething
describe.only "`my extra `", ->
it 'should be working', (done) ->
obj = {}
obj.should.myExists
obj.should.not.myExists
obj.should.containSomething {cool:obj}
obj.should.not.containSomething {cool:obj}
done()
任何建議,如何做到這一點的做法?
你試圖實現它?你做了什麼事? –
@ ben336它不工作。 myExist不存在於對象中。 – Luman75
看起來你有一個錯字。請參閱下面的答案。 –