<commit_before>#mock-require

####Simple, intuitive mocking of Node.js modules.

[![Build Status](https://travis-ci.org/boblauer/mock-require.svg)](https://travis-ci.org/boblauer/mock-require)

##About

mock-require is useful if you want to mock `require` statements in Node.js.  I wrote it because I wanted something with a straight-forward API that would let me mock anything, from a single exported function to a standard library.

##Usage

```javascript
var mock = require('mock-require');

mock('http', { request: function() {
  console.log('http.request called');
}});

var http = require('http');
http.request(); // 'http.request called'
```
##API

```javascript
mock(path, mockedLib)
```

`path`: `String`

The module you that you want to mock.  This is the same string you would pass in if you wanted to `require` the module.

This path should be relative to the current file, just as it would be if you were `require`ing the module from the current file.  mock-require is smart enough to mock this module everywhere it is required, even if it's required from a different file using a different relative path.

`mockedLib` : `function`

The function you want to be returned from `require`, instead of the module's exported function.  This is useful if your module only exports a single function.

`mockedLib` : `object`

The object you wnat to be returned from `require`, instead of the module's exported object.  This is useful if your module exports a complex object, such as `require('fs')`.

`mockedLib` : `string`
<commit_msg>Better param name<commit_after>#mock-require

####Simple, intuitive mocking of Node.js modules.

[![Build Status](https://travis-ci.org/boblauer/mock-require.svg)](https://travis-ci.org/boblauer/mock-require)

##About

mock-require is useful if you want to mock `require` statements in Node.js.  I wrote it because I wanted something with a straight-forward API that would let me mock anything, from a single exported function to a standard library.

##Usage

```javascript
var mock = require('mock-require');

mock('http', { request: function() {
  console.log('http.request called');
}});

var http = require('http');
http.request(); // 'http.request called'
```
##API

```javascript
mock(path, mockExport)
```

`path`: `String`

The module you that you want to mock.  This is the same string you would pass in if you wanted to `require` the module.

This path should be relative to the current file, just as it would be if you were `require`ing the module from the current file.  mock-require is smart enough to mock this module everywhere it is required, even if it's required from a different file using a different relative path.

`mockExport` : `function`

The function you want to be returned from `require`, instead of the module's exported function.  This is useful if your module only exports a single function.

`mockExport` : `object`

The object you wnat to be returned from `require`, instead of the module's exported object.  This is useful if your module exports a complex object, such as `require('fs')`.

`mockExport` : `string`

{'fraction_non_alphanumeric': 0.10362694300518134, 'fraction_numerical': 0.0, 'mean_word_length': 4.545780969479353, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '6825584', 'n_tokens_mistral': 872, 'n_tokens_neox': 842, 'n_words': 408}