{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/nodejstools/issues/223","labels_url":"https://api.github.com/repos/Microsoft/nodejstools/issues/223/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/nodejstools/issues/223/comments","events_url":"https://api.github.com/repos/Microsoft/nodejstools/issues/223/events","html_url":"https://github.com/Microsoft/nodejstools/issues/223","id":89695447,"number":223,"title":"Each test case is runs in a separate node.js process","user":{"login":"lukedgr","id":3270455,"avatar_url":"https://avatars.githubusercontent.com/u/3270455?v=3","gravatar_id":"","url":"https://api.github.com/users/lukedgr","html_url":"https://github.com/lukedgr","followers_url":"https://api.github.com/users/lukedgr/followers","following_url":"https://api.github.com/users/lukedgr/following{/other_user}","gists_url":"https://api.github.com/users/lukedgr/gists{/gist_id}","starred_url":"https://api.github.com/users/lukedgr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukedgr/subscriptions","organizations_url":"https://api.github.com/users/lukedgr/orgs","repos_url":"https://api.github.com/users/lukedgr/repos","events_url":"https://api.github.com/users/lukedgr/events{/privacy}","received_events_url":"https://api.github.com/users/lukedgr/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Microsoft/nodejstools/labels/test-adapter","name":"test-adapter","color":"dff0ff"},{"url":"https://api.github.com/repos/Microsoft/nodejstools/labels/up-for-grabs","name":"up-for-grabs","color":"00cc33"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/Microsoft/nodejstools/milestones/4","html_url":"https://github.com/Microsoft/nodejstools/milestones/Future","labels_url":"https://api.github.com/repos/Microsoft/nodejstools/milestones/4/labels","id":1060983,"number":4,"title":"Future","description":"","creator":{"login":"AndreSayreMSFT","id":10080679,"avatar_url":"https://avatars.githubusercontent.com/u/10080679?v=3","gravatar_id":"","url":"https://api.github.com/users/AndreSayreMSFT","html_url":"https://github.com/AndreSayreMSFT","followers_url":"https://api.github.com/users/AndreSayreMSFT/followers","following_url":"https://api.github.com/users/AndreSayreMSFT/following{/other_user}","gists_url":"https://api.github.com/users/AndreSayreMSFT/gists{/gist_id}","starred_url":"https://api.github.com/users/AndreSayreMSFT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AndreSayreMSFT/subscriptions","organizations_url":"https://api.github.com/users/AndreSayreMSFT/orgs","repos_url":"https://api.github.com/users/AndreSayreMSFT/repos","events_url":"https://api.github.com/users/AndreSayreMSFT/events{/privacy}","received_events_url":"https://api.github.com/users/AndreSayreMSFT/received_events","type":"User","site_admin":false},"open_issues":172,"closed_issues":7,"state":"open","created_at":"2015-04-09T21:08:48Z","updated_at":"2015-11-12T00:41:05Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-06-20T01:00:24Z","updated_at":"2015-11-12T13:10:33Z","closed_at":null,"body":"Copying issue from https://nodejstools.codeplex.com/workitem/1615\r\n\r\nSelecting a subset or all the test cases to be run from the Test Explorer will make each test case to be run on it's own separate node.js process. \r\n\r\nThis leads to test hooks for the suite not being honored, as they are run for each test case, instead of for each test suite. For instance, on Mocha:\r\n\r\n```javascript\r\ndescribe('myTestSuite', function(){\r\n    before(function() {\r\n        veryExpensiveOperation();\r\n    });\r\n\r\n    it('testCase1', function() { ... });\r\n    it('testCase2', function() { ... });\r\n});\r\n```\r\n\r\nIf testCase1 and testCase2 are selected and run from test explorer, we would get the \"before()\" function called twice, essentially this makes the before() behaving like a beforeEach() (check out Mocha's page about hooks). \r\n\r\nIdeally, the suite should be run on a single node.js process, so before() and after() method could be run only once per suite, allowing expensive code to be factored in a way that optimizes the execution time. \r\n\r\nThe issue is on the TestExecute.cs for the test adapter, on the RunTestCases() method. It iterates over all the test cases and calls RunTestCase() for each one of them. RunTestCase() spawns a new nodejs process and asks mocha to execute that specific test case received as argument."},"comment":{"url":"https://api.github.com/repos/Microsoft/nodejstools/issues/comments/156098994","html_url":"https://github.com/Microsoft/nodejstools/issues/223#issuecomment-156098994","issue_url":"https://api.github.com/repos/Microsoft/nodejstools/issues/223","id":156098994,"user":{"login":"SteveALee","id":618922,"avatar_url":"https://avatars.githubusercontent.com/u/618922?v=3","gravatar_id":"","url":"https://api.github.com/users/SteveALee","html_url":"https://github.com/SteveALee","followers_url":"https://api.github.com/users/SteveALee/followers","following_url":"https://api.github.com/users/SteveALee/following{/other_user}","gists_url":"https://api.github.com/users/SteveALee/gists{/gist_id}","starred_url":"https://api.github.com/users/SteveALee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SteveALee/subscriptions","organizations_url":"https://api.github.com/users/SteveALee/orgs","repos_url":"https://api.github.com/users/SteveALee/repos","events_url":"https://api.github.com/users/SteveALee/events{/privacy}","received_events_url":"https://api.github.com/users/SteveALee/received_events","type":"User","site_admin":false},"created_at":"2015-11-12T13:10:33Z","updated_at":"2015-11-12T13:10:33Z","body":"I've no idea if it's possible with Mocha but it would be great to support the standard [TAP protocol](https://en.wikipedia.org/wiki/Test_Anything_Protocol) in the VS runner for process / runner communication. For example see [node-tap](https://github.com/isaacs/node-tap) and I'm using [tape](https://www.npmjs.com/package/tape) which supports node and browsers.\r\n\r\nAn advantage of TAP is there are lots of tools that support it. It's also mature (very)."}}