<commit_before>
# mocha

  Mocha aims to take the best of several popular frameworks. BDD-style inspired by JSpec, parallelism inspired by Expresso, opt-in serial execution from Vows, and assertion expectancy from Qunit. 

```js
describe('Array', function(){
  describe('#indexOf()', function(){
    it('should return -1 when not present', function(){
      [1,2,3].indexOf(4).should.equal(-1);
    });

    it('should return the index when present', function(){
      [1,2,3].indexOf(3).should.equal(2);
      [1,2,3].indexOf(2).should.equal(1);
      [1,2,3].indexOf(1).should.equal(0);
    });
  });
});
```

## Features

  - proper exit status for CI support etc
  - auto-detects and disables coloring for non-ttys
  - async test timeout support
  - extensible reporting
    - dot matrix reporter
    - landing strip reporter
    - test-anything-protocol (TAP) producer
    - JSON reporter
    - streaming JSON reporter

## Todo

     [ ] before callbacks
     [ ] after callbacks
     [ ] fix progress reporter
     [ ] mutation cov etc
     [ ] browser support
     [ ] hook for should.js?
     [ ] assertions expected
     [ ] reporting
       [ ] html
       [ ] xunit
     [ ] pure-js code coverage
     [ ] optional parallelism via processes
     [ ] optional opt-in block-based serial execution
     [ ] CI-friendly (exit code)
     [ ] global leak reporting
     [ ] ability to target any test(s) to run

## Reporters

  Mocha reporters adjust to the terminal window,
  and always disable ansi-escape colouring when
  the stdio streams are not associated with a tty.

### Dot Matrix

  The Dot Matrix reporter is simply a series of dots
  that represent test cases, failures highlight in red.

   ![dot matrix reporter](http://f.cl.ly/items/3b3b471Z1p2U3D1P2Y1n/Screenshot.png)

   ![dot matrix failure](http://f.cl.ly/items/1P11330L033r423g1y1n/Screenshot.png)

## TAP

  The TAP reporter emits lines for a [Test-Anything-Protocol](http://en.wikipedia.org/wiki/Test_Anything_Protocol) consumer.

  ![test anything protocol](http://f.cl.ly/items/2O0X3h0d1Q430O1t1T3p/Screenshot.png)

## Landing Strip

  The Landing Strip reporter is a gimmicky test reporter simulating<commit_msg>interface examples<commit_after>
# mocha

  Mocha aims to take the best of several popular frameworks. BDD-style inspired by JSpec, parallelism inspired by Expresso, opt-in serial execution from Vows, and assertion expectancy from Qunit. 

## Features

  - proper exit status for CI support etc
  - auto-detects and disables coloring for non-ttys
  - async test timeout support
  - extensible reporting
    - dot matrix reporter
    - landing strip reporter
    - test-anything-protocol (TAP) producer
    - JSON reporter
    - streaming JSON reporter

## Todo

     [ ] default to all sync ... toggle back / forthwith flag or block
     [ ] before callbacks
     [ ] after callbacks
     [ ] fix progress reporter
     [ ] mutation cov etc
     [ ] browser support
     [ ] hook for should.js?
     [ ] assertions expected
     [ ] reporting
       [ ] html
       [ ] xunit
     [ ] pure-js code coverage
     [ ] optional parallelism via processes
     [ ] optional opt-in block-based serial execution
     [ ] CI-friendly (exit code)
     [ ] global leak reporting
     [ ] ability to target any test(s) to run

## Interfaces

 Mocha "interfaces" providing BDD, TDD, and expresso export-style flavoured APIs on top of the internals.
 
### BDD

```js
describe('Array', function(){
  before(function(){
    // ...
  });

  describe('#indexOf()', function(){
    it('should return -1 when not present', function(){
      [1,2,3].indexOf(4).should.equal(-1);
    });

    it('should return the index when present', function(){
      [1,2,3].indexOf(3).should.equal(2);
      [1,2,3].indexOf(2).should.equal(1);
      [1,2,3].indexOf(1).should.equal(0);
    });
  });
});
```

### TDD

```js
suite('Array', function(){
  setup(function(){
    // ...
  });

  suite('#indexOf()', function(){
    test('should return -1 when not present', function(){
      assert.equal(-1, [1,2,3].indexOf(4));
    });

    test('should return the index when present', function(){
      assert.equal(2, [1,2,3].indexOf(3));
      assert.equal(1, [1,2,3].indexOf(2));
      assert.equal(0, [1,2,3].indexOf(1));
    });
  });
});
```

### Exports

```js
module.exports = {
  'Array': {
    '#indexOf()': {
      'should return -1 when not present': function(){
        [1,2,3].indexOf(4).should.equal(-1);
      },
      
      'should return the index when present': function(){
        [1,2,3].indexOf(3).should.equal(2);
        [1,2,3].indexOf(2).should.equal(1);
        [1,2,3].indexOf(1).should.equal(0);
      }
    }
  }
};
```

## Reporters

  Mocha reporters adjust to the terminal window,
  and always disable ansi-escape colouring when
  the stdio streams are not associated with a tty.

### Dot Matrix

  The Dot Matrix reporter is simply a series of dots
  that represent test cases, failures highlight in red.

   ![dot matrix reporter](http://f.cl.ly/items/3b3b471Z1p2U3D1P2Y1n/Screenshot.png)

   ![dot matrix failure](http://f.cl.ly/items/1P11330L033r423g1y1n/Screenshot.png)

## TAP

  The TAP reporter emits lines for a [Test-Anything-Protocol](http://en.wikipedia.org/wiki/Test_Anything_Protocol) consumer.

  ![test anything protocol](http://f.cl.ly/items/2O0X3h0d1Q430O1t1T3p/Screenshot.png)

## Landing Strip

  The Landing Strip reporter is a gimmicky test reporter simulating
{'fraction_non_alphanumeric': 0.13098282791377422, 'fraction_numerical': 0.028498355864084765, 'mean_word_length': 3.0139296187683287, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1133171', 'n_tokens_mistral': 1808, 'n_tokens_neox': 1699, 'n_words': 494}