Closed pacozaa closed 4 years ago
same error +1
i also have the same error
@pacozaa try by moving last slash outside the bracket- "jest": { "preset": "react-native", "verbose": true, "transformIgnorePatterns": [ "node_modules/(?!(react-native-aws3))/" ] }
may it help..
I ended up fixing this issue by cloning the repo and editing the files myself since this repository is no longer maintained (As evident by the 9 PR's). But if you still need a fix you can do the following.
Change
Request.FormData = FormData
Request.XMLHttpRequest = XMLHttpRequest
to
Request.FormData = require('FormData')
Request.XMLHttpRequest = require('XMLHttpRequest')
Then, you have to go into the Jest setup file in node_modules/react-native/jest
and change
BlobModule: {
BLOB_URI_SCHEME: 'content',
BLOB_URI_HOST: null,
enableBlobSupport: jest.fn(),
disableBlobSupport: jest.fn(),
createFromParts: jest.fn(),
sendBlob: jest.fn(),
release: jest.fn(),
}
to
BlobModule: {
BLOB_URI_SCHEME: 'content',
BLOB_URI_HOST: null,
enableBlobSupport: jest.fn(),
disableBlobSupport: jest.fn(),
createFromParts: jest.fn(),
sendBlob: jest.fn(),
release: jest.fn(),
}
This GitHub issue is what I used to fix the second half of the issue regarding the addNetworkingHandler is not a function
error
fixed by mock it.
Try this if you come across
jest.mock('react-native-aws3', () => ({
put: jest.fn(),
}));
I run
yarn test
and found this errorand also exclude package as follow
Any idea what's happening?
Best, Sarin