Skip to content

Instantly share code, notes, and snippets.

@dawidnawrot
Created October 11, 2018 08:32
Show Gist options
  • Save dawidnawrot/6fe27c7279ed4f0438230e0c8d8e1add to your computer and use it in GitHub Desktop.
Save dawidnawrot/6fe27c7279ed4f0438230e0c8d8e1add to your computer and use it in GitHub Desktop.
# test name: "User gets auto generated id | Tags: (tag-sol3-000;tag-user)"
# branch name: "sol3-000-branch-description(tag-sol3-000;tag-user)"
# Get branch name.
branch=$(git branch | sed -n -e 's/^\* \(.*\)/\1/p')
# Extract tags.
tags=$(echo "$branch" | sed -e "s/[^(]*//" | sed -e "s/[)(]//g")
# If no tags attached then exit.
if [ ${#tags} -eq 0 ]; then
echo "No testing tags attached to branch name."
exit 2
fi
# Tags array to pass to ava.
tags_array="$(echo "${tags}" | tr ';' "\n")"
while read -r line; do
match=$match"--match ""*$line*"" "
done <<< "$tags_array"
# Exec tagged tests.
exec < /dev/tty
if ! lando yarn ava $match --verbose ; then
echo "Commit not added"
exit 2
fi
@gmahe
Copy link

gmahe commented Oct 11, 2018

I think it would be better in the pre-push, commit is not mean't to be the final version of what you push and some tests won't pass it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment