-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Print todo and skip descriptions when in verbose mode #8038
Print todo and skip descriptions when in verbose mode #8038
Conversation
summedTests.todo.forEach(todoTest => { | ||
this._logTodoTest( | ||
'todo', | ||
this._getIcon('todo'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems silly to pass in the icons and title, but I see it's consistent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup. Didn't want to stray too far from what was being done. The same could be said for printing skipped tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think given that we are explicitly pulling this behaviour out into _logTodoTest
we should just move the concrete data into the function definition.
private _logTodoTest(
todoTest: TestResult.AssertionResult,
indentLevel: number,
) {
const text = chalk.dim(`todo ${todoTest.title}`);
this._logLine(`${this._getIcon('todo')} ${text}`, indentLevel);
}
Then if you want to be fancy you could curry this to:
private _logTodoTest = (indentLevel: number) => (todoTest: TestResult.AssertionResult) => {
const text = chalk.dim(`todo ${todoTest.title}`);
this._logLine(`${this._getIcon('todo')} ${text}`, indentLevel);
}
and then you can just do the following in the forEach
:
summedTests.todo.forEach(this._logTodoTest(indentLevel));
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this approach. Should we do a similar approach to skipped tests then since their functions are very similar?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Just missing changelog
I've just pushed in some changes where skipped tests get the same treatment as per the original PR. One thing to note is that I wrap the description in quotes now since some descriptions might be long. Edit: I'll revert adding the quotes since I just noticed that they're not there for passing tests as well |
Hey just following up. What else does this PR need to get merged? |
Nothing! |
I know this is merged/closed, but is there anyway to list just the todos? When you have a lot of tests then showing it in verbose will be kind of hard to pickup. |
We could probably pass an option to the reporter enabling this. Wanna open a PR? If not, please open up an issue |
I can pick this up. How would this work from a user’s point of view though? I imagine this would need another configuration option? |
Yeah, something like |
So I can foresee 2 things here.
That right? |
Default to showing it, I think? /cc @scotthovestadt @thymikee @jeysal @mattphillips |
@natealcedo Exactly! I wish to use test.todo to outline my future work load, and it would be a nice feature to be able to list only the todos. I'm working on a project with a ton of tests, and it's impossible to see what the todos are when the tests are running in verbose mode. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Prints the text in
test.todo
andtest.skip
calls when in verbose modeFixes #7999
Test plan
Added some integration integration tests under testTodo