<commit_before># karma-bro

A fast [browserify](http://browserify.org) integration for [Karma](https://karma-runner.github.io) that can easily handle large browserify projects.


## Usage

Install the plug-in via [npm](https://www.npmjs.org/):

```
npm install --save-dev karma-bro
```

Add `browserify` to your Karma configuration as a framework and configure it via the configs `preprocessors` entry to bundle all CommonJS via browserify before executing the tests. Optionally use the `browserify` config entry to configure how the bundle gets created.


```javascript
module.exports = function(karma) {
  karma.set({

    frameworks: [ 'browserify' ],

    preprocessors: {
      'test/**/*.js': [ 'browserify' ]
    },

    browserify: {
      debug: true,
      transform: [ 'brfs' ]
    }
 });
}
```


#### Long Version


```javascript
module.exports = function(karma) {
  karma.set({

    // include browserify first in used frameworks
    frameworks: [ 'browserify', 'jasmine' ],

    // add all your files here
    files: [
      'test/**/*.js'
    ],

    // add preprocessor to the files that should be
    // processed via browserify
    preprocessors: {
      'test/**/*.js': [ 'browserify' ]
    },

    // see what is going on
    logLevel: 'LOG_DEBUG',

    // use autoWatch=true for quick and easy test re-execution once files change
    autoWatch: true,

    // add additional browserify configurations here such as transforms
    browserify: {
      debug: true,
      transform: [ 'brfs' ]
    }
  });
};
```


## License

MIT<commit_msg>docs(README): add related projects + supported browserify options<commit_after># karma-bro

A fast [browserify](http://browserify.org) integration for [Karma](https://karma-runner.github.io) that can easily handle large browserify projects.


## Installation

Get the plug-in via [npm](https://www.npmjs.org/):

```
npm install --save-dev karma-bro
```


## Usage

Add `browserify` as the first framework used in your Karma configuration file. For each file that should be processed and bundled by karma, configure the `browserify` preprocessor. Optionally use the `browserify` config entry to configure how the bundle gets created.


```javascript
module.exports = function(karma) {
  karma.set({

    frameworks: [ 'browserify', 'any', 'other', 'framework' ],

    preprocessors: {
      'test/**/*.js': [ 'browserify' ]
    },

    browserify: {
      debug: true,
      transform: [ 'brfs' ]
    }
  });
}
```

Look at the [example directory](https://github.com/Nikku/karma-bro/tree/master/example) for a simple `browserify` + `jasmine` project that uses `karma-bro`.


#### Supported Browserify Options

The following [browserify configuration options](https://github.com/substack/node-browserify#var-b--browserifyfiles-or-opts) are supported through the `browserify: {}` block to tune the way file bundles are created:

*   extensions
*   builtins
*   basedir
*   commondir
*   resolve
*   transform

In addition, specify `debug: true` in the options to generate source maps.


## Detailed Configuration

The following code snippet shows a Karma configuration file with all `karma-bro` related options.

```javascript
module.exports = function(karma) {
  karma.set({

    // include browserify first in used frameworks
    frameworks: [ 'browserify', 'jasmine' ],

    // add all your files here
    files: [
      'test/**/*.js'
    ],

    // add preprocessor to the files that should be
    // processed via browserify
    preprocessors: {
      'test/**/*.js': [ 'browserify' ]
    },

    // see what is going on
    logLevel: 'LOG_DEBUG',

    // use autoWatch=true for quick and easy test re-execution once files change
    autoWatch: true,

    // add additional browserify configurations here such as transforms
    // and/or debug=true to generate source maps
    browserify: {
      debug: true,
      transform: [ 'brfs' ]
    }
  });
};
```


## Related Projects

Thanks goes to to [karma-browserify](https://github.com/xdissent/karma-browserify) and [karma-browserifast](https://github.com/cjohansen/karma-browserifast). Both influenced this project by providing prior integrations of [browserify](http://browserify.org) into [Karma](https://karma-runner.github.io).


#### Differences

There exist a number of noteworthy differences between `karma-bro` and the above mentioned projects:

* It builds __only one browserify bundle__ and keeps that bundle updated incrementally once changes occur
* It makes sure that individual tests are __only executed once__ per test run
* For change detection during `autoWatch=true` it relies solely on [watchify](https://github.com/substack/watchify)
* It provides a clean(er) syntax for configuring browserify


## License

MIT
{'fraction_non_alphanumeric': 0.11825463743676222, 'fraction_numerical': 0.0, 'mean_word_length': 3.409851301115242, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 10, 'lorem ipsum': 0, 'www.': 2, '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': '3154521', 'n_tokens_mistral': 1431, 'n_tokens_neox': 1348, 'n_words': 465}