{"action":"created","issue":{"url":"https://api.github.com/repos/airbnb/enzyme/issues/262","repository_url":"https://api.github.com/repos/airbnb/enzyme","labels_url":"https://api.github.com/repos/airbnb/enzyme/issues/262/labels{/name}","comments_url":"https://api.github.com/repos/airbnb/enzyme/issues/262/comments","events_url":"https://api.github.com/repos/airbnb/enzyme/issues/262/events","html_url":"https://github.com/airbnb/enzyme/issues/262","id":141053261,"number":262,"title":"wrapper.find() cannot retrieve stateless components","user":{"login":"mdotasia","id":1482402,"avatar_url":"https://avatars.githubusercontent.com/u/1482402?v=3","gravatar_id":"","url":"https://api.github.com/users/mdotasia","html_url":"https://github.com/mdotasia","followers_url":"https://api.github.com/users/mdotasia/followers","following_url":"https://api.github.com/users/mdotasia/following{/other_user}","gists_url":"https://api.github.com/users/mdotasia/gists{/gist_id}","starred_url":"https://api.github.com/users/mdotasia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdotasia/subscriptions","organizations_url":"https://api.github.com/users/mdotasia/orgs","repos_url":"https://api.github.com/users/mdotasia/repos","events_url":"https://api.github.com/users/mdotasia/events{/privacy}","received_events_url":"https://api.github.com/users/mdotasia/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/airbnb/enzyme/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-15T18:01:45Z","updated_at":"2016-03-16T16:45:15Z","closed_at":null,"body":"I'm trying to find rendered stateless components in a wrapper using `name`/`displayName` as selector (when using `mount`). For normal components `find` always returns selected components as expected, but for stateless components it returns nothing, even though they are there.\r\n\r\nIn [`findAllInRenderedTreeInternal`](https://github.com/airbnb/enzyme/blob/7efeda383c3c914f038ec0005ca493ed591b9d47/src/MountedTraversal.js#L236-L289) at [line 249](https://github.com/airbnb/enzyme/blob/7efeda383c3c914f038ec0005ca493ed591b9d47/src/MountedTraversal.js#L249) there is this a call\r\n\r\n```\r\nvar publicInst = inst.getPublicInstance();\r\n```\r\n\r\nwhich calls `getPublicInstance` of `ReactCompositeComponent.js`:\r\n\r\n```\r\n  getPublicInstance: function () {\r\n    var inst = this._instance;\r\n    if (inst instanceof StatelessComponent) {\r\n      return null;\r\n    }\r\n    return inst;\r\n  },\r\n```\r\n\r\nObviously, `find` will fail for stateless components since `getPublicInstance` always returns `null`. I'm wondering why in line 249 further up it is necessary to call `getPublicInstance` since there should be other ways to retrieve the element for testing.\r\n\r\nI'm fairly new to `React` and `enzyme` so I am not sure if I am missing something."},"comment":{"url":"https://api.github.com/repos/airbnb/enzyme/issues/comments/197417752","html_url":"https://github.com/airbnb/enzyme/issues/262#issuecomment-197417752","issue_url":"https://api.github.com/repos/airbnb/enzyme/issues/262","id":197417752,"user":{"login":"AugustinLF","id":5271169,"avatar_url":"https://avatars.githubusercontent.com/u/5271169?v=3","gravatar_id":"","url":"https://api.github.com/users/AugustinLF","html_url":"https://github.com/AugustinLF","followers_url":"https://api.github.com/users/AugustinLF/followers","following_url":"https://api.github.com/users/AugustinLF/following{/other_user}","gists_url":"https://api.github.com/users/AugustinLF/gists{/gist_id}","starred_url":"https://api.github.com/users/AugustinLF/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AugustinLF/subscriptions","organizations_url":"https://api.github.com/users/AugustinLF/orgs","repos_url":"https://api.github.com/users/AugustinLF/repos","events_url":"https://api.github.com/users/AugustinLF/events{/privacy}","received_events_url":"https://api.github.com/users/AugustinLF/received_events","type":"User","site_admin":false},"created_at":"2016-03-16T16:45:14Z","updated_at":"2016-03-16T16:45:14Z","body":"I've read that arrow functions for stateless components [don't have a name property](https://github.com/airbnb/javascript/tree/master/react#class-vs-reactcreateclass-vs-stateless). Could this be the cause of your problem?"}}