rewiremock
Advanced tools
Comparing version 3.13.6 to 3.13.7
@@ -10,5 +10,9 @@ import path from 'path'; | ||
if (!moduleName) { | ||
throw new Error('Rewiremock: while you using Jest - disable automocking'); | ||
throw new Error('Rewiremock: there is no "module name". If you are using Jest - disable automocking.'); | ||
} | ||
if (!getModuleParent(module)) { | ||
throw new Error('Rewiremock: there is no "parent module". Is there two HotModuleReplacementPlugins?'); | ||
} | ||
delete require.cache[path.join(path.dirname(__filename), './mockModule.js')]; | ||
@@ -15,0 +19,0 @@ delete require.cache[moduleName.replace('index.js', 'mockModule.js')]; |
@@ -74,3 +74,3 @@ import { dirname, resolve } from 'path'; | ||
export var getModuleName = function getModuleName(module) { | ||
return module.filename || module.i; | ||
return String(module.filename || module.i); | ||
}; | ||
@@ -77,0 +77,0 @@ export var getModuleParent = function getModuleParent(module) { |
@@ -38,5 +38,9 @@ 'use strict'; | ||
if (!moduleName) { | ||
throw new Error('Rewiremock: while you using Jest - disable automocking'); | ||
throw new Error('Rewiremock: there is no "module name". If you are using Jest - disable automocking.'); | ||
} | ||
if (!(0, _module.getModuleParent)(module)) { | ||
throw new Error('Rewiremock: there is no "parent module". Is there two HotModuleReplacementPlugins?'); | ||
} | ||
delete require.cache[_path2.default.join(_path2.default.dirname(__filename), './mockModule.js')]; | ||
@@ -43,0 +47,0 @@ delete require.cache[moduleName.replace('index.js', 'mockModule.js')]; |
@@ -99,3 +99,3 @@ 'use strict'; | ||
var getModuleName = exports.getModuleName = function getModuleName(module) { | ||
return module.filename || module.i; | ||
return String(module.filename || module.i); | ||
}; | ||
@@ -102,0 +102,0 @@ var getModuleParent = exports.getModuleParent = function getModuleParent(module) { |
@@ -10,2 +10,2 @@ global['_REWIREMOCK_HOISTED_'] = global['_REWIREMOCK_HOISTED_'] || []; | ||
module.exports = Object.assign({}, mock, mock.default); | ||
module.exports = Object.assign(mock.default, mock); |
{ | ||
"name": "rewiremock", | ||
"version": "3.13.6", | ||
"version": "3.13.7", | ||
"description": "Advanced dependency mocking device.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -454,4 +454,5 @@ ```text | ||
But not so fast, hanny. First you have to have 3(!) Plugins enabled. | ||
1. webpack.NamedModulesPlugin(). To enlight the real names of modules. Not "numbers". | ||
2. webpack.HotModuleReplacementPlugin(). To provide some information about connections between modules. | ||
1. webpack.NamedModulesPlugin(). To enlight the real names of modules, not "numbers". __Enabled by default__ in webpack "dev" mode | ||
2. webpack.HotModuleReplacementPlugin(). To provide some information about connections between modules. | ||
Might be (and usually) __already enabled__, double activation of this plugin might broke everything. | ||
3. rewiremock.webpackPlugin. To add some magic and make gears rolling. | ||
@@ -458,0 +459,0 @@ |
@@ -10,2 +10,2 @@ global['_REWIREMOCK_HOISTED_'] = global['_REWIREMOCK_HOISTED_'] || []; | ||
module.exports = Object.assign({}, mock, mock.default); | ||
module.exports = Object.assign(mock.default, mock); |
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
191761
4089
845