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
오타가있는 것 같습니다. 아래 내 대답을 참조하십시오. –