Coding & Programming > JavaScript Forum

How to use sinon for stubing in mocha node.js?


Hi, I am working on javascript programming & it allows me to learn HTML which enhance my knowledge of AJAX, JSON and DOM Objects in Javascript which helps me in my learnings. I have faced an issue that how can I use sinon for stubing in mocha node.js which is a feature-rich JavaScript test framework running on Node.js making asynchronous testing simple and fun. I have read related info in almost all javascript developer forums and I also found this platform very useful. I hope any tech developer will resolve my issue.

var stub = sinon. stub(object, "foo"); //do your assertions stub. restore(); //back to normal now. This will allow you to create a default function that replaces object.


[0] Message Index

Go to full version