Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Fix MockNativeMethods access in react-native
  • Loading branch information
timwangdev authored Jun 20, 2018
commit 02361c753f4e08b5c7a667027b1dfe90db0fdb07
2 changes: 1 addition & 1 deletion packages/babel-plugin-jest-hoist/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ FUNCTIONS.mock = args => {
if (!found) {
invariant(
(scope.hasGlobal(name) && WHITELISTED_IDENTIFIERS[name]) ||
/^mock/.test(name) ||
/^[Mm]ock/.test(name) ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/^mock/i? MOCK_THING should be fine as well, IMO.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should also update the message on line 126

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

// Allow istanbul's coverage variable to pass.
/^(?:__)?cov/.test(name),
'The module factory of `jest.mock()` is not allowed to ' +
Expand Down