-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
test_runner: expose location of tests #48975
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
|
@@ -31,13 +31,14 @@ async function * tapReporter(source) { | |||||||
yield `TAP version ${kDefaultTAPVersion}\n`; | ||||||||
for await (const { type, data } of source) { | ||||||||
switch (type) { | ||||||||
case 'test:fail': | ||||||||
case 'test:fail': { | ||||||||
yield reportTest(data.nesting, data.testNumber, 'not ok', data.name, data.skip, data.todo); | ||||||||
yield reportDetails(data.nesting, data.details); | ||||||||
const location = `${data.file}:${data.line}:${data.column}`; | ||||||||
yield reportDetails(data.nesting, data.details, location); | ||||||||
break; | ||||||||
case 'test:pass': | ||||||||
} case 'test:pass': | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I copied the existing style from this file (see line 57). I don't particularly like this style either though. Maybe we should add a lint rule in a separate change. |
||||||||
yield reportTest(data.nesting, data.testNumber, 'ok', data.name, data.skip, data.todo); | ||||||||
yield reportDetails(data.nesting, data.details); | ||||||||
yield reportDetails(data.nesting, data.details, null); | ||||||||
break; | ||||||||
case 'test:plan': | ||||||||
yield `${indent(data.nesting)}1..${data.count}\n`; | ||||||||
|
@@ -81,13 +82,18 @@ function reportTest(nesting, testNumber, status, name, skip, todo) { | |||||||
return line; | ||||||||
} | ||||||||
|
||||||||
function reportDetails(nesting, data = kEmptyObject) { | ||||||||
function reportDetails(nesting, data = kEmptyObject, location) { | ||||||||
const { error, duration_ms } = data; | ||||||||
const _indent = indent(nesting); | ||||||||
let details = `${_indent} ---\n`; | ||||||||
|
||||||||
details += jsToYaml(_indent, 'duration_ms', duration_ms); | ||||||||
details += jsToYaml(_indent, 'type', data.type); | ||||||||
|
||||||||
if (location) { | ||||||||
details += jsToYaml(_indent, 'location', location); | ||||||||
} | ||||||||
|
||||||||
details += jsToYaml(_indent, null, error, new SafeSet()); | ||||||||
details += `${_indent} ...\n`; | ||||||||
return details; | ||||||||
|
Uh oh!
There was an error while loading. Please reload this page.