{"action":"created","issue":{"url":"https://api.github.com/repos/mochajs/mocha/issues/1635","repository_url":"https://api.github.com/repos/mochajs/mocha","labels_url":"https://api.github.com/repos/mochajs/mocha/issues/1635/labels{/name}","comments_url":"https://api.github.com/repos/mochajs/mocha/issues/1635/comments","events_url":"https://api.github.com/repos/mochajs/mocha/issues/1635/events","html_url":"https://github.com/mochajs/mocha/issues/1635","id":65457446,"number":1635,"title":"afterEach halts suite","user":{"login":"glenjamin","id":151272,"avatar_url":"https://avatars.githubusercontent.com/u/151272?v=3","gravatar_id":"","url":"https://api.github.com/users/glenjamin","html_url":"https://github.com/glenjamin","followers_url":"https://api.github.com/users/glenjamin/followers","following_url":"https://api.github.com/users/glenjamin/following{/other_user}","gists_url":"https://api.github.com/users/glenjamin/gists{/gist_id}","starred_url":"https://api.github.com/users/glenjamin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glenjamin/subscriptions","organizations_url":"https://api.github.com/users/glenjamin/orgs","repos_url":"https://api.github.com/users/glenjamin/repos","events_url":"https://api.github.com/users/glenjamin/events{/privacy}","received_events_url":"https://api.github.com/users/glenjamin/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mochajs/mocha/labels/Needs-Feedback","name":"Needs-Feedback","color":"ffff00"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":21,"created_at":"2015-03-31T13:56:25Z","updated_at":"2016-02-17T16:47:23Z","closed_at":null,"body":"This is a common pattern with tools like sinon or nock - to have afterEach do some standard verification at the end of each test.\r\n\r\nI'm fairly sure this used to work - not sure what's changed.\r\n\r\n```js\r\nvar assert = require('assert');\r\n\r\ndescribe(\"afterEach\", function() {\r\n    var verificationFlag;\r\n    beforeEach(function() {\r\n        verificationFlag = 0;\r\n    });\r\n    afterEach(function() {\r\n        assert.equal(verificationFlag, 1);\r\n    });\r\n\r\n    it(\"0\", function() { })\r\n    it(\"1\", function() { verificationFlag = 1 })\r\n    it(\"2\", function() { verificationFlag = 2 })\r\n});\r\n```\r\n\r\nExpected output: 3 tests, 3 failures\r\nActual output: 1 test, 1 pass, 1 fail (from hook)"},"comment":{"url":"https://api.github.com/repos/mochajs/mocha/issues/comments/185292758","html_url":"https://github.com/mochajs/mocha/issues/1635#issuecomment-185292758","issue_url":"https://api.github.com/repos/mochajs/mocha/issues/1635","id":185292758,"user":{"login":"glenjamin","id":151272,"avatar_url":"https://avatars.githubusercontent.com/u/151272?v=3","gravatar_id":"","url":"https://api.github.com/users/glenjamin","html_url":"https://github.com/glenjamin","followers_url":"https://api.github.com/users/glenjamin/followers","following_url":"https://api.github.com/users/glenjamin/following{/other_user}","gists_url":"https://api.github.com/users/glenjamin/gists{/gist_id}","starred_url":"https://api.github.com/users/glenjamin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/glenjamin/subscriptions","organizations_url":"https://api.github.com/users/glenjamin/orgs","repos_url":"https://api.github.com/users/glenjamin/repos","events_url":"https://api.github.com/users/glenjamin/events{/privacy}","received_events_url":"https://api.github.com/users/glenjamin/received_events","type":"User","site_admin":false},"created_at":"2016-02-17T16:47:23Z","updated_at":"2016-02-17T16:47:23Z","body":"@kownacki - that's a reasonable suggestion IMO, do you see problems with the current suggestion of using `AssertionError`?"}}