{"action":"created","issue":{"url":"https://api.github.com/repos/Olivine-Labs/busted/issues/381","labels_url":"https://api.github.com/repos/Olivine-Labs/busted/issues/381/labels{/name}","comments_url":"https://api.github.com/repos/Olivine-Labs/busted/issues/381/comments","events_url":"https://api.github.com/repos/Olivine-Labs/busted/issues/381/events","html_url":"https://github.com/Olivine-Labs/busted/issues/381","id":61628572,"number":381,"title":"assert.has.no.errors() throws away tracebacks","user":{"login":"Alloyed","id":137977,"avatar_url":"https://avatars.githubusercontent.com/u/137977?v=3","gravatar_id":"","url":"https://api.github.com/users/Alloyed","html_url":"https://github.com/Alloyed","followers_url":"https://api.github.com/users/Alloyed/followers","following_url":"https://api.github.com/users/Alloyed/following{/other_user}","gists_url":"https://api.github.com/users/Alloyed/gists{/gist_id}","starred_url":"https://api.github.com/users/Alloyed/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Alloyed/subscriptions","organizations_url":"https://api.github.com/users/Alloyed/orgs","repos_url":"https://api.github.com/users/Alloyed/repos","events_url":"https://api.github.com/users/Alloyed/events{/privacy}","received_events_url":"https://api.github.com/users/Alloyed/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-03-14T15:35:20Z","updated_at":"2015-03-15T03:22:14Z","closed_at":null,"body":"When running busted in verbose mode, an error caught in a assert.has.no.errors() block will discard the useful part of the traceback, returning only the direct error message. Example:\r\n```\r\n./spec/let_spec.lua:14: Expected no error, but caught:\r\n(string) './core/gen.lua:47: attempt to index local 'expr' (a nil value)'\r\n\r\nstack traceback:\r\n\t./spec/let_spec.lua:14: in function <./spec/let_spec.lua:13>\r\n```\r\nWhen the same code is run outside of an assert I get this back, instead:\r\n```\r\n./core/gen.lua:47: attempt to index local 'expr' (a nil value)\r\n\r\nstack traceback:\r\n\t./core/gen.lua:47: in function 'gen'\r\n\t./core/builtins.lua:15: in function 'defval'\r\n\t./core/builtins.lua:57: in function <./core/builtins.lua:52>\r\n\t(...tail calls...)\r\n\t./core/gen.lua:52: in function 'gen'\r\n\t./core/gen.lua:42: in function 'exprlist'\r\n\t./core/gen.lua:50: in function 'gen'\r\n\t./spec/let_spec.lua:6: in function 'run'\r\n\t./spec/let_spec.lua:14: in function <./spec/let_spec.lua:13>\r\n\t...\r\n```"},"comment":{"url":"https://api.github.com/repos/Olivine-Labs/busted/issues/comments/80819688","html_url":"https://github.com/Olivine-Labs/busted/issues/381#issuecomment-80819688","issue_url":"https://api.github.com/repos/Olivine-Labs/busted/issues/381","id":80819688,"user":{"login":"o-lim","id":10095424,"avatar_url":"https://avatars.githubusercontent.com/u/10095424?v=3","gravatar_id":"","url":"https://api.github.com/users/o-lim","html_url":"https://github.com/o-lim","followers_url":"https://api.github.com/users/o-lim/followers","following_url":"https://api.github.com/users/o-lim/following{/other_user}","gists_url":"https://api.github.com/users/o-lim/gists{/gist_id}","starred_url":"https://api.github.com/users/o-lim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/o-lim/subscriptions","organizations_url":"https://api.github.com/users/o-lim/orgs","repos_url":"https://api.github.com/users/o-lim/repos","events_url":"https://api.github.com/users/o-lim/events{/privacy}","received_events_url":"https://api.github.com/users/o-lim/received_events","type":"User","site_admin":false},"created_at":"2015-03-15T03:22:14Z","updated_at":"2015-03-15T03:22:14Z","body":"I don't see a problem here.  It looks like everything is behaving as it should.  You have an assert hat failed at `./spec/let_spec.lua:14`, and that is what is reported to you at the beginning of the traceback.  Your assert is `assert.has.no.errors` which failed, and was caught by busted.  It doesn't look like busted is discarding anything.  The traceback you are interested in is just not available to busted because it was caught by the assert.\r\n\r\nThe traceback you are getting is consistent with every other traceback resulting from an assert.  If you put `assert.is_true(false)` at `./spec/let_spec.lua:14`, you would get the exact same traceback.  The traceback is telling you where the `assert` failed, it's not going give you any information as to why it failed.\r\n\r\nWhen you remove the assert, you get the full trackback because an unexpected error occurred while running your test and busted is reporting the traceback of that error.  When you wrap it with an `assert.has.no.errors`, you are telling busted to verify that the function does not throw an error.  When this check fails, your test has failed, so busted reports the call-site of the failure, which occurred at `./spec/let_spec:14`.\r\n\r\nI understand your dilemma, but I it looks like everything is behaving as I would expected.  The original trackback is simple not available due to the nature of `assert.has.no.errors`.  The assert caches any error and compares it to any expected error object, then throws a new error if they do not match.  I don't think there is any way to preserve the original stack trace in Lua.  Perhaps one option is to append the original stack trace to the error message reported by `assert.has.no.errors`, which would be a change to luassert, not busted.\r\n"}}