Skip to content
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

Don't group slow tests #35

Merged
merged 2 commits into from
Apr 11, 2019
Merged

Conversation

egonelbre
Copy link
Contributor

This allows -slow 5 to limit output to only 5 slowest tests, or -slow -1 to all slowest tests.

Fixes #34

@mfridman
Copy link
Owner

Thank you for submitting a PR. 🎉

I think you're right, more often users would want n number of slowest tests regardless of pkg, so let's give this a try.


I think in the future it'd be nice to consolidate the logic, e.g.,

  • sort pkgs by name
  • iterate over pkg and add skipped/passed (depending on options)
  • sort passed by time
  • add skipped and passed to a var all []*test

then check if slow is available and do some logic relating to that, otherwise iterate over all and add "line break" whenever pkg changes.

main.go Outdated
return passed[i].Elapsed() > passed[j].Elapsed()
})
for _, pkg := range sp {
numScanned++
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need this within this loop.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@egonelbre
Copy link
Contributor Author

For consolidating logic, I was trying to avoid too large refactoring since you have the path towards v1 issue.

@mfridman
Copy link
Owner

Awesome. Thanks for contribution.

@mfridman mfridman merged commit 76a0846 into mfridman:master Apr 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't group tests by package when using -slow
2 participants