fetch-mock
Advanced tools
Comparing version 8.0.0-alpha.10 to 8.0.0-alpha.11
@@ -17,2 +17,2 @@ const FetchMock = require('./lib/index'); | ||
module.exports = FetchMock.createInstance(true); | ||
module.exports = FetchMock.createInstance(); |
@@ -15,3 +15,3 @@ const setUpAndTearDown = require('./set-up-and-tear-down'); | ||
FetchMock.createInstance = function(isLibrary) { | ||
FetchMock.createInstance = function() { | ||
const instance = Object.create(FetchMock); | ||
@@ -27,9 +27,2 @@ instance._uncompiledRoutes = (this._uncompiledRoutes || []).slice(); | ||
instance.bindMethods(); | ||
if (isLibrary) { | ||
Object.assign(instance, { | ||
MATCHED: true, | ||
UNMATCHED: false, | ||
fetchMock: instance | ||
}); | ||
} | ||
return instance; | ||
@@ -36,0 +29,0 @@ }; |
@@ -17,5 +17,5 @@ const { normalizeUrl } = require('./request-utils'); | ||
if (nameOrMatcher === true) { | ||
if ([true, 'matched'].includes(nameOrMatcher)) { | ||
calls = calls.filter(({ isUnmatched }) => !isUnmatched); | ||
} else if (nameOrMatcher === false) { | ||
} else if ([false, 'unmatched'].includes(nameOrMatcher)) { | ||
calls = calls.filter(({ isUnmatched }) => isUnmatched); | ||
@@ -22,0 +22,0 @@ } else if (typeof nameOrMatcher === 'undefined') { |
@@ -22,2 +22,2 @@ const fetch = require('node-fetch'); | ||
module.exports = FetchMock.createInstance(true); | ||
module.exports = FetchMock.createInstance(); |
@@ -28,2 +28,2 @@ 'use strict'; | ||
module.exports = FetchMock.createInstance(true); | ||
module.exports = FetchMock.createInstance(); |
@@ -27,3 +27,3 @@ 'use strict'; | ||
FetchMock.createInstance = function (isLibrary) { | ||
FetchMock.createInstance = function () { | ||
var instance = (0, _create2.default)(FetchMock); | ||
@@ -39,9 +39,2 @@ instance._uncompiledRoutes = (this._uncompiledRoutes || []).slice(); | ||
instance.bindMethods(); | ||
if (isLibrary) { | ||
(0, _assign2.default)(instance, { | ||
MATCHED: true, | ||
UNMATCHED: false, | ||
fetchMock: instance | ||
}); | ||
} | ||
return instance; | ||
@@ -48,0 +41,0 @@ }; |
@@ -52,3 +52,3 @@ 'use strict'; | ||
if (nameOrMatcher === true) { | ||
if ([true, 'matched'].includes(nameOrMatcher)) { | ||
calls = calls.filter(function (_ref3) { | ||
@@ -58,3 +58,3 @@ var isUnmatched = _ref3.isUnmatched; | ||
}); | ||
} else if (nameOrMatcher === false) { | ||
} else if ([false, 'unmatched'].includes(nameOrMatcher)) { | ||
calls = calls.filter(function (_ref4) { | ||
@@ -61,0 +61,0 @@ var isUnmatched = _ref4.isUnmatched; |
@@ -37,2 +37,2 @@ 'use strict'; | ||
module.exports = FetchMock.createInstance(true); | ||
module.exports = FetchMock.createInstance(); |
{ | ||
"name": "fetch-mock", | ||
"type": "module", | ||
"version": "8.0.0-alpha.10", | ||
"version": "8.0.0-alpha.11", | ||
"description": "Mock http requests made using fetch (or isomorphic-fetch)", | ||
@@ -6,0 +6,0 @@ "main": "./cjs/server.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2610262
74487