title: Using Sinon to read assert console messages in Mocha
body: <p>I am trying to test a web component. This web component writes a warning message to the console if an invalid property value is set. Currently, I have the following:</p>
  
  <pre><code>import { expect } from 'chai';
  import { mount } from 'avoriaz';
  
  import MyComponent from '../src/my-component.vue';
  
  const sinon = require('sinon');
  
  describe('my-component.vue', function() {
    let sandbox = null;
  
    beforeEach(function() {
      sandbox = sinon.sandbox.create();
      sandbox.stub(console, 'warn');
    });
  
    afterEach(function() {
      sandbox.restore();
    });
  
    it('should show warning message in console', function() {
      let wrapper = mount(MyComponent, { propsData: { start:-1 } });  // start has to be positive.
      let result = sandbox.calledWith('WARNING!');
      expect(result).to.equal(true);
    });
  });
  </code></pre>
  
  <p>When I run these tests, I get the following exception thrown:</p>
  
  <pre><code>sandbox.calledWith is not a function
  </code></pre>
  
  <p>I then tried to use sandbox.fakes.calledWith instead. I then received this error:</p>
  
  <pre><code>sandbox.fakes.calledWith is not a function
  </code></pre>
  
  <p>What am I doing wrong? How do I test to see if a console message is written to the console line? The thing is, if I remove the sandbox.stub(console, 'warn'); line, I can see the line written to the actual console window. So I know it's getting generated (as expected). I just can't figure out how to test for it.</p>
  
  <p>Any help is appreciated.</p>