{"action":"created","issue":{"url":"https://api.github.com/repos/nestjs/nest/issues/1114","repository_url":"https://api.github.com/repos/nestjs/nest","labels_url":"https://api.github.com/repos/nestjs/nest/issues/1114/labels{/name}","comments_url":"https://api.github.com/repos/nestjs/nest/issues/1114/comments","events_url":"https://api.github.com/repos/nestjs/nest/issues/1114/events","html_url":"https://github.com/nestjs/nest/issues/1114","id":363445708,"node_id":"MDU6SXNzdWUzNjM0NDU3MDg=","number":1114,"title":"E2E tests broken when registering websockets","user":{"login":"Oliboy50","id":2571084,"node_id":"MDQ6VXNlcjI1NzEwODQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2571084?v=4","gravatar_id":"","url":"https://api.github.com/users/Oliboy50","html_url":"https://github.com/Oliboy50","followers_url":"https://api.github.com/users/Oliboy50/followers","following_url":"https://api.github.com/users/Oliboy50/following{/other_user}","gists_url":"https://api.github.com/users/Oliboy50/gists{/gist_id}","starred_url":"https://api.github.com/users/Oliboy50/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Oliboy50/subscriptions","organizations_url":"https://api.github.com/users/Oliboy50/orgs","repos_url":"https://api.github.com/users/Oliboy50/repos","events_url":"https://api.github.com/users/Oliboy50/events{/privacy}","received_events_url":"https://api.github.com/users/Oliboy50/received_events","type":"User","site_admin":false},"labels":[{"id":1026289724,"node_id":"MDU6TGFiZWwxMDI2Mjg5NzI0","url":"https://api.github.com/repos/nestjs/nest/labels/needs%20clarification","name":"needs clarification","color":"d6f25c","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":15,"created_at":"2018-09-25T07:31:17Z","updated_at":"2018-09-26T13:00:48Z","closed_at":"2018-09-26T13:00:48Z","author_association":"NONE","body":"<!--\r\nPLEASE HELP US PROCESS GITHUB ISSUES FASTER BY PROVIDING THE FOLLOWING INFORMATION.\r\n\r\nISSUES MISSING IMPORTANT INFORMATION MAY BE CLOSED WITHOUT INVESTIGATION.\r\n-->\r\n\r\n## I'm submitting a...\r\n<!-- \r\nPlease search GitHub for a similar issue or PR before submitting.\r\nCheck one of the following options with \"x\" -->\r\n<pre><code>\r\n[ ] Regression <!--(a behavior that used to work and stopped working in a new release)-->\r\n[x] Bug report\r\n[ ] Feature request\r\n[ ] Documentation issue or request\r\n[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.\r\n</code></pre>\r\n\r\n## Current behavior\r\n<!-- Describe how the issue manifests. -->\r\nFollowing the [E2E Testing documentation](https://docs.nestjs.com/fundamentals/unit-testing), it works perfectly well to test controllers.\r\n\r\nBut as soon as you register a websocket (using `providers` as describe in documentation), and even if no controller is registered, we end up with the following error:\r\n\r\n```\r\nTypeError: Cannot read property 'create' of null\r\n\r\n      23 | \r\n      24 | \t\tapp = moduleFixture.createNestApplication();\r\n    > 25 | \t\tawait app.init();\r\n         | \t\t          ^\r\n      26 | \t});\r\n      27 | \r\n      28 | \tafterAll(async () => {\r\n\r\n      at SocketServerProvider.createSocketServer (node_modules/@nestjs/websockets/socket-server-provider.js:28:34)\r\n      at SocketServerProvider.scanForSocketServer (node_modules/@nestjs/websockets/socket-server-provider.js:23:20)\r\n      at WebSocketsController.subscribeObservableServer (node_modules/@nestjs/websockets/web-sockets-controller.js:35:60)\r\n      at WebSocketsController.hookGatewayIntoServer (node_modules/@nestjs/websockets/web-sockets-controller.js:27:14)\r\n      at SocketModule.hookGatewayIntoServer (node_modules/@nestjs/websockets/socket-module.js:40:35)\r\n      at components.forEach.wrapper (node_modules/@nestjs/websockets/socket-module.js:29:44)\r\n          at Map.forEach (<anonymous>)\r\n      at SocketModule.hookGatewaysIntoServers (node_modules/@nestjs/websockets/socket-module.js:29:20)\r\n      at modules.forEach (node_modules/@nestjs/websockets/socket-module.js:26:62)\r\n          at Map.forEach (<anonymous>)\r\n      at SocketModule.register (node_modules/@nestjs/websockets/socket-module.js:26:17)\r\n      at NestApplication.registerModules (node_modules/@nestjs/core/nest-application.js:77:31)\r\n      at NestApplication.init (node_modules/@nestjs/core/nest-application.js:87:20)\r\n      at Object.beforeAll (tests/e2e/something.e2e-spec.ts:25:13)\r\n\r\n```\r\n\r\n## Expected behavior\r\n<!-- Describe what the desired behavior would be. -->\r\n\r\nE2E testing of the whole application should work as expected even with websockets registered.\r\nMoreover, we should be able to setup E2E testing for websockets just like we do for controllers.\r\n\r\n\r\n## Minimal reproduction of the problem with instructions\r\n<!-- Please share a repo, a gist, or step-by-step instructions. -->\r\nhttps://github.com/Oliboy50/reproduce-issue-nestjs-websockets-test-e2e\r\n\r\n## What is the motivation / use case for changing the behavior?\r\n<!-- Describe the motivation or the concrete use case. -->\r\nI don't want to have to \"mock\" my Websocket providers in e2e tests.\r\n\r\n## Environment\r\n\r\n<pre><code>\r\nNest version: 5.2.2\r\n<!-- Check whether this is still an issue in the most recent Nest version -->\r\n \r\nFor Tooling issues:\r\n- Node version: 10  <!-- run `node --version` -->\r\n- Platform:  Mac and Linux\r\n\r\nOthers:\r\n<!-- Anything else relevant?  Operating system version, IDE, package manager, ... -->\r\n</code></pre>\r\n"},"comment":{"url":"https://api.github.com/repos/nestjs/nest/issues/comments/424706119","html_url":"https://github.com/nestjs/nest/issues/1114#issuecomment-424706119","issue_url":"https://api.github.com/repos/nestjs/nest/issues/1114","id":424706119,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNDcwNjExOQ==","user":{"login":"kamilmysliwiec","id":23244943,"node_id":"MDQ6VXNlcjIzMjQ0OTQz","avatar_url":"https://avatars0.githubusercontent.com/u/23244943?v=4","gravatar_id":"","url":"https://api.github.com/users/kamilmysliwiec","html_url":"https://github.com/kamilmysliwiec","followers_url":"https://api.github.com/users/kamilmysliwiec/followers","following_url":"https://api.github.com/users/kamilmysliwiec/following{/other_user}","gists_url":"https://api.github.com/users/kamilmysliwiec/gists{/gist_id}","starred_url":"https://api.github.com/users/kamilmysliwiec/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kamilmysliwiec/subscriptions","organizations_url":"https://api.github.com/users/kamilmysliwiec/orgs","repos_url":"https://api.github.com/users/kamilmysliwiec/repos","events_url":"https://api.github.com/users/kamilmysliwiec/events{/privacy}","received_events_url":"https://api.github.com/users/kamilmysliwiec/received_events","type":"User","site_admin":false},"created_at":"2018-09-26T13:00:48Z","updated_at":"2018-09-26T13:00:48Z","author_association":"MEMBER","body":"Lol. 😅Glad it works now! :)"}}
{"actor":{"display_login":"kamilmysliwiec"}}