-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
[0.54] BlobModule.addNetworkingHandler mock missing in jest setup #18279
Comments
This issue can be fixed by adding the addNetworkingHandler mock (in BlobModule) inside the jest setup file.
|
Hmm, the tests for 0.54-stable are green. Can you include more information about the failing test? Which suite was it that failed? Thanks! |
@FireNoid I think the change should be made in the jest setup file instead of the file The setup file is where we should mock the required modules. Change
to
|
You are right. It didn't work well! |
@hramos Here is the what the failure says Let me know if this helps. |
@n-kumari ah, good catch. We should update our test suite as well. Thanks for bringing this to our attention! |
For those wanting a copy paste bit of code, add this to the jest setup file:
|
@matt-oakes In what file should I paste it? I am getting this error and can't test my project |
@matt-oakes this is the path: node_modules/react-native/jest/setup.js |
@Alu1911 @gabrielvcbessa That would work, but I wouldn't recommend putting it there as you shouldn't edit files inside |
Summary: Fixes facebook#18279 by adding the correct methods to the jest mocks setup file. Test by no longer including the workarounds in [issue comments](facebook#18279 (comment)). A [comment from hramos](facebook#18279 (comment)) mentioned improving the test coverage as well, but I wasn't certain how to achieve that. [GENERAL] [BUGFIX] [BlobManager] - Fixed the jest mocks to avoid breaking tests Closes facebook#18718 Differential Revision: D7542458 Pulled By: hramos fbshipit-source-id: 77c9c7cae77971d62e878c4832b2e1d205131e8f
Summary: Fixes facebook#18279 by adding the correct methods to the jest mocks setup file. Test by no longer including the workarounds in [issue comments](facebook#18279 (comment)). A [comment from hramos](facebook#18279 (comment)) mentioned improving the test coverage as well, but I wasn't certain how to achieve that. [GENERAL] [BUGFIX] [BlobManager] - Fixed the jest mocks to avoid breaking tests Closes facebook#18718 Differential Revision: D7542458 Pulled By: hramos fbshipit-source-id: 77c9c7cae77971d62e878c4832b2e1d205131e8f
Summary: Fixes facebook#18279 by adding the correct methods to the jest mocks setup file. Test by no longer including the workarounds in [issue comments](facebook#18279 (comment)). A [comment from hramos](facebook#18279 (comment)) mentioned improving the test coverage as well, but I wasn't certain how to achieve that. [GENERAL] [BUGFIX] [BlobManager] - Fixed the jest mocks to avoid breaking tests Closes facebook#18718 Differential Revision: D7542458 Pulled By: hramos fbshipit-source-id: 77c9c7cae77971d62e878c4832b2e1d205131e8f
Will a fix for this land in RN soon? |
It landed in commit 43014ea already. That commit has not yet made it to a release, but it should as soon as the next RC is cut. |
Summary: Fixes facebook#18279 by adding the correct methods to the jest mocks setup file. Test by no longer including the workarounds in [issue comments](facebook#18279 (comment)). A [comment from hramos](facebook#18279 (comment)) mentioned improving the test coverage as well, but I wasn't certain how to achieve that. [GENERAL] [BUGFIX] [BlobManager] - Fixed the jest mocks to avoid breaking tests Closes facebook#18718 Differential Revision: D7542458 Pulled By: hramos fbshipit-source-id: 77c9c7cae77971d62e878c4832b2e1d205131e8f
Summary: Fixes facebook#18279 by adding the correct methods to the jest mocks setup file. Test by no longer including the workarounds in [issue comments](facebook#18279 (comment)). A [comment from hramos](facebook#18279 (comment)) mentioned improving the test coverage as well, but I wasn't certain how to achieve that. [GENERAL] [BUGFIX] [BlobManager] - Fixed the jest mocks to avoid breaking tests Closes facebook#18718 Differential Revision: D7542458 Pulled By: hramos fbshipit-source-id: 77c9c7cae77971d62e878c4832b2e1d205131e8f
@matt-oakes I'm trying to set this up in the jest config file as you suggested but I'm having trouble with it. Could you share an example of how you've set it up there? Thanks!! |
@n-kumari I am getting this even after trying your method. But package manager show : This is part of package.json Thanks in advance. |
Upgrading react native to 0.54.0 causes the jest tests to fail with an error
TypeError: BlobModule.addNetworkingHandler is not a function
Environment:
OS: macOS Sierra 10.12.6
Node: 8.9.1
Yarn: 1.3.2
npm: 5.6.0
Watchman: 4.7.0
Xcode: Xcode 9.0 Build version 9A235
Android Studio: Not Found
Packages: (wanted => installed)
react: ^16.3.0-alpha.1 => 16.3.0-alpha.1
react-native: 0.54.0 => 0.54.0
Expected Behavior
The tests should not break on upgrade
Actual Behavior
The test suite fails to run with an error
Steps to Reproduce
The text was updated successfully, but these errors were encountered: