{"action":"created","issue":{"url":"https://api.github.com/repos/nestjs/nest/issues/438","repository_url":"https://api.github.com/repos/nestjs/nest","labels_url":"https://api.github.com/repos/nestjs/nest/issues/438/labels{/name}","comments_url":"https://api.github.com/repos/nestjs/nest/issues/438/comments","events_url":"https://api.github.com/repos/nestjs/nest/issues/438/events","html_url":"https://github.com/nestjs/nest/issues/438","id":298251770,"number":438,"title":"Mongoose unit test documentation & Atom Editor tsconfig.json","user":{"login":"cloakedch","id":32439069,"avatar_url":"https://avatars1.githubusercontent.com/u/32439069?v=4","gravatar_id":"","url":"https://api.github.com/users/cloakedch","html_url":"https://github.com/cloakedch","followers_url":"https://api.github.com/users/cloakedch/followers","following_url":"https://api.github.com/users/cloakedch/following{/other_user}","gists_url":"https://api.github.com/users/cloakedch/gists{/gist_id}","starred_url":"https://api.github.com/users/cloakedch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cloakedch/subscriptions","organizations_url":"https://api.github.com/users/cloakedch/orgs","repos_url":"https://api.github.com/users/cloakedch/repos","events_url":"https://api.github.com/users/cloakedch/events{/privacy}","received_events_url":"https://api.github.com/users/cloakedch/received_events","type":"User","site_admin":false},"labels":[{"id":604589830,"url":"https://api.github.com/repos/nestjs/nest/labels/type:%20docs%20:page_facing_up:","name":"type: docs :page_facing_up:","color":"5319e7","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-02-19T12:03:30Z","updated_at":"2018-05-25T15:28:31Z","closed_at":"2018-05-19T08:34:22Z","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[ ] Bug report\r\n[ ] Feature request\r\n[x] 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\n**Request 1:** It would be great if there was an example available that shows how to write/use a unit test for modules that rely on @nestjs/mongoose. I would be especially interested in knowing how the mongoose connection dependencies should be injected into `Test.createTestingModule()` (best practices).\r\nThere is a unit test already available in the 01-cats-app example, but it doesn't make use of mongodb or mongoose.\r\n\r\n**Request 2 (Less important):** Looking again at unit tests but now looking at 01-cats-app. The unit test is shown in the file `cats.controller.spec.ts`. The `tsconfig.json` however excludes all *.spec.ts files from the definitions. I believe that `cats.controller.spec.ts` is not \"bound\" to any `tsconfig.json` context because of that.\r\nOpening the `cats.controller.spec.ts` in the well-known Atom editor will therefore throw errors at the keywords `describe`, `beforeEach`, `it`, etc. If one removes `\"**/*.spec.ts\"` from `tsconfig.json`, the errors are gone because Atom now interprets the spec.ts file as being part of the project.\r\nRemoving that line will obviously solve the issue, but all test files will also be compiled on a productive system which leaves a bad taste.\r\nI could think of other editors that might have similar issues. It would be great if a solution was documented. One solution could be by using a supplementary `tsconfig.json` file in a test directory, that is only read when using the npm test command.\r\n\r\n## Expected behavior\r\n<!-- Describe what the desired behavior would be. -->\r\nBoth documentation requests documented.\r\n\r\n## Environment\r\n\r\n<pre><code>\r\nNest version: 4.6.4\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: 9.5.0  <!-- run `node --version` -->\r\n- Platform: Linux (Ubuntu 16.04.3 LTS) <!-- Mac, Linux, Windows -->\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/392094281","html_url":"https://github.com/nestjs/nest/issues/438#issuecomment-392094281","issue_url":"https://api.github.com/repos/nestjs/nest/issues/438","id":392094281,"user":{"login":"mmenik","id":25682572,"avatar_url":"https://avatars0.githubusercontent.com/u/25682572?v=4","gravatar_id":"","url":"https://api.github.com/users/mmenik","html_url":"https://github.com/mmenik","followers_url":"https://api.github.com/users/mmenik/followers","following_url":"https://api.github.com/users/mmenik/following{/other_user}","gists_url":"https://api.github.com/users/mmenik/gists{/gist_id}","starred_url":"https://api.github.com/users/mmenik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mmenik/subscriptions","organizations_url":"https://api.github.com/users/mmenik/orgs","repos_url":"https://api.github.com/users/mmenik/repos","events_url":"https://api.github.com/users/mmenik/events{/privacy}","received_events_url":"https://api.github.com/users/mmenik/received_events","type":"User","site_admin":false},"created_at":"2018-05-25T15:28:31Z","updated_at":"2018-05-25T15:28:31Z","author_association":"NONE","body":"@kamilmysliwiec At the end of the document, you indicate an example (14-mongoose-base) but in this example the test described in the document is missing, I would like to understand how to mock a result (Cats) that extends document (mongoose) into a unit test, thanks."}}
{"actor":{"display_login":"mmenik"}}