title: Mocha & Enzyme - same test failing the second time
body: <p>I'm trying to test a React component with some propType logic. The component should take a <code>myprop</code> prop that should match <code>{value: [anything]}</code>.</p>
  
  <p>The first test works, but the second (which is exactly the same code) doesn't. </p>
  
  <p>Any idea why ?</p>
  
  <p>EDIT : I think it's React that does not call <code>console.error()</code> every time, but only once. Probably to avoid spamming the console...</p>
  
  <pre><code>import React from 'react';
  import chai, { expect } from 'chai';
  import chaiEnzyme from 'chai-enzyme'
  import { shallow } from 'enzyme';
  chai.use(chaiEnzyme());
  
  class MyComponent extends React.Component {
      render() {
          return (
              &lt;div&gt;
                  {this.props.myprop.value}
              &lt;/div&gt;
          );
      }
  }
  MyComponent.propTypes = {
      myprop: (props, propName, componentName) =&gt; {
          const prop = props[propName];
          if (typeof(prop) !== 'object') {
              return new Error(`&lt;${componentName}&gt; requires the prop \`${propName}\``);
          }
          else {
              if (typeof(prop.error) === 'undefined' || !prop.error) {
                  if (typeof(prop.value) === 'undefined') {
                      return new Error(`&lt;${componentName}&gt; requires the prop \`${propName}\` to have a \`value\` field`);
                  }
              }
          }
          return null;
      },
  };
  
  //Mocking console.error to throw propType errors
  let console_error = console.error;
  console.error = function(warning) {
      if (/(Invalid prop|Failed prop type)/.test(warning)) {
          throw new Error(warning);
      }
      console_error.apply(console, arguments);
  };
  
  describe('&lt;MyComponent/&gt;', function() {
      describe('with invalid `myprop` format', function() {
          it('should throw an error', function(done) {
              //This test passes
  
              //Execute
              const fn = () =&gt; shallow(&lt;MyComponent myprop={{}}/&gt;);
  
              //Verify
              expect(fn).to.throw(Error, 'requires the prop \`myprop\` to have a \`value\` field');
              done();
          });
  
          it('should throw an error', function(done) {
              //Exactly the same code as above -- does not pass
  
              //Execute
              const fn = () =&gt; shallow(&lt;MyComponent myprop={{}}/&gt;);
  
              //Verify
              expect(fn).to.throw(Error, 'requires the prop \`myprop\` to have a \`value\` field');
              done();
          });
      });
  });
  </code></pre>