我想介绍 should assert 库,用于测试我的 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()
有什么建议可以在实践中做到这一点吗?
最佳答案
should.myExits = myExists
应该是
should.myExist = myExists
关于javascript - 如何扩展 'should' 库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18508683/