In almost 2021, is there a way to mock a single function? I mean function without object.
// demo.js
module.exports = () => {
return 'real func demo';
};
// demo.test.js
const demo = require("./demo");
// ...
sinon.stub(demo).callsFake(() => {
return 'mocked function';
});
expect(demo()).to.eq('mocked function')