rewiremock
Advanced tools
Comparing version 3.4.0 to 3.4.1
@@ -71,2 +71,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 (matchResult) { | ||
// eslint-disable-next-line no-console | ||
matchResult.forEach(function (line) { | ||
@@ -73,0 +74,0 @@ return console.error(line); |
@@ -213,6 +213,6 @@ var _this = this; | ||
Promise.resolve(createCallback && createCallback(mockModule)).then(function () { | ||
return Module.probeAsyncModules(); | ||
}).then(function () { | ||
return mockModule.enable(); | ||
}).then(function () { | ||
return Module.probeAsyncModules(); | ||
}).then(function () { | ||
return Promise.resolve(loader()).then(function (mockedResult) { | ||
@@ -219,0 +219,0 @@ restore(); |
import createPlugin, { YES, PASS, NO } from './_common'; | ||
import { inParents } from '../module'; | ||
import { extensions } from "../_common"; | ||
@@ -8,5 +9,7 @@ var trimKey = function trimKey(key) { | ||
var relativeWipeCheck = function relativeWipeCheck(stubs, moduleName) { | ||
export var relativeWipeCheck = function relativeWipeCheck(stubs, moduleName) { | ||
if (Object.keys(stubs).find(function (key) { | ||
return moduleName.indexOf(trimKey(key)) >= 0; | ||
return extensions.find(function (ext) { | ||
return moduleName.endsWith(trimKey(key + ext)); | ||
}); | ||
})) { | ||
@@ -20,5 +23,3 @@ return YES; | ||
}; | ||
var wipeCheck = function wipeCheck(stubs, moduleName) { | ||
return relativeWipeCheck(stubs, moduleName); | ||
}; | ||
//const wipeCheck = (stubs, moduleName) => relativeWipeCheck(stubs, moduleName); | ||
@@ -31,3 +32,3 @@ var shouldMock = function shouldMock(mock, request, parent, topModule) { | ||
fileNameTransformer: fileNameTransformer, | ||
wipeCheck: wipeCheck, | ||
//wipeCheck, | ||
shouldMock: shouldMock, | ||
@@ -34,0 +35,0 @@ |
import { getAllMocks } from './mocks'; | ||
import { shouldWipe } from './plugins'; | ||
import { relativeWipeCheck } from "./plugins/relative"; | ||
@@ -16,3 +17,3 @@ // which one? | ||
} | ||
return shouldWipe(stubs, moduleName); | ||
return shouldWipe(stubs, moduleName) || primaryResolver(stubs, moduleName) || relativeWipeCheck(stubs, moduleName); | ||
}; | ||
@@ -19,0 +20,0 @@ |
@@ -96,2 +96,3 @@ 'use strict'; | ||
if (matchResult) { | ||
// eslint-disable-next-line no-console | ||
matchResult.forEach(function (line) { | ||
@@ -98,0 +99,0 @@ return console.error(line); |
@@ -234,6 +234,6 @@ 'use strict'; | ||
Promise.resolve(createCallback && createCallback(mockModule)).then(function () { | ||
return _module2.default.probeAsyncModules(); | ||
}).then(function () { | ||
return mockModule.enable(); | ||
}).then(function () { | ||
return _module2.default.probeAsyncModules(); | ||
}).then(function () { | ||
return Promise.resolve(loader()).then(function (mockedResult) { | ||
@@ -240,0 +240,0 @@ restore(); |
@@ -6,2 +6,3 @@ 'use strict'; | ||
}); | ||
exports.relativeWipeCheck = undefined; | ||
@@ -14,2 +15,4 @@ var _common = require('./_common'); | ||
var _common3 = require('../_common'); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -21,5 +24,7 @@ | ||
var relativeWipeCheck = function relativeWipeCheck(stubs, moduleName) { | ||
var relativeWipeCheck = exports.relativeWipeCheck = function relativeWipeCheck(stubs, moduleName) { | ||
if (Object.keys(stubs).find(function (key) { | ||
return moduleName.indexOf(trimKey(key)) >= 0; | ||
return _common3.extensions.find(function (ext) { | ||
return moduleName.endsWith(trimKey(key + ext)); | ||
}); | ||
})) { | ||
@@ -33,5 +38,3 @@ return _common.YES; | ||
}; | ||
var wipeCheck = function wipeCheck(stubs, moduleName) { | ||
return relativeWipeCheck(stubs, moduleName); | ||
}; | ||
//const wipeCheck = (stubs, moduleName) => relativeWipeCheck(stubs, moduleName); | ||
@@ -44,3 +47,3 @@ var shouldMock = function shouldMock(mock, request, parent, topModule) { | ||
fileNameTransformer: fileNameTransformer, | ||
wipeCheck: wipeCheck, | ||
//wipeCheck, | ||
shouldMock: shouldMock, | ||
@@ -47,0 +50,0 @@ |
@@ -12,2 +12,4 @@ 'use strict'; | ||
var _relative = require('./plugins/relative'); | ||
// which one? | ||
@@ -25,3 +27,3 @@ var wipe = exports.wipe = module.hot ? require('wipe-webpack-cache') : require('wipe-node-cache'); | ||
} | ||
return (0, _plugins.shouldWipe)(stubs, moduleName); | ||
return (0, _plugins.shouldWipe)(stubs, moduleName) || primaryResolver(stubs, moduleName) || (0, _relative.relativeWipeCheck)(stubs, moduleName); | ||
}; | ||
@@ -28,0 +30,0 @@ |
{ | ||
"name": "rewiremock", | ||
"version": "3.4.0", | ||
"version": "3.4.1", | ||
"description": "Easy and es6 compatible dependency mocking tool.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
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
140736
3059