unexpected-require
Version:
Easily mock out required modules using Unexpected and mock-require
25 lines (20 loc) • 1.04 kB
Markdown
template: default.ejs
theme: dark
title: Unexpected-require
repository: https://github.com/unexpectedjs/unexpected-require
Easily mock out `require`d modules using [Unexpected](http://unexpected.js.org)
and [mock-require](https://github.com/boblauer/mock-require).
**NOTE:** This only works with modules that are required at run time!
[](http://badge.fury.io/js/unexpected-require)
[](https://travis-ci.org/unexpectedjs/unexpected-require)
[](https://coveralls.io/r/unexpectedjs/unexpected-require)
[](https://david-dm.org/unexpectedjs/unexpected-require)
```js#evaluate:false
expect(function () {
require('./some-module');
}, 'with require mocked out', {
'./some-module': {}
}, 'not to throw');
```