Last active
May 19, 2021 14:57
-
-
Save odlp/25a7813e7e58ae49c2b6563425c3de23 to your computer and use it in GitHub Desktop.
Percentage error output in tests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Save stdout & stderr to individual files: | |
bundle exec rspec > >(tee stdout.log) 2> >(tee stderr.log >&2) | |
# Calculate the percentage: | |
wc -l stderr.log stdout.log \ | |
| ruby -e \ | |
'err, _, total = ARGF.map(&:to_f); puts "#{(err/total*100).round}% error output"' | |
# => XX% error output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment