-
Notifications
You must be signed in to change notification settings - Fork 25k
RN: Refactor Jest Default Mocks #51669
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
Conversation
|
This pull request was exported from Phabricator. Differential Revision: D75575421 |
Summary: Refactors the default mocks initialized in `packages/react-native/jest/setup.js` so that each mock is defined in its own file. This provides several benefits, including: - The ability to use `import` statements without worrying about eager initialization of dependencies before `globals` is setup. - The ability to verify mocks export the same types as the actual module, using a new Flow-typed `mock` helper function. - The ergonomic of implementing mocks with more complex logic, without having to split them out into a separate module (e.g. `mockModal`, `mockScrollView`). As part of this migration, I also fixed any minor discrepancies to match the actual type definition. For more involved discrepancies (e.g. missing methods), I added type suppressions for now to minimize breaking changes. Changelog: [General][Changed] - Improved default mocking for Jest unit tests. Differential Revision: D75575421
0c7c882 to
665bc30
Compare
|
This pull request was exported from Phabricator. Differential Revision: D75575421 |
665bc30 to
781e768
Compare
Summary: Refactors the default mocks initialized in `packages/react-native/jest/setup.js` so that each mock is defined in its own file. This provides several benefits, including: - The ability to use `import` statements without worrying about eager initialization of dependencies before `globals` is setup. - The ability to verify mocks export the same types as the actual module, using a new Flow-typed `mock` helper function. - The ergonomic of implementing mocks with more complex logic, without having to split them out into a separate module (e.g. `mockModal`, `mockScrollView`). As part of this migration, I also fixed any minor discrepancies to match the actual type definition. For more involved discrepancies (e.g. missing methods), I added type suppressions for now to minimize breaking changes. Changelog: [General][Changed] - Improved default mocking for Jest unit tests. Differential Revision: D75575421
|
This pull request was exported from Phabricator. Differential Revision: D75575421 |
Summary: Refactors the default mocks initialized in `packages/react-native/jest/setup.js` so that each mock is defined in its own file. This provides several benefits, including: - The ability to use `import` statements without worrying about eager initialization of dependencies before `globals` is setup. - The ability to verify mocks export the same types as the actual module, using a new Flow-typed `mock` helper function. - The ergonomic of implementing mocks with more complex logic, without having to split them out into a separate module (e.g. `mockModal`, `mockScrollView`). As part of this migration, I also fixed any minor discrepancies to match the actual type definition. For more involved discrepancies (e.g. missing methods), I added type suppressions for now to minimize breaking changes. Changelog: [General][Changed] - Improved default mocking for Jest unit tests. Differential Revision: D75575421
781e768 to
f410098
Compare
|
This pull request was exported from Phabricator. Differential Revision: D75575421 |
f410098 to
b964f59
Compare
Summary: Refactors the default mocks initialized in `packages/react-native/jest/setup.js` so that each mock is defined in its own file. This provides several benefits, including: - The ability to use `import` statements without worrying about eager initialization of dependencies before `globals` is setup. - The ability to verify mocks export the same types as the actual module, using a new Flow-typed `mock` helper function. - The ergonomic of implementing mocks with more complex logic, without having to split them out into a separate module (e.g. `mockModal`, `mockScrollView`). As part of this migration, I also fixed any minor discrepancies to match the actual type definition. For more involved discrepancies (e.g. missing methods), I added type suppressions for now to minimize breaking changes. Changelog: [General][Changed] - Improved default mocking for Jest unit tests. Differential Revision: D75575421
|
This pull request was exported from Phabricator. Differential Revision: D75575421 |
b964f59 to
f5dbbf0
Compare
Summary: Refactors the default mocks initialized in `packages/react-native/jest/setup.js` so that each mock is defined in its own file. This provides several benefits, including: - The ability to use `import` statements without worrying about eager initialization of dependencies before `globals` is setup. - The ability to verify mocks export the same types as the actual module, using a new Flow-typed `mock` helper function. - The ergonomic of implementing mocks with more complex logic, without having to split them out into a separate module (e.g. `mockModal`, `mockScrollView`). As part of this migration, I also fixed any minor discrepancies to match the actual type definition. For more involved discrepancies (e.g. missing methods), I added type suppressions for now to minimize breaking changes. Changelog: [General][Changed] - Improved default mocking for Jest unit tests. Differential Revision: D75575421
f5dbbf0 to
2b159ed
Compare
Summary: Refactors the default mocks initialized in `packages/react-native/jest/setup.js` so that each mock is defined in its own file. This provides several benefits, including: - The ability to use `import` statements without worrying about eager initialization of dependencies before `globals` is setup. - The ability to verify mocks export the same types as the actual module, using a new Flow-typed `mock` helper function. - The ergonomic of implementing mocks with more complex logic, without having to split them out into a separate module (e.g. `mockModal`, `mockScrollView`). As part of this migration, I also fixed any minor discrepancies to match the actual type definition. For more involved discrepancies (e.g. missing methods), I added type suppressions for now to minimize breaking changes. Changelog: [General][Changed] - Improved default mocking for Jest unit tests. Differential Revision: D75575421
|
This pull request was exported from Phabricator. Differential Revision: D75575421 |
Summary: Pull Request resolved: facebook#51669 Refactors the default mocks initialized in `packages/react-native/jest/setup.js` so that each mock is defined in its own file. This provides several benefits, including: - The ability to use `import` statements without worrying about eager initialization of dependencies before `globals` is setup. - The ability to verify mocks export the same types as the actual module, using a new Flow-typed `mock` helper function. - The ergonomic of implementing mocks with more complex logic, without having to split them out into a separate module (e.g. `mockModal`, `mockScrollView`). As part of this migration, I also fixed any minor discrepancies to match the actual type definition. For more involved discrepancies (e.g. missing methods), I added type suppressions for now to minimize breaking changes. Changelog: [General][Changed] - Improved default mocking for Jest unit tests. Differential Revision: D75575421
Summary: Pull Request resolved: facebook#51669 Refactors the default mocks initialized in `packages/react-native/jest/setup.js` so that each mock is defined in its own file. This provides several benefits, including: - The ability to use `import` statements without worrying about eager initialization of dependencies before `globals` is setup. - The ability to verify mocks export the same types as the actual module, using a new Flow-typed `mock` helper function. - The ergonomic of implementing mocks with more complex logic, without having to split them out into a separate module (e.g. `mockModal`, `mockScrollView`). As part of this migration, I also fixed any minor discrepancies to match the actual type definition. For more involved discrepancies (e.g. missing methods), I added type suppressions for now to minimize breaking changes. Changelog: [General][Changed] - Improved default mocking for Jest unit tests. Differential Revision: D75575421
|
This pull request was exported from Phabricator. Differential Revision: D75575421 |
2b159ed to
31e8ea8
Compare
|
This pull request has been merged in 1fd9508. |
|
This pull request was successfully merged by @yungsters in 1fd9508 When will my fix make it into a release? | How to file a pick request? |
Summary:
Refactors the default mocks initialized in
packages/react-native/jest/setup.jsso that each mock is defined in its own file.This provides several benefits, including:
importstatements without worrying about eager initialization of dependencies beforeglobalsis setup.mockhelper function.mockModal,mockScrollView).As part of this migration, I also fixed any minor discrepancies to match the actual type definition. For more involved discrepancies (e.g. missing methods), I added type suppressions for now to minimize breaking changes.
Changelog:
[General][Changed] - Improved default mocking for Jest unit tests.
Differential Revision: D75575421