title: How to mock a function with req and res parameters using sinon?
body: <p>I want to pass some test using mocks and stubs on sinon.
  controler.js:</p>
  
  <pre><code>const User = require('./models/user');
  module.exports.userRead = function userRead(req, res) {
   User
   .query()
   .then(users =&gt; {
      res.render('results', {data: users});
    })
   .catch((err) =&gt; {
      res.render('error');
   });
  </code></pre>
  
  <p>user.test.js:</p>
  
  <pre><code>const sinon = require('sinon');
  const controller = require('../controler');
  const Provider  = require('../provider');
  
  describe('Testing userRead', () =&gt; {
     const appStub = sinon.stub(Provider,'query');
     test('should returns users', () =&gt; {
         controler.userRead(req, res);
  
         appStub.restore();
         appStub.verify();
     });
  });
  </code></pre>
  
  <p>The test can't pass and I got this error:</p>
  
  <pre><code>ReferenceError: req is not defined
  </code></pre>
  
  <p>How can I fix that?</p>