-
Notifications
You must be signed in to change notification settings - Fork 172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.getMock()
returns undefined
#68
Comments
Could you post a code sample and details of which browser please |
require('isomorphic-fetch')
var mock = require('fetch-mock')
console.log(mock.getMock()) // undefined
mock.mock('lol/', 'ok')
console.log(mock.getMock()) // undefined tried in chrome and phantomjs |
thanks, I'll investigate over the weekend |
I see, you're using the API incorrectly
What are you trying to use getMock for? |
Very sorry! The code I presented here was just made up to try and reproduce in as few lines as possible, but it turns out that what I want to do actually does work, so I can close this. const fetchMock = require('fetch-mock')
fetchMock.useNonGlobalFetch(require('isomorphic-fetch'))
fetchMock.mock('lol/', 'ok')
const mock = fetchMock.getMock() // works |
Using browserify + fetch-mock, attempts to get a reference to the mock via
.getMock()
always seems to returnundefined
.A glance at the code indicates that
getMock
just returnsthis.fetch
which doesn't seem to be set anywhere.The text was updated successfully, but these errors were encountered: