Created
February 6, 2024 14:23
-
-
Save defaye/f664353bfbd0c08707925a03a81b2ccb to your computer and use it in GitHub Desktop.
open code coverage report
This file contains 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
open_coverage_report() { | |
# Find the coverage/index.html file, excluding node_modules and prioritizing higher-level directories | |
local file=$(find . -type d -name "node_modules" -prune -o -type f -name "index.html" -path "*/coverage/*" -print | head -n 1) | |
# Check if the file was found | |
if [[ -n "$file" ]]; then | |
# Open the file in the default browser or Firefox if the default is not set | |
open -a "Firefox" "$file" || open "$file" | |
else | |
echo "No coverage/index.html file found in the current directory or its subdirectories." | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment