{"action":"created","issue":{"url":"https://api.github.com/repos/substack/tape/issues/222","repository_url":"https://api.github.com/repos/substack/tape","labels_url":"https://api.github.com/repos/substack/tape/issues/222/labels{/name}","comments_url":"https://api.github.com/repos/substack/tape/issues/222/comments","events_url":"https://api.github.com/repos/substack/tape/issues/222/events","html_url":"https://github.com/substack/tape/issues/222","id":121416682,"number":222,"title":"Test order is affected by a presence of a nested test","user":{"login":"ArtemGovorov","id":979966,"avatar_url":"https://avatars.githubusercontent.com/u/979966?v=3","gravatar_id":"","url":"https://api.github.com/users/ArtemGovorov","html_url":"https://github.com/ArtemGovorov","followers_url":"https://api.github.com/users/ArtemGovorov/followers","following_url":"https://api.github.com/users/ArtemGovorov/following{/other_user}","gists_url":"https://api.github.com/users/ArtemGovorov/gists{/gist_id}","starred_url":"https://api.github.com/users/ArtemGovorov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ArtemGovorov/subscriptions","organizations_url":"https://api.github.com/users/ArtemGovorov/orgs","repos_url":"https://api.github.com/users/ArtemGovorov/repos","events_url":"https://api.github.com/users/ArtemGovorov/events{/privacy}","received_events_url":"https://api.github.com/users/ArtemGovorov/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/substack/tape/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":25,"created_at":"2015-12-10T06:41:39Z","updated_at":"2016-02-13T21:24:58Z","closed_at":null,"body":"The following code:\r\n``` JavaScript\r\nvar test = require('tape');\r\n\r\ntest('first', function (t) {\r\n\r\n  t.plan(2);\r\n\r\n  setTimeout(function () {\r\n    t.ok(1, 'first test');\r\n  }, 200);\r\n\r\n  t.test('second', function (t) {\r\n    t.ok(1, 'second test');\r\n    t.end();\r\n  });\r\n});\r\n\r\ntest('third', function (t) {\r\n  setTimeout(function () {\r\n    t.ok(1, 'third test');\r\n    t.end();\r\n  }, 100);\r\n});\r\n```\r\n\r\noutputs:\r\n```\r\nok 1 first test\r\nok 2 second test\r\nok 3 third test\r\n```\r\nand it's expected. But if I change it to its logical equivalent without `plan`:\r\n\r\n``` JavaScript\r\nvar test = require('tape');\r\n\r\ntest('first', function (t) {\r\n\r\n  setTimeout(function () {\r\n    t.ok(1, 'first test');\r\n    t.end();\r\n  }, 200);\r\n\r\n  t.test('second', function (t) {\r\n    t.ok(1, 'second test');\r\n    t.end();\r\n  });\r\n});\r\n\r\ntest('third', function (t) {\r\n  setTimeout(function () {\r\n    t.ok(1, 'third test');\r\n    t.end();\r\n  }, 100);\r\n});\r\n```\r\n\r\nthe the test order is broken:\r\n```\r\nok 1 second test\r\nok 2 third test\r\nok 3 first test\r\n```\r\n\r\nWhile changing the order of the first and the second test is *somewhat* expected, ending the first test prematurely, and letting the third test execute before it, looks like a bug. Especially considering that commenting `t.test('second'...` test out restores the expected order, and make the third test wait until the first one ends."},"comment":{"url":"https://api.github.com/repos/substack/tape/issues/comments/183756491","html_url":"https://github.com/substack/tape/issues/222#issuecomment-183756491","issue_url":"https://api.github.com/repos/substack/tape/issues/222","id":183756491,"user":{"login":"Kl0tl","id":2788549,"avatar_url":"https://avatars.githubusercontent.com/u/2788549?v=3","gravatar_id":"","url":"https://api.github.com/users/Kl0tl","html_url":"https://github.com/Kl0tl","followers_url":"https://api.github.com/users/Kl0tl/followers","following_url":"https://api.github.com/users/Kl0tl/following{/other_user}","gists_url":"https://api.github.com/users/Kl0tl/gists{/gist_id}","starred_url":"https://api.github.com/users/Kl0tl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kl0tl/subscriptions","organizations_url":"https://api.github.com/users/Kl0tl/orgs","repos_url":"https://api.github.com/users/Kl0tl/repos","events_url":"https://api.github.com/users/Kl0tl/events{/privacy}","received_events_url":"https://api.github.com/users/Kl0tl/received_events","type":"User","site_admin":false},"created_at":"2016-02-13T21:24:58Z","updated_at":"2016-02-13T21:24:58Z","body":"I fixed the failing test, listening to `beforeExit` should be enough to work around this issue !"}}