title: Running the same mocha test multiple times with different data
body: <h2>Problem</h2>
  
  <p>I have several tests that do the same thing in mocha. This for me, it's duplication, and is the worst thing to do when you want your system to be maintenable.</p>
  
  <pre><code>var exerciseIsPetitionActive = function (expected, dateNow) {
      var actual = sut.isPetitionActive(dateNow);
      chai.assert.equal(expected, actual);
  };
  
  test('test_isPetitionActive_calledWithDateUnderNumSeconds_returnTrue', function () {
      exerciseIsPetitionActive(true, new Date('2013-05-21 13:11:34'));
  });
  
  test('test_isPetitionActive_calledWithDateGreaterThanNumSeconds_returnFalse', function () {
      exerciseIsPetitionActive(false, new Date('2013-05-21 13:12:35'));
  });
  </code></pre>
  
  <h2>What do I need</h2>
  
  <p>I need a way of collapsing my duplicated mocha tests in only one.  </p>
  
  <p>For example, in PhpUnit (and other test frameworks) you have <a href="http://phpunit.de/manual/3.7/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.data-providers" rel="noreferrer">dataProviders</a>.<br>
  In phpUnit a dataProvider works this way:   </p>
  
  <pre><code>&lt;?php class DataTest extends PHPUnit_Framework_TestCase {
      /**
       * @dataProvider provider
       */
      public function testAdd($a, $b, $c)
      {
          $this-&gt;assertEquals($c, $a + $b);
      }
  
      public function provider()
      {
          return array(
            array(0, 0, 0),
            array(0, 1, 1),
            array(1, 0, 1),
            array(1, 1, 3)
          );
      }
  }
  </code></pre>
  
  <p>The provider in here injects parameters to the test, and the test executes all the cases. Is perfect for duplicated test.</p>
  
  <p>I want to know if in mocha is there something similar, for example, something like this:   </p>
  
  <pre><code>var exerciseIsPetitionActive = function (expected, dateNow) {
      var actual = sut.isPetitionActive(dateNow);
      chai.assert.equal(expected, actual);
  };
  
  @usesDataProvider myDataProvider
  test('test_isPetitionActive_calledWithParams_returnCorrectAnswer', function (expected, date) {
      exerciseIsPetitionActive(expected, date);
  });
  
  var myDataProvider = function() {
    return {
        {true, new Date(..)},
        {false, new Date(...)}
    };
  };
  </code></pre>
  
  <h2>What I have already looked at</h2>
  
  <p>There is some tecnique that is called <a href="https://github.com/visionmedia/mocha/wiki/Shared-Behaviours" rel="noreferrer">Shared Behaviours</a> . But it does not solve the problem directly with a test suite, it just solve the problem with different components that have duplicated tests.</p>
  
  <h2>The Question</h2>
  
  <p><strong>Do you know any way to implement dataProviders in mocha?</strong></p>