{"action":"created","issue":{"url":"https://api.github.com/repos/avajs/ava/issues/891","repository_url":"https://api.github.com/repos/avajs/ava","labels_url":"https://api.github.com/repos/avajs/ava/issues/891/labels{/name}","comments_url":"https://api.github.com/repos/avajs/ava/issues/891/comments","events_url":"https://api.github.com/repos/avajs/ava/issues/891/events","html_url":"https://github.com/avajs/ava/issues/891","id":157606859,"number":891,"title":"Improve failure output","user":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"sotojuan","id":8217766,"avatar_url":"https://avatars.githubusercontent.com/u/8217766?v=3","gravatar_id":"","url":"https://api.github.com/users/sotojuan","html_url":"https://github.com/sotojuan","followers_url":"https://api.github.com/users/sotojuan/followers","following_url":"https://api.github.com/users/sotojuan/following{/other_user}","gists_url":"https://api.github.com/users/sotojuan/gists{/gist_id}","starred_url":"https://api.github.com/users/sotojuan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sotojuan/subscriptions","organizations_url":"https://api.github.com/users/sotojuan/orgs","repos_url":"https://api.github.com/users/sotojuan/repos","events_url":"https://api.github.com/users/sotojuan/events{/privacy}","received_events_url":"https://api.github.com/users/sotojuan/received_events","type":"User","site_admin":false},"milestone":null,"comments":7,"created_at":"2016-05-31T07:30:51Z","updated_at":"2016-06-03T08:01:53Z","closed_at":null,"body":"With the following:\r\n\r\n```js\r\n'use strict';\r\nmodule.exports = function () {\r\n\tthrow new Error('foo');\r\n};\r\n```\r\n\r\n```js\r\nimport test from 'ava';\r\nimport fn from './';\r\n\r\ntest('unicorn', t => {\r\n\tt.true(fn());\r\n});\r\n\r\ntest('rainbow', t => {\r\n\tt.fail();\r\n});\r\n```\r\n\r\nI get the following using the default reporter:\r\n\r\n<img width=\"367\" alt=\"screen shot 2016-05-31 at 14 11 11\" src=\"https://cloud.githubusercontent.com/assets/170270/15666409/f1316506-273a-11e6-8f7b-8c77d10284bb.png\">\r\n\r\nThe current output is a bit messy and ambiguous. For example the stack trace indent is different for the two lines.\r\n\r\nI've done a quick mockup of what I'd like it to look like:\r\n\r\n<img width=\"334\" alt=\"screen shot 2016-05-31 at 14 18 29\" src=\"https://cloud.githubusercontent.com/assets/170270/15666421/02fd78ba-273b-11e6-9663-b067f30ede2b.png\">\r\n\r\nNote that I reduced the indent of `2 failed` from 3 to 2 spaces. And I changed `failed with \"foo\"` to `Error: foo` to make it clear it failed with an error and what type of error. Could be a ReferenceError for example which would be lost in the previous output.\r\n\r\nHappy to improve upon it. I want our failure output to be as readable as possible.\r\n\r\n\r\nHere's what I used to generate the mockup:\r\n\r\n```js\r\nconst chalk = require('chalk');\r\n\r\nconsole.log(`\r\n  ${chalk.red('2 failed')}\r\n\r\n  unicorn\r\n  ${chalk.red('Error: foo')}\r\n   ${chalk.dim('module.exports (index.js:3:8)')}\r\n   ${chalk.dim('Test.fn (test.js:5:9)')}\r\n\r\n  rainbow\r\n  ${chalk.red('Test failed via t.fail()')}\r\n   ${chalk.dim('Test.fn (test.js:9:4)')}`);\r\n```\r\n\r\n-\r\n\r\nThoughts?\r\n\r\nIs there a way we could improve the `Test.fn` name in the stack trace?\r\n\r\nShould we place the filename:line:column first? Usually the function name isn't very useful, so it's usually the line:column you care about."},"comment":{"url":"https://api.github.com/repos/avajs/ava/issues/comments/223515944","html_url":"https://github.com/avajs/ava/issues/891#issuecomment-223515944","issue_url":"https://api.github.com/repos/avajs/ava/issues/891","id":223515944,"user":{"login":"sindresorhus","id":170270,"avatar_url":"https://avatars.githubusercontent.com/u/170270?v=3","gravatar_id":"","url":"https://api.github.com/users/sindresorhus","html_url":"https://github.com/sindresorhus","followers_url":"https://api.github.com/users/sindresorhus/followers","following_url":"https://api.github.com/users/sindresorhus/following{/other_user}","gists_url":"https://api.github.com/users/sindresorhus/gists{/gist_id}","starred_url":"https://api.github.com/users/sindresorhus/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sindresorhus/subscriptions","organizations_url":"https://api.github.com/users/sindresorhus/orgs","repos_url":"https://api.github.com/users/sindresorhus/repos","events_url":"https://api.github.com/users/sindresorhus/events{/privacy}","received_events_url":"https://api.github.com/users/sindresorhus/received_events","type":"User","site_admin":false},"created_at":"2016-06-03T08:01:52Z","updated_at":"2016-06-03T08:01:52Z","body":"@sotojuan Yes, if they have output, they should be in this style."}}
{"actor":{"display_login":"sindresorhus"}}