fetch-mock
Advanced tools
Comparing version 8.2.0-beta.1 to 8.2.0-beta.2
// avoid circular dependency when using jest.mock() | ||
const fetch = global.jest | ||
? global.jest.requireActual('node-fetch') | ||
: require('node-fetch'); | ||
let fetch; | ||
try { | ||
// note that jest is not a global, but is injected somehow into | ||
// the environment. So we can't be safe and check for global.jest | ||
// Hence the try/catch | ||
fetch = jest.requireActual('node-fetch'); //eslint-disable-line no-undef | ||
} catch (e) { | ||
fetch = require('node-fetch'); | ||
} | ||
const Request = fetch.Request; | ||
@@ -6,0 +12,0 @@ const Response = fetch.Response; |
@@ -14,3 +14,11 @@ 'use strict'; | ||
// avoid circular dependency when using jest.mock() | ||
var fetch = global.jest ? global.jest.requireActual('node-fetch') : require('node-fetch'); | ||
var fetch = void 0; | ||
try { | ||
// note that jest is not a global, but is injected somehow into | ||
// the environment. So we can't be safe and check for global.jest | ||
// Hence the try/catch | ||
fetch = jest.requireActual('node-fetch'); //eslint-disable-line no-undef | ||
} catch (e) { | ||
fetch = require('node-fetch'); | ||
} | ||
var Request = fetch.Request; | ||
@@ -17,0 +25,0 @@ var Response = fetch.Response; |
{ | ||
"name": "fetch-mock", | ||
"type": "module", | ||
"version": "8.2.0-beta.1", | ||
"version": "8.2.0-beta.2", | ||
"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 not supported yet
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
2614538
74617