Skip to content
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

Is it possible to show Function name instead of {[Function]} ? #4235

Closed
sandrina-p opened this issue Aug 10, 2017 · 6 comments
Closed

Is it possible to show Function name instead of {[Function]} ? #4235

sandrina-p opened this issue Aug 10, 2017 · 6 comments

Comments

@sandrina-p
Copy link
Contributor

On React, I have a <Button> with a prop that passs another component:

import Button from 'components/react-button';
import { IconBag } from 'components/react-icons';

<Button theme="primary" Icon={ IconBag }>Add to Bag</Button>

And on the snapshot it shows this:

<Button Icon={[Function]} theme="primary">Add to Bag</Button>

If I change the Icon prop value to another component, the snapshots doesn't change, staying {[Function]}.

Is it possible to know the function name on the snapshot? Something like:

<Button Icon={[Function IconBag]} theme="primary">Add to Bag</Button>

I have jest 18.1.0 installed.

Thanks

@thymikee
Copy link
Collaborator

We disabled this in Jest 16 for various reasons: https://facebook.github.io/jest/blog/2016/10/03/jest-16.html#snapshot-updates

@cpojer cpojer closed this as completed Aug 10, 2017
@sandrina-p
Copy link
Contributor Author

Is it possible to somehow enable that in certain cases?

@thymikee
Copy link
Collaborator

No, it's not configurable now. You can always fork jest-snapshot and remove printFunctionName: false part.

@sandrina-p
Copy link
Contributor Author

Thanks, i'll take a look!
Do u guys have plans to have option for it?

@cpojer
Copy link
Member

cpojer commented Aug 10, 2017

Not at this point, if you are using code coverage then the name won't be able to be inferred properly.

@github-actions
Copy link

This issue 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 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants