rewiremock
Advanced tools
Comparing version 3.4.2 to 3.4.3
@@ -132,3 +132,3 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
if (mock.allowCallThrough || mock.matchOrigin) { | ||
if (mock.allowCallThrough || mock.matchOrigin || mock.mockThrough) { | ||
if (!mock.original) { | ||
@@ -135,0 +135,0 @@ mock.original = originalLoader(request, parent, isMain); |
@@ -49,2 +49,18 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
/** | ||
* Enable automatic dependency mocking | ||
* @name ModuleMock.mockThrough | ||
* @param {Function} [mockFactory=sinon.stub] - mock constructor | ||
* @return {ModuleMock} | ||
*/ | ||
}, { | ||
key: 'mockThrough', | ||
value: function mockThrough() { | ||
var mockFactory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; | ||
this.mock.mockThrough = mockFactory; | ||
return this; | ||
} | ||
/** | ||
* Setting es6 behavior for a current module | ||
@@ -51,0 +67,0 @@ * @return {ModuleMock} |
@@ -157,3 +157,3 @@ 'use strict'; | ||
if (mock.allowCallThrough || mock.matchOrigin) { | ||
if (mock.allowCallThrough || mock.matchOrigin || mock.mockThrough) { | ||
if (!mock.original) { | ||
@@ -160,0 +160,0 @@ mock.original = (0, _module.originalLoader)(request, parent, isMain); |
@@ -60,2 +60,18 @@ 'use strict'; | ||
/** | ||
* Enable automatic dependency mocking | ||
* @name ModuleMock.mockThrough | ||
* @param {Function} [mockFactory=sinon.stub] - mock constructor | ||
* @return {ModuleMock} | ||
*/ | ||
}, { | ||
key: 'mockThrough', | ||
value: function mockThrough() { | ||
var mockFactory = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; | ||
this.mock.mockThrough = mockFactory; | ||
return this; | ||
} | ||
/** | ||
* Setting es6 behavior for a current module | ||
@@ -62,0 +78,0 @@ * @return {ModuleMock} |
{ | ||
"name": "rewiremock", | ||
"version": "3.4.2", | ||
"description": "Easy and es6 compatible dependency mocking tool.", | ||
"version": "3.4.3", | ||
"description": "Advanced dependency mocking device.", | ||
"main": "lib/index.js", | ||
@@ -23,2 +23,10 @@ "jsnext:main": "es/index.js", | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/theKashey/rewiremock.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/theKashey/rewiremock/issues" | ||
}, | ||
"homepage": "https://github.com/theKashey/rewiremock#readme", | ||
"files": [ | ||
@@ -42,3 +50,4 @@ "lib", | ||
"mock", | ||
"stub" | ||
"mockery", | ||
"proxyquire" | ||
], | ||
@@ -45,0 +54,0 @@ "jest": { |
@@ -6,8 +6,8 @@ # rewiremock [![Build Status](https://secure.travis-ci.org/theKashey/rewiremock.svg)](http://travis-ci.org/theKashey/rewiremock) | ||
Simple es6-friendly mocking library inspired by the best libraries: | ||
- [mockery](https://github.com/mfncooper/mockery) - the library I like the most. | ||
- [mock-require](https://github.com/boblauer/mock-require) - the simplest thing ever. | ||
- [proxyquire](https://github.com/theKashey/proxyquire) - the one I know better than others. | ||
- [mockery](https://github.com/mfncooper/mockery) - the library I like the most. Rewiremock is a better mockery. | ||
- [proxyquire](https://github.com/theKashey/proxyquire) - the one with quite handy API. Rewiremock do it better. | ||
- [mock-require](https://github.com/boblauer/mock-require) - the simplest thing ever. Things must not be complex. | ||
By its nature rewiremock has same behavior as Mockery. But it can behave like others too. | ||
It covers _any_ cases. It is the right way to mock your dependencies or perform dependency injection. | ||
It covers _any_ case. It is the right way to mock your dependencies or perform dependency injection. | ||
@@ -71,3 +71,3 @@ | ||
#Usage | ||
# Usage | ||
```js | ||
@@ -74,0 +74,0 @@ // 1. proxy will load a file by it's own ( keep in mind - name resolution is a complex thing) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
143096
3089
0
0
12