{"action":"created","issue":{"url":"https://api.github.com/repos/cypress-io/cypress/issues/1654","repository_url":"https://api.github.com/repos/cypress-io/cypress","labels_url":"https://api.github.com/repos/cypress-io/cypress/issues/1654/labels{/name}","comments_url":"https://api.github.com/repos/cypress-io/cypress/issues/1654/comments","events_url":"https://api.github.com/repos/cypress-io/cypress/issues/1654/events","html_url":"https://github.com/cypress-io/cypress/issues/1654","id":319181810,"number":1654,"title":"Plugins API - preprocessing with source file - electron/ chrome run","user":{"login":"paulpruteanu","id":8288389,"avatar_url":"https://avatars3.githubusercontent.com/u/8288389?v=4","gravatar_id":"","url":"https://api.github.com/users/paulpruteanu","html_url":"https://github.com/paulpruteanu","followers_url":"https://api.github.com/users/paulpruteanu/followers","following_url":"https://api.github.com/users/paulpruteanu/following{/other_user}","gists_url":"https://api.github.com/users/paulpruteanu/gists{/gist_id}","starred_url":"https://api.github.com/users/paulpruteanu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulpruteanu/subscriptions","organizations_url":"https://api.github.com/users/paulpruteanu/orgs","repos_url":"https://api.github.com/users/paulpruteanu/repos","events_url":"https://api.github.com/users/paulpruteanu/events{/privacy}","received_events_url":"https://api.github.com/users/paulpruteanu/received_events","type":"User","site_admin":false},"labels":[{"id":898320448,"url":"https://api.github.com/repos/cypress-io/cypress/labels/stage:%20awaiting%20response","name":"stage: awaiting response","color":"ffdf7f","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":18,"created_at":"2018-05-01T12:05:28Z","updated_at":"2018-05-01T16:50:14Z","closed_at":null,"author_association":"NONE","body":"<!-- Is this a question? Do not open an issue. Please ask your question in our chat https://gitter.im/cypress-io/cypress -->\r\n\r\n### Current behavior: <!-- (images, stack traces, etc) -->\r\nNot being able to run \"cypress run\" (default to electron), when preprocessing the source file.\r\nEnding up in \"Uncaught ReferenceError: require is not defined\"\r\n\r\n### Desired behavior:\r\nTo be able to run it successfully.\r\n\r\n### Steps to reproduce:\r\n```js\r\n# cypress/plugins/index.js\r\nmodule.exports = (on) => {\r\n  on('file:preprocessor', (file) => Promise.resolve(file.filePath))\r\n  /* \"cypress run\" (default to electron) throws this error: Uncaught ReferenceError: require is not defined\r\n  cypress run --browser chrome behaves the same\r\n  it works resolving file.outputPath, but it's not good enough for staged containers that doesn't have the outputPath\r\n  at the time */\r\n}\r\n```\r\n\r\n<img width=\"800\" alt=\"screen shot 2018-05-01 at 13 04 45\" src=\"https://user-images.githubusercontent.com/8288389/39472298-4efccab8-4d40-11e8-9c0d-ac85991fdc7e.png\">\r\n\r\nsame thing goes for\r\n```js\r\nconst watch = require('@cypress/watch-preprocessor')\r\n\r\nmodule.exports = (on) => {\r\n  on('file:preprocessor', watch())\r\n}\r\n```\r\n\r\n### Versions  <!-- (Cypress, operating system, browser) -->\r\ncypress@2.1.0, MacOs Sierra 10.12.6\r\n"},"comment":{"url":"https://api.github.com/repos/cypress-io/cypress/issues/comments/385721486","html_url":"https://github.com/cypress-io/cypress/issues/1654#issuecomment-385721486","issue_url":"https://api.github.com/repos/cypress-io/cypress/issues/1654","id":385721486,"user":{"login":"paulpruteanu","id":8288389,"avatar_url":"https://avatars3.githubusercontent.com/u/8288389?v=4","gravatar_id":"","url":"https://api.github.com/users/paulpruteanu","html_url":"https://github.com/paulpruteanu","followers_url":"https://api.github.com/users/paulpruteanu/followers","following_url":"https://api.github.com/users/paulpruteanu/following{/other_user}","gists_url":"https://api.github.com/users/paulpruteanu/gists{/gist_id}","starred_url":"https://api.github.com/users/paulpruteanu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulpruteanu/subscriptions","organizations_url":"https://api.github.com/users/paulpruteanu/orgs","repos_url":"https://api.github.com/users/paulpruteanu/repos","events_url":"https://api.github.com/users/paulpruteanu/events{/privacy}","received_events_url":"https://api.github.com/users/paulpruteanu/received_events","type":"User","site_admin":false},"created_at":"2018-05-01T16:50:14Z","updated_at":"2018-05-01T16:50:14Z","author_association":"NONE","body":"`process.setMaxListeners(0);` fixed it for me. Ref on issue [here](https://stackoverflow.com/questions/9768444/possible-eventemitter-memory-leak-detected)."}}
{"actor":{"display_login":"paulpruteanu"}}