Skip to content

Fix automock for numeric function names#7653

Merged
SimenB merged 3 commits into
jestjs:masterfrom
jeysal:automock-numeric-function-name
Jan 19, 2019
Merged

Fix automock for numeric function names#7653
SimenB merged 3 commits into
jestjs:masterfrom
jeysal:automock-numeric-function-name

Conversation

@jeysal

@jeysal jeysal commented Jan 19, 2019

Copy link
Copy Markdown
Collaborator

Summary

Fixes #7624

Test plan

Added one assertion for the name itself and
added one test case that should closely resembles #7624

@SimenB SimenB left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks! I was unaware we already had logic for this, turned out really clean

expect(
getMockFnWithOriginalName('foo𠮷bar').name === 'foo𠮷bar',
).toBeTruthy();
expect(getMockFnWithOriginalName('1').name).toBe('$1');

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

good call

Comment thread packages/jest-mock/src/index.js Outdated
SimenB and others added 2 commits January 19, 2019 16:33
Co-Authored-By: jeysal <seckinger.tim@gmail.com>
@SimenB SimenB merged commit fd290a0 into jestjs:master Jan 19, 2019
thymikee added a commit to thymikee/jest that referenced this pull request Jan 20, 2019
…m-runtime

* upstream/master:
  add missing truncate comment to recent blog posts (jestjs#7655)
  use raw serializer for e2e output snapshots (jestjs#7651)
  chore: use a Set for reserved words list in `jest-mock`
  Fix automock for numeric function names (jestjs#7653)
  Update docs re: `moduleFileExtensions` to add ordering note (left-to-right) (jestjs#7616)
captain-yossarian pushed a commit to captain-yossarian/jest that referenced this pull request Jul 18, 2019
@github-actions

Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

jest.mock module auto-mock error when Function names are numeric

3 participants