{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/vscode-debugadapter-node/issues/56","repository_url":"https://api.github.com/repos/Microsoft/vscode-debugadapter-node","labels_url":"https://api.github.com/repos/Microsoft/vscode-debugadapter-node/issues/56/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/vscode-debugadapter-node/issues/56/comments","events_url":"https://api.github.com/repos/Microsoft/vscode-debugadapter-node/issues/56/events","html_url":"https://github.com/Microsoft/vscode-debugadapter-node/issues/56","id":174947434,"number":56,"title":"Change testsupport to not use child processes","user":{"login":"felixfbecker","id":10532611,"avatar_url":"https://avatars.githubusercontent.com/u/10532611?v=3","gravatar_id":"","url":"https://api.github.com/users/felixfbecker","html_url":"https://github.com/felixfbecker","followers_url":"https://api.github.com/users/felixfbecker/followers","following_url":"https://api.github.com/users/felixfbecker/following{/other_user}","gists_url":"https://api.github.com/users/felixfbecker/gists{/gist_id}","starred_url":"https://api.github.com/users/felixfbecker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/felixfbecker/subscriptions","organizations_url":"https://api.github.com/users/felixfbecker/orgs","repos_url":"https://api.github.com/users/felixfbecker/repos","events_url":"https://api.github.com/users/felixfbecker/events{/privacy}","received_events_url":"https://api.github.com/users/felixfbecker/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/vscode-debugadapter-node/labels/feature-request","name":"feature-request","color":"84b6eb"}],"state":"open","locked":false,"assignee":{"login":"weinand","id":1898161,"avatar_url":"https://avatars.githubusercontent.com/u/1898161?v=3","gravatar_id":"","url":"https://api.github.com/users/weinand","html_url":"https://github.com/weinand","followers_url":"https://api.github.com/users/weinand/followers","following_url":"https://api.github.com/users/weinand/following{/other_user}","gists_url":"https://api.github.com/users/weinand/gists{/gist_id}","starred_url":"https://api.github.com/users/weinand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weinand/subscriptions","organizations_url":"https://api.github.com/users/weinand/orgs","repos_url":"https://api.github.com/users/weinand/repos","events_url":"https://api.github.com/users/weinand/events{/privacy}","received_events_url":"https://api.github.com/users/weinand/received_events","type":"User","site_admin":false},"assignees":[{"login":"weinand","id":1898161,"avatar_url":"https://avatars.githubusercontent.com/u/1898161?v=3","gravatar_id":"","url":"https://api.github.com/users/weinand","html_url":"https://github.com/weinand","followers_url":"https://api.github.com/users/weinand/followers","following_url":"https://api.github.com/users/weinand/following{/other_user}","gists_url":"https://api.github.com/users/weinand/gists{/gist_id}","starred_url":"https://api.github.com/users/weinand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weinand/subscriptions","organizations_url":"https://api.github.com/users/weinand/orgs","repos_url":"https://api.github.com/users/weinand/repos","events_url":"https://api.github.com/users/weinand/events{/privacy}","received_events_url":"https://api.github.com/users/weinand/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2016-09-04T12:49:01Z","updated_at":"2016-09-04T20:03:44Z","closed_at":null,"body":"I have tests for my debugadapter for quite some time now, but spawning the debuadapter for every test has only proven to cause problems:\r\n- It is extremely slow, especially on Windows\r\n- Constantly there are issues with timeouts or hanging that only happen in CI. I have to test against 3 PHP versions x 3 XDebug versions and these random failures mean that at least one job always fails, breaking the build. I never had a stable green build ever since I added tests.\r\n- It is impossible to generate code coverage with istanbul/nyc. Even though nyc claims to work with child processes, my debug adapter file is getting 0% coverage in the report.\r\n\r\nThis could be made much easier. In the mock debug extension, the main file declares a class and then directly calls `run()` to run the adapter. This could be changed to\r\n```ts\r\nexport class MyDebugSession extends DebugSession {\r\n  // ...\r\n}\r\nif (require.main === module) {\r\n  DebugSession.run(MyDebugSession);\r\n}\r\n```\r\nmaking it only run when the file was the entry point of the application. Then in the tests, we could just _import_ the session, instantiate it and call the methods directly on it, providing object literals as parameters that conform to the debug protocol interfaces. `sendResponse()` and `sendErrorResponse()` can easily be stubbed by sinon, asserting that they have been called with specific parameters.\r\n\r\nThat way, we _only_ test the actual unit under test, our own debug adapter, and trust vscode-debugadapter-node to function correctly. Currently we basically test the whole stack including vscode-debugadapter-node's protocol parsing, method dispatching and response handling, which is not a good practice."},"comment":{"url":"https://api.github.com/repos/Microsoft/vscode-debugadapter-node/issues/comments/244625490","html_url":"https://github.com/Microsoft/vscode-debugadapter-node/issues/56#issuecomment-244625490","issue_url":"https://api.github.com/repos/Microsoft/vscode-debugadapter-node/issues/56","id":244625490,"user":{"login":"weinand","id":1898161,"avatar_url":"https://avatars.githubusercontent.com/u/1898161?v=3","gravatar_id":"","url":"https://api.github.com/users/weinand","html_url":"https://github.com/weinand","followers_url":"https://api.github.com/users/weinand/followers","following_url":"https://api.github.com/users/weinand/following{/other_user}","gists_url":"https://api.github.com/users/weinand/gists{/gist_id}","starred_url":"https://api.github.com/users/weinand/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weinand/subscriptions","organizations_url":"https://api.github.com/users/weinand/orgs","repos_url":"https://api.github.com/users/weinand/repos","events_url":"https://api.github.com/users/weinand/events{/privacy}","received_events_url":"https://api.github.com/users/weinand/received_events","type":"User","site_admin":false},"created_at":"2016-09-04T20:03:44Z","updated_at":"2016-09-04T20:03:44Z","body":"@felixfbecker we've never experienced any problems when using the testsupport, so we do not intend to 'change' this."}}
{"actor":{"display_login":"weinand"}}