{"action":"created","comment":{"url":"https://api.github.com/repos/cucumber/cucumber-js/pulls/comments/77020019","id":77020019,"diff_hunk":"@@ -22,6 +22,15 @@ function Library(supportCodeDefinition) {\n     });\n   }\n \n+  function getStackframe() {\n+    var stackframes = StackTrace.getSync();\n+    if (stackframes.length > 1) {\n+      return stackframes[1];","path":"lib/cucumber/support_code/library.js","position":7,"original_position":7,"commit_id":"8dd94a5d0c694f20c3a5521020cc4faaf0e02485","original_commit_id":"8dd94a5d0c694f20c3a5521020cc4faaf0e02485","user":{"login":"charlierudolph","id":1676758,"avatar_url":"https://avatars.githubusercontent.com/u/1676758?v=3","gravatar_id":"","url":"https://api.github.com/users/charlierudolph","html_url":"https://github.com/charlierudolph","followers_url":"https://api.github.com/users/charlierudolph/followers","following_url":"https://api.github.com/users/charlierudolph/following{/other_user}","gists_url":"https://api.github.com/users/charlierudolph/gists{/gist_id}","starred_url":"https://api.github.com/users/charlierudolph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/charlierudolph/subscriptions","organizations_url":"https://api.github.com/users/charlierudolph/orgs","repos_url":"https://api.github.com/users/charlierudolph/repos","events_url":"https://api.github.com/users/charlierudolph/events{/privacy}","received_events_url":"https://api.github.com/users/charlierudolph/received_events","type":"User","site_admin":false},"body":"Based on the failing feature tests, I think this logic needs to actually be\r\n```js\r\nif (stackframes.length > 2) {\r\n  return stackframes[2];\r\n} // ...\r\n```\r\nSince the defineHook / defineStep is now calling, we have another function on the stack and thus need to look one level further back.","created_at":"2016-08-31T16:19:20Z","updated_at":"2016-08-31T16:19:20Z","html_url":"https://github.com/cucumber/cucumber-js/pull/605#discussion_r77020019","pull_request_url":"https://api.github.com/repos/cucumber/cucumber-js/pulls/605","_links":{"self":{"href":"https://api.github.com/repos/cucumber/cucumber-js/pulls/comments/77020019"},"html":{"href":"https://github.com/cucumber/cucumber-js/pull/605#discussion_r77020019"},"pull_request":{"href":"https://api.github.com/repos/cucumber/cucumber-js/pulls/605"}}},"pull_request":{"url":"https://api.github.com/repos/cucumber/cucumber-js/pulls/605","id":76378278,"html_url":"https://github.com/cucumber/cucumber-js/pull/605","diff_url":"https://github.com/cucumber/cucumber-js/pull/605.diff","patch_url":"https://github.com/cucumber/cucumber-js/pull/605.patch","issue_url":"https://api.github.com/repos/cucumber/cucumber-js/issues/605","number":605,"state":"open","locked":false,"title":"1.2.1 regression: dont crash if there is a single stackframe","user":{"login":"hmalphettes","id":55289,"avatar_url":"https://avatars.githubusercontent.com/u/55289?v=3","gravatar_id":"","url":"https://api.github.com/users/hmalphettes","html_url":"https://github.com/hmalphettes","followers_url":"https://api.github.com/users/hmalphettes/followers","following_url":"https://api.github.com/users/hmalphettes/following{/other_user}","gists_url":"https://api.github.com/users/hmalphettes/gists{/gist_id}","starred_url":"https://api.github.com/users/hmalphettes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hmalphettes/subscriptions","organizations_url":"https://api.github.com/users/hmalphettes/orgs","repos_url":"https://api.github.com/users/hmalphettes/repos","events_url":"https://api.github.com/users/hmalphettes/events{/privacy}","received_events_url":"https://api.github.com/users/hmalphettes/received_events","type":"User","site_admin":false},"body":"Regression from https://github.com/cucumber/cucumber-js/issues/538:\r\n\r\n```\r\n(...)/node_modules/cucumber/lib/cucumber/support_code/library.js:53\r\n        var line = stackframes[1].getLineNumber();\r\n                                 ^\r\n\r\nCannot read property 'getLineNumber' of undefined\r\n    at Object.module.exports (/apps/ui.stoic/test/cucumber/features/step_definitions/runtime.js:81:8)\r\n```\r\n\r\nIn my setup there is either 1 stackframe or 8 of them.\r\nI am not sure this is the perfect fix but it does re-enable running the testsuite.","created_at":"2016-07-06T04:45:38Z","updated_at":"2016-08-31T16:19:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"fac45ce9c4e76c7cc70d28593d07a8437729c8bc","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/cucumber/cucumber-js/pulls/605/commits","review_comments_url":"https://api.github.com/repos/cucumber/cucumber-js/pulls/605/comments","review_comment_url":"https://api.github.com/repos/cucumber/cucumber-js/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cucumber/cucumber-js/issues/605/comments","statuses_url":"https://api.github.com/repos/cucumber/cucumber-js/statuses/8dd94a5d0c694f20c3a5521020cc4faaf0e02485","head":{"label":"sutoiku:fix-stacktraces","ref":"fix-stacktraces","sha":"8dd94a5d0c694f20c3a5521020cc4faaf0e02485","user":{"login":"sutoiku","id":1626030,"avatar_url":"https://avatars.githubusercontent.com/u/1626030?v=3","gravatar_id":"","url":"https://api.github.com/users/sutoiku","html_url":"https://github.com/sutoiku","followers_url":"https://api.github.com/users/sutoiku/followers","following_url":"https://api.github.com/users/sutoiku/following{/other_user}","gists_url":"https://api.github.com/users/sutoiku/gists{/gist_id}","starred_url":"https://api.github.com/users/sutoiku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sutoiku/subscriptions","organizations_url":"https://api.github.com/users/sutoiku/orgs","repos_url":"https://api.github.com/users/sutoiku/repos","events_url":"https://api.github.com/users/sutoiku/events{/privacy}","received_events_url":"https://api.github.com/users/sutoiku/received_events","type":"Organization","site_admin":false},"repo":{"id":62691377,"name":"cucumber-js","full_name":"sutoiku/cucumber-js","owner":{"login":"sutoiku","id":1626030,"avatar_url":"https://avatars.githubusercontent.com/u/1626030?v=3","gravatar_id":"","url":"https://api.github.com/users/sutoiku","html_url":"https://github.com/sutoiku","followers_url":"https://api.github.com/users/sutoiku/followers","following_url":"https://api.github.com/users/sutoiku/following{/other_user}","gists_url":"https://api.github.com/users/sutoiku/gists{/gist_id}","starred_url":"https://api.github.com/users/sutoiku/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sutoiku/subscriptions","organizations_url":"https://api.github.com/users/sutoiku/orgs","repos_url":"https://api.github.com/users/sutoiku/repos","events_url":"https://api.github.com/users/sutoiku/events{/privacy}","received_events_url":"https://api.github.com/users/sutoiku/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sutoiku/cucumber-js","description":"Cucumber for JavaScript","fork":true,"url":"https://api.github.com/repos/sutoiku/cucumber-js","forks_url":"https://api.github.com/repos/sutoiku/cucumber-js/forks","keys_url":"https://api.github.com/repos/sutoiku/cucumber-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sutoiku/cucumber-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sutoiku/cucumber-js/teams","hooks_url":"https://api.github.com/repos/sutoiku/cucumber-js/hooks","issue_events_url":"https://api.github.com/repos/sutoiku/cucumber-js/issues/events{/number}","events_url":"https://api.github.com/repos/sutoiku/cucumber-js/events","assignees_url":"https://api.github.com/repos/sutoiku/cucumber-js/assignees{/user}","branches_url":"https://api.github.com/repos/sutoiku/cucumber-js/branches{/branch}","tags_url":"https://api.github.com/repos/sutoiku/cucumber-js/tags","blobs_url":"https://api.github.com/repos/sutoiku/cucumber-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sutoiku/cucumber-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sutoiku/cucumber-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/sutoiku/cucumber-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sutoiku/cucumber-js/statuses/{sha}","languages_url":"https://api.github.com/repos/sutoiku/cucumber-js/languages","stargazers_url":"https://api.github.com/repos/sutoiku/cucumber-js/stargazers","contributors_url":"https://api.github.com/repos/sutoiku/cucumber-js/contributors","subscribers_url":"https://api.github.com/repos/sutoiku/cucumber-js/subscribers","subscription_url":"https://api.github.com/repos/sutoiku/cucumber-js/subscription","commits_url":"https://api.github.com/repos/sutoiku/cucumber-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/sutoiku/cucumber-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/sutoiku/cucumber-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/sutoiku/cucumber-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/sutoiku/cucumber-js/contents/{+path}","compare_url":"https://api.github.com/repos/sutoiku/cucumber-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sutoiku/cucumber-js/merges","archive_url":"https://api.github.com/repos/sutoiku/cucumber-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sutoiku/cucumber-js/downloads","issues_url":"https://api.github.com/repos/sutoiku/cucumber-js/issues{/number}","pulls_url":"https://api.github.com/repos/sutoiku/cucumber-js/pulls{/number}","milestones_url":"https://api.github.com/repos/sutoiku/cucumber-js/milestones{/number}","notifications_url":"https://api.github.com/repos/sutoiku/cucumber-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sutoiku/cucumber-js/labels{/name}","releases_url":"https://api.github.com/repos/sutoiku/cucumber-js/releases{/id}","deployments_url":"https://api.github.com/repos/sutoiku/cucumber-js/deployments","created_at":"2016-07-06T04:36:27Z","updated_at":"2016-07-06T04:37:30Z","pushed_at":"2016-08-31T15:09:16Z","git_url":"git://github.com/sutoiku/cucumber-js.git","ssh_url":"git@github.com:sutoiku/cucumber-js.git","clone_url":"https://github.com/sutoiku/cucumber-js.git","svn_url":"https://github.com/sutoiku/cucumber-js","homepage":"https://cucumber.io/docs/reference/javascript","size":12621,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cucumber:master","ref":"master","sha":"7764eb73492efa6a2fe458164fcc50ce265f5180","user":{"login":"cucumber","id":320565,"avatar_url":"https://avatars.githubusercontent.com/u/320565?v=3","gravatar_id":"","url":"https://api.github.com/users/cucumber","html_url":"https://github.com/cucumber","followers_url":"https://api.github.com/users/cucumber/followers","following_url":"https://api.github.com/users/cucumber/following{/other_user}","gists_url":"https://api.github.com/users/cucumber/gists{/gist_id}","starred_url":"https://api.github.com/users/cucumber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cucumber/subscriptions","organizations_url":"https://api.github.com/users/cucumber/orgs","repos_url":"https://api.github.com/users/cucumber/repos","events_url":"https://api.github.com/users/cucumber/events{/privacy}","received_events_url":"https://api.github.com/users/cucumber/received_events","type":"Organization","site_admin":false},"repo":{"id":1811965,"name":"cucumber-js","full_name":"cucumber/cucumber-js","owner":{"login":"cucumber","id":320565,"avatar_url":"https://avatars.githubusercontent.com/u/320565?v=3","gravatar_id":"","url":"https://api.github.com/users/cucumber","html_url":"https://github.com/cucumber","followers_url":"https://api.github.com/users/cucumber/followers","following_url":"https://api.github.com/users/cucumber/following{/other_user}","gists_url":"https://api.github.com/users/cucumber/gists{/gist_id}","starred_url":"https://api.github.com/users/cucumber/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cucumber/subscriptions","organizations_url":"https://api.github.com/users/cucumber/orgs","repos_url":"https://api.github.com/users/cucumber/repos","events_url":"https://api.github.com/users/cucumber/events{/privacy}","received_events_url":"https://api.github.com/users/cucumber/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cucumber/cucumber-js","description":"Cucumber for JavaScript","fork":false,"url":"https://api.github.com/repos/cucumber/cucumber-js","forks_url":"https://api.github.com/repos/cucumber/cucumber-js/forks","keys_url":"https://api.github.com/repos/cucumber/cucumber-js/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cucumber/cucumber-js/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cucumber/cucumber-js/teams","hooks_url":"https://api.github.com/repos/cucumber/cucumber-js/hooks","issue_events_url":"https://api.github.com/repos/cucumber/cucumber-js/issues/events{/number}","events_url":"https://api.github.com/repos/cucumber/cucumber-js/events","assignees_url":"https://api.github.com/repos/cucumber/cucumber-js/assignees{/user}","branches_url":"https://api.github.com/repos/cucumber/cucumber-js/branches{/branch}","tags_url":"https://api.github.com/repos/cucumber/cucumber-js/tags","blobs_url":"https://api.github.com/repos/cucumber/cucumber-js/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cucumber/cucumber-js/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cucumber/cucumber-js/git/refs{/sha}","trees_url":"https://api.github.com/repos/cucumber/cucumber-js/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cucumber/cucumber-js/statuses/{sha}","languages_url":"https://api.github.com/repos/cucumber/cucumber-js/languages","stargazers_url":"https://api.github.com/repos/cucumber/cucumber-js/stargazers","contributors_url":"https://api.github.com/repos/cucumber/cucumber-js/contributors","subscribers_url":"https://api.github.com/repos/cucumber/cucumber-js/subscribers","subscription_url":"https://api.github.com/repos/cucumber/cucumber-js/subscription","commits_url":"https://api.github.com/repos/cucumber/cucumber-js/commits{/sha}","git_commits_url":"https://api.github.com/repos/cucumber/cucumber-js/git/commits{/sha}","comments_url":"https://api.github.com/repos/cucumber/cucumber-js/comments{/number}","issue_comment_url":"https://api.github.com/repos/cucumber/cucumber-js/issues/comments{/number}","contents_url":"https://api.github.com/repos/cucumber/cucumber-js/contents/{+path}","compare_url":"https://api.github.com/repos/cucumber/cucumber-js/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cucumber/cucumber-js/merges","archive_url":"https://api.github.com/repos/cucumber/cucumber-js/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cucumber/cucumber-js/downloads","issues_url":"https://api.github.com/repos/cucumber/cucumber-js/issues{/number}","pulls_url":"https://api.github.com/repos/cucumber/cucumber-js/pulls{/number}","milestones_url":"https://api.github.com/repos/cucumber/cucumber-js/milestones{/number}","notifications_url":"https://api.github.com/repos/cucumber/cucumber-js/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cucumber/cucumber-js/labels{/name}","releases_url":"https://api.github.com/repos/cucumber/cucumber-js/releases{/id}","deployments_url":"https://api.github.com/repos/cucumber/cucumber-js/deployments","created_at":"2011-05-27T21:27:17Z","updated_at":"2016-08-31T15:33:40Z","pushed_at":"2016-08-31T15:09:17Z","git_url":"git://github.com/cucumber/cucumber-js.git","ssh_url":"git@github.com:cucumber/cucumber-js.git","clone_url":"https://github.com/cucumber/cucumber-js.git","svn_url":"https://github.com/cucumber/cucumber-js","homepage":"https://cucumber.io/docs/reference/javascript","size":16972,"stargazers_count":2191,"watchers_count":2191,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":380,"mirror_url":null,"open_issues_count":30,"forks":380,"open_issues":30,"watchers":2191,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cucumber/cucumber-js/pulls/605"},"html":{"href":"https://github.com/cucumber/cucumber-js/pull/605"},"issue":{"href":"https://api.github.com/repos/cucumber/cucumber-js/issues/605"},"comments":{"href":"https://api.github.com/repos/cucumber/cucumber-js/issues/605/comments"},"review_comments":{"href":"https://api.github.com/repos/cucumber/cucumber-js/pulls/605/comments"},"review_comment":{"href":"https://api.github.com/repos/cucumber/cucumber-js/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cucumber/cucumber-js/pulls/605/commits"},"statuses":{"href":"https://api.github.com/repos/cucumber/cucumber-js/statuses/8dd94a5d0c694f20c3a5521020cc4faaf0e02485"}}}}
{"actor":{"display_login":"charlierudolph"}}