Skip to content

Instantly share code, notes, and snippets.

@lencioni
Last active May 31, 2016 21:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lencioni/15268e67a4b9a08f6cb1921f1169e06e to your computer and use it in GitHub Desktop.
Save lencioni/15268e67a4b9a08f6cb1921f1169e06e to your computer and use it in GitHub Desktop.
Count the number of JavaScript tests in a git repo every day
#!/bin/bash
echo '"days ago","tests"' > testCounts.csv
for i in $(seq 1 365);
do
git checkout "$(git rev-list -n 1 --before="$i days ago" origin/master)"
matches=$(\
find spec/javascripts -name "*.js" -o -name "*.jsx" | \
xargs ag --stats "it\(" | \
ag "^\d+\ matches" | \
cut -d " " -f1 \
)
echo "$i,$matches" >> testCounts.csv
done
git checkout master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment