-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
closes #13034 Fixes the ScrollViewMock methods #13048
Conversation
@@ -17,7 +17,9 @@ const requireNativeComponent = require('requireNativeComponent'); | |||
|
|||
const RCTScrollView = requireNativeComponent('RCTScrollView'); | |||
|
|||
class ScrollViewMock extends React.Component { | |||
const ScrollViewComponent = jest.genMockFromModule('ScrollView'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
identifier jest
Could not resolve name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would need some guidance to avoid this eslint
error @satya164.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add /* eslint-env jest */
to the top
Added lint rule to avoid unresolved identifier error
@@ -17,7 +18,9 @@ const requireNativeComponent = require('requireNativeComponent'); | |||
|
|||
const RCTScrollView = requireNativeComponent('RCTScrollView'); | |||
|
|||
class ScrollViewMock extends React.Component { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
identifier jest
Could not resolve name
@facebook-github-bot shipit |
@satya164 has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
Hey @satya164! Can I help you with something else with this PR? |
@alvaromb Seems this PR breaks tests. Could you please take a look? |
Hi @shergin! Sorry, I forgot about this PR. Please ping me if you need a hand with this. Thanks! |
@alvaromb I would love to see passed tests. 😄 |
@shergin has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator. |
I tried to merge this pull request into the Facebook internal repo but some checks failed. To unblock yourself please check the following: Does this pull request pass all open source tests on GitHub? If not please fix those. Does the code still apply cleanly on top of GitHub master? If not can please rebase. In all other cases this means some internal test failed, for example a part of a fb app won't work with this pull request. I've added the Import Failed label to this pull request so it is easy for someone at fb to find the pull request and check what failed. If you don't see anyone comment in a few days feel free to comment mentioning one of the core contributors to the project so they get a notification. |
Hi @shergin! This PR got merged? If not, what can I help you with to merge it? |
@alvaromb I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project. |
@alvaromb I got bitten by this issue an burned some time trying to track it down. a local change to how jest mocks out the looks like your PR fails in CI and it now has a merge conflict with master. CIi can't see the details for the failure in CircleCI ... but the build was from a few months ago so it may have been flushed. The details for the travis-ci build failure are still available: https://travis-ci.org/facebook/react-native/jobs/255491208#L3150 The failure is:
This occurs during the react-native/scripts/run-ci-e2e-tests.js Line 203 in 29d9c35
So the rub is, your source file to create the mock specifies the use of flow, but flow doesn't recognize the Two options (and I am not sure which is the react-native preference because there are examples of both in the source):
Merge ConflictLooks like master was updated to support a flow v0.53. I don't think that this impacts your PR, you just need to rebase. Let me know if you want to see this through or if you want to close out this PR and have me open up a replacement. |
Just merged against master, tests fails due to other issues though. |
¯_(ツ)_/¯ |
@alvaromb I tried to find reviewers for this pull request and wanted to ping them to take another look. However, based on the blame information for the files in this pull request I couldn't find any reviewers. This sometimes happens when the files in the pull request are new or don't exist on master anymore. Is this pull request still relevant? If yes could you please rebase? In case you know who has context on this code feel free to mention them in a comment (one person is fine). Thanks for reading and hope you will continue contributing to the project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shergin is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Summary: Solves facebook#13034 Now the `ScrollView` mock has all the methods available. React Native tests pass. To test this specific part of the code, ```sh $ react-native init Test $ cd Test/ $ yarn add react-navigation ``` Then, add a simple project that uses `react-navigation`: ```js import React from 'react'; import { Text } from 'react-native'; import { StackNavigator } from 'react-navigation'; class HomeScreen extends React.Component { static navigationOptions = { title: 'Welcome', }; render() { return <Text>Hello, Navigation!</Text>; } } const SimpleApp = StackNavigator({ Home: { screen: HomeScreen }, }); export default SimpleApp ``` Run the default render tests: ```js $ npm run test ``` Closes facebook#13048 Differential Revision: D4746028 Pulled By: shergin fbshipit-source-id: cb1791978d15be7f5d14b7b22979388066ad6caa
Summary: Solves facebook#13034 Now the `ScrollView` mock has all the methods available. React Native tests pass. To test this specific part of the code, ```sh $ react-native init Test $ cd Test/ $ yarn add react-navigation ``` Then, add a simple project that uses `react-navigation`: ```js import React from 'react'; import { Text } from 'react-native'; import { StackNavigator } from 'react-navigation'; class HomeScreen extends React.Component { static navigationOptions = { title: 'Welcome', }; render() { return <Text>Hello, Navigation!</Text>; } } const SimpleApp = StackNavigator({ Home: { screen: HomeScreen }, }); export default SimpleApp ``` Run the default render tests: ```js $ npm run test ``` Closes facebook#13048 Differential Revision: D4746028 Pulled By: shergin fbshipit-source-id: cb1791978d15be7f5d14b7b22979388066ad6caa
Motivation (required)
Solves #13034
Now the
ScrollView
mock has all the methods available.Test Plan (required)
React Native tests pass.
To test this specific part of the code,
$ react-native init Test $ cd Test/ $ yarn add react-navigation
Then, add a simple project that uses
react-navigation
:Run the default render tests: