title: Mocha unit tests and assertions in `for`loop
body: <p>I'm working on Gulp plugin allowing to write JavaScript code using reserved words written in language different than English - its main doing is translating, yet it is not what I'm about.</p>
  
  <p>Writing unit tests with Mocha and Should.js I noticed I can't use <code>for</code> loop like that:</p>
  
  <pre><code> describe('Proper translating JavaScript PL into JavaScript', function () {
      var asserts = [
          {
              passed: '(tak || nie) &amp;&amp; (prawda || fałsz)',
              expected: '(true || false) &amp;&amp; (true || false)'
          },
          {
              passed: 'jeśli (tak) { jeżeli (prawda) {}}',
              expected: 'if (true) { if (true) {}}'
          },
          {
              passed: 'przez (zm i = 1; i &lt;= 3; console.log(i++));',
              expected: 'for (var i = 1; i &lt;= 3; console.log(i++));'
          },
          {
              passed: 'zm sum = funkcja (a, b) { zwróć a + b; };',
              expected: 'var sum = function (a, b) { return a + b; };'
          },
          {
              passed: 'generator snowball() { zm a = 1; dostarcz a++; }',
              expected: 'function* snowball() { var a = 1; yield a++; }'
          },
          {
              passed: 'lol',
              expected: 'zap'
          }
      ];
  
      for (var i = 0, l = asserts.length; i &lt; l; i++) {
          var assert = asserts[i];
          var desc = 'should turn `' + assert.passed + '` into `' + assert.expected + '`';
          it(desc, function (done) {
              tester(assert.passed, assert.expected, done);
          });
      }
  });
  </code></pre>
  
  <p>When I do something like above, one error is stated as <code>failing</code> as much times as number of assertions.</p>
  
  <p><a href="https://i.stack.imgur.com/mGrk3.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mGrk3.png" alt="enter image description here"></a></p>
  
  <p>As you see we got 6 failings though there are right 2. Moreover, only one of them is mentioned here.</p>
  
  <p>I don't want to double describe statements like below:</p>
  
  <pre><code>describe('Proper translating JavaScript PL into JavaScript', function () {
      var asserts = [
          {
              passed: '(tak || nie) &amp;&amp; (prawda || fałsz)',
              expected: '(true || false) &amp;&amp; (true || false)'
          },
          {
              passed: 'jeśli (tak) { jeżeli (prawda) {}}',
              expected: 'if (true) { if (true) {}}'
          },
          {
              passed: 'przez (zm i = 1; i &lt;= 3; console.log(i++));',
              expected: 'for (var i = 1; i &lt;= 3; console.log(i++));'
          },
          {
              passed: 'zm sum = funkcja (a, b) { zwróć a + b; };',
              expected: 'var sum = function (a, b) { return a + b; };'
          },
          {
              passed: 'generator snowball() { zm a = 1; dostarcz a++; }',
              expected: 'function* snowball() { var a = 1; yield a++; }'
          },
          {
              passed: 'lol',
              expected: 'zap'
          }
      ];
  
      it('should be kicking 1', function (done) {
          tester(asserts[0].passed, asserts[0].expected, done);
      });
      it('should be kicking 2', function (done) {
          tester(asserts[1].passed, asserts[1].expected, done);
      });
      it('should be kicking 3', function (done) {
          tester(asserts[2].passed, asserts[2].expected, done);
      });
      it('should be kicking 4', function (done) {
          tester(asserts[3].passed, asserts[3].expected, done);
      });
      it('should be kicking 5', function (done) {
          tester(asserts[4].passed, asserts[4].expected, done);
      });
      it('should be kicking 6', function (done) {
          tester(asserts[5].passed, asserts[5].expected, done);
      });
  });
  </code></pre>
  
  <p>These <code>should be kicking N</code> don't matter - I've been to lazy to write stuff like:</p>
  
  <pre><code>it('should turn `(tak || nie) &amp;&amp; (prawda || fałsz)` into `(true || false) &amp;&amp; (true || false)`', function (done) {
      tester('(tak || nie) &amp;&amp; (prawda || fałsz)', '(true || false) &amp;&amp; (true || false)', done);
  });
  </code></pre>
  
  <p>Anyway, doing standalone assertions tests go ok.</p>
  
  <p><a href="https://i.stack.imgur.com/fFZRM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fFZRM.png" alt="enter image description here"></a></p>
  
  <p>First 5 tests succeed in both cases, we don't look at them at all, here.
  Tests we focus on are these 6 put in <code>asserts</code>.</p>
  
  <p>Doing tests in separated <code>it()</code> things go right.
  Doing tests in <code>for</code> loop, one fail makes <code>asserts.length</code> fails, additionally one fail makes other not seen.</p>