{"action":"created","issue":{"url":"https://api.github.com/repos/smooth-code/svgr/issues/83","repository_url":"https://api.github.com/repos/smooth-code/svgr","labels_url":"https://api.github.com/repos/smooth-code/svgr/issues/83/labels{/name}","comments_url":"https://api.github.com/repos/smooth-code/svgr/issues/83/comments","events_url":"https://api.github.com/repos/smooth-code/svgr/issues/83/events","html_url":"https://github.com/smooth-code/svgr/issues/83","id":316064714,"node_id":"MDU6SXNzdWUzMTYwNjQ3MTQ=","number":83,"title":"Try to test component with React generated form svgr","user":{"login":"piotrooo","id":2005054,"node_id":"MDQ6VXNlcjIwMDUwNTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/2005054?v=4","gravatar_id":"","url":"https://api.github.com/users/piotrooo","html_url":"https://github.com/piotrooo","followers_url":"https://api.github.com/users/piotrooo/followers","following_url":"https://api.github.com/users/piotrooo/following{/other_user}","gists_url":"https://api.github.com/users/piotrooo/gists{/gist_id}","starred_url":"https://api.github.com/users/piotrooo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piotrooo/subscriptions","organizations_url":"https://api.github.com/users/piotrooo/orgs","repos_url":"https://api.github.com/users/piotrooo/repos","events_url":"https://api.github.com/users/piotrooo/events{/privacy}","received_events_url":"https://api.github.com/users/piotrooo/received_events","type":"User","site_admin":false},"labels":[{"id":681726499,"node_id":"MDU6TGFiZWw2ODE3MjY0OTk=","url":"https://api.github.com/repos/smooth-code/svgr/labels/discussion","name":"discussion","color":"cc317c","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-04-19T22:36:44Z","updated_at":"2018-07-23T11:54:08Z","closed_at":null,"author_association":"NONE","body":"Hi, \r\nI have a little problem with Jest tests runner.\r\n\r\nMy simple component:\r\n\r\n```javascript\r\nimport React from 'react';\r\n\r\nimport {ReactComponent as CloseIcon} from '../images/close.svg';\r\n\r\nconst CloseBubble = ({minimize}) => (\r\n    <div className='thulium-chat-bubble'>\r\n        <a onClick={event => {\r\n            event.preventDefault();\r\n            minimize()\r\n        }} href=''>\r\n            <CloseIcon/>\r\n        </a>\r\n    </div>\r\n);\r\n\r\nexport default CloseBubble;\r\n```\r\n\r\ntest class:\r\n\r\n```javascript\r\nimport CloseBubble from '../CloseBubble';\r\n\r\ndescribe('CloseBubble', () => {\r\n    test('sample', () => {\r\n        expect(1).toBe(1);\r\n    });\r\n});\r\n```\r\n\r\nAnd after I run this test I got following error:\r\n\r\n```\r\n  ({\"Object.<anonymous>\":function(module,exports,require,__dirname,__filename,global,jest){<svg id=\"Layer_1\" data-name=\"Layer 1\" xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 100\"><defs><style>.cls-1{fill:#231f20;}</style></defs><title>cancel_icon</title><path class=\"cls-1\" d=\"M52.08,50,70.32,31.84a1.49,1.49,0,0,0-2.11-2.11L50,47.87,31.82,29.63a1.8,1.8,0,0,0-2.22,0,1.82,1.82,0,0,0,0,2.21L47.85,50.09,29.6,68.23a1.47,1.47,0,0,0,0,2.12,1.74,1.74,0,0,0,2.22,0L50.06,52.1,68.31,70.35a1.73,1.73,0,0,0,2.21,0,1.46,1.46,0,0,0,0-2.12Z\"/></svg>\r\n                                                                                             ^\r\n    \r\n    SyntaxError: Unexpected token <\r\n\r\n       9 |             minimize()\r\n      10 |         }} href=''>\r\n    > 11 |             <CloseIcon/>\r\n      12 |         </a>\r\n      13 |     </div>\r\n      14 | );\r\n      \r\n      at ScriptTransformer._transformAndBuildScript (node_modules/jest-runtime/build/script_transformer.js:316:17)\r\n      at Object.<anonymous> (src/components/CloseBubble.js:11:14)\r\n```\r\n\r\nWhat I've do wrong?\r\n"},"comment":{"url":"https://api.github.com/repos/smooth-code/svgr/issues/comments/407032012","html_url":"https://github.com/smooth-code/svgr/issues/83#issuecomment-407032012","issue_url":"https://api.github.com/repos/smooth-code/svgr/issues/83","id":407032012,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNzAzMjAxMg==","user":{"login":"piotrooo","id":2005054,"node_id":"MDQ6VXNlcjIwMDUwNTQ=","avatar_url":"https://avatars1.githubusercontent.com/u/2005054?v=4","gravatar_id":"","url":"https://api.github.com/users/piotrooo","html_url":"https://github.com/piotrooo","followers_url":"https://api.github.com/users/piotrooo/followers","following_url":"https://api.github.com/users/piotrooo/following{/other_user}","gists_url":"https://api.github.com/users/piotrooo/gists{/gist_id}","starred_url":"https://api.github.com/users/piotrooo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/piotrooo/subscriptions","organizations_url":"https://api.github.com/users/piotrooo/orgs","repos_url":"https://api.github.com/users/piotrooo/repos","events_url":"https://api.github.com/users/piotrooo/events{/privacy}","received_events_url":"https://api.github.com/users/piotrooo/received_events","type":"User","site_admin":false},"created_at":"2018-07-23T11:54:08Z","updated_at":"2018-07-23T11:54:08Z","author_association":"NONE","body":"I didn't handle it at all... Workaround which works for me, generating icons while bundling package.\r\n\r\nnpm script:\r\n\r\n```\r\n\"generate-icons\": \"node_modules/.bin/svgr --no-title src/images/ --out-dir src/icons && echo Done. Building project...\",\r\n```\r\n----\r\n**Disclaimer**\r\nThis is very naive way! Should be treated as a workaround not a final solution."}}
{"actor":{"display_login":"piotrooo"}}