मैं निम्नलिखित स्टब्स पूरी तरह से पहलेसिनोन ठूंठ callsFake तर्क
sinon.stub(console, 'log',() => {
// Check what the arguments holds
// And either console.info it or do nothing
});
उदाहरण के लिए चल रहा है, अंदर वहाँ console.info(arguments)
जोड़ने, मुझे दिखाओ होता था जो कुछ console.log
हो रही थी।
संस्करण 2xx
के साथ मैं callsFake
में स्विच:
sinon.stub(console, 'log').callsFake(() => {
// Check what the arguments holds
// And either console.info it or do nothing
});
यह अब काम करता है। console.info(arguments)
में बाजार मूल्य हैं, और console.log
के साथ क्या करने के लिए कुछ भी नहीं है।
मैं क्या गलत कर रहा हूं ?!
रिटर्न के साथ callsFake के बजाय ऐसे() –