{"action":"created","issue":{"url":"https://api.github.com/repos/kotlintest/kotlintest/issues/369","repository_url":"https://api.github.com/repos/kotlintest/kotlintest","labels_url":"https://api.github.com/repos/kotlintest/kotlintest/issues/369/labels{/name}","comments_url":"https://api.github.com/repos/kotlintest/kotlintest/issues/369/comments","events_url":"https://api.github.com/repos/kotlintest/kotlintest/issues/369/events","html_url":"https://github.com/kotlintest/kotlintest/pull/369","id":335571111,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk3MjM4NDgz","number":369,"title":"Remove matcher frames from stacktraces","user":{"login":"ajalt","id":1109214,"node_id":"MDQ6VXNlcjExMDkyMTQ=","avatar_url":"https://avatars2.githubusercontent.com/u/1109214?v=4","gravatar_id":"","url":"https://api.github.com/users/ajalt","html_url":"https://github.com/ajalt","followers_url":"https://api.github.com/users/ajalt/followers","following_url":"https://api.github.com/users/ajalt/following{/other_user}","gists_url":"https://api.github.com/users/ajalt/gists{/gist_id}","starred_url":"https://api.github.com/users/ajalt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajalt/subscriptions","organizations_url":"https://api.github.com/users/ajalt/orgs","repos_url":"https://api.github.com/users/ajalt/repos","events_url":"https://api.github.com/users/ajalt/events{/privacy}","received_events_url":"https://api.github.com/users/ajalt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-06-25T21:16:53Z","updated_at":"2018-06-25T21:32:34Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/kotlintest/kotlintest/pulls/369","html_url":"https://github.com/kotlintest/kotlintest/pull/369","diff_url":"https://github.com/kotlintest/kotlintest/pull/369.diff","patch_url":"https://github.com/kotlintest/kotlintest/pull/369.patch"},"body":"Currently when an assertion fails, the error's stack trace starts witha number of frames of internal kotlintest functions. #366 makes this even worse by adding several frames of reflection calls.\r\n\r\nUser's just want to see the line in their test that caused the failure, so this PR removes kotlintest frames off of the top of the stack in the `AssertionErrors` that it creates. This puts the user's code at the top of the stack. It does not remove frames associated with the kotlintest runner, since these occur below user code.\r\n\r\nCurrent behavior:\r\n\r\n```\r\norg.opentest4j.AssertionFailedError: expected: true but was: false\r\n    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)\r\n    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)\r\n    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)\r\n    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)\r\n    at io.kotlintest.DslKt.callPublicConstructor(dsl.kt:184)\r\n    at io.kotlintest.DslKt.junit5assertionFailedError(dsl.kt:161)\r\n    at io.kotlintest.DslKt.equalsError(dsl.kt:148)\r\n    at io.kotlintest.DslKt.shouldBe(dsl.kt:49)\r\n    at com.example.MyTest.myTest(MyTest.kt:21)\r\n    at io.kotlintest.runner.jvm.TestCaseExecutor$executeTestSet$1.run(TestCaseExecutor.kt:96)\r\n    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\r\n    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\r\n    at java.lang.Thread.run(Thread.java:748)\r\n```\r\n\r\nBehavior with this PR:\r\n\r\n```\r\norg.opentest4j.AssertionFailedError: expected: true but was: false\r\n    at com.example.MyTest.myTest(MyTest.kt:21)\r\n    at io.kotlintest.runner.jvm.TestCaseExecutor$executeTestSet$1.run(TestCaseExecutor.kt:96)\r\n    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)\r\n    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)\r\n    at java.lang.Thread.run(Thread.java:748)\r\n```\r\nUsers can turn this behavior off and see the full stack trace by setting `Failures.shouldRemoveKotlintestElementsFromStacktrace = false`."},"comment":{"url":"https://api.github.com/repos/kotlintest/kotlintest/issues/comments/400102769","html_url":"https://github.com/kotlintest/kotlintest/pull/369#issuecomment-400102769","issue_url":"https://api.github.com/repos/kotlintest/kotlintest/issues/369","id":400102769,"node_id":"MDEyOklzc3VlQ29tbWVudDQwMDEwMjc2OQ==","user":{"login":"sksamuel","id":743706,"node_id":"MDQ6VXNlcjc0MzcwNg==","avatar_url":"https://avatars3.githubusercontent.com/u/743706?v=4","gravatar_id":"","url":"https://api.github.com/users/sksamuel","html_url":"https://github.com/sksamuel","followers_url":"https://api.github.com/users/sksamuel/followers","following_url":"https://api.github.com/users/sksamuel/following{/other_user}","gists_url":"https://api.github.com/users/sksamuel/gists{/gist_id}","starred_url":"https://api.github.com/users/sksamuel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sksamuel/subscriptions","organizations_url":"https://api.github.com/users/sksamuel/orgs","repos_url":"https://api.github.com/users/sksamuel/repos","events_url":"https://api.github.com/users/sksamuel/events{/privacy}","received_events_url":"https://api.github.com/users/sksamuel/received_events","type":"User","site_admin":false},"created_at":"2018-06-25T21:32:34Z","updated_at":"2018-06-25T21:32:34Z","author_association":"MEMBER","body":"More nice work. The only comment would be to have the flag to disable this as part of the Project class, which will read from either a system property `kotlintest.failure.stack.truncated=false` or something in addition to a var inside the ProjectConfig."}}
{"actor":{"display_login":"sksamuel"}}