Commit f6265ca0 authored by Matthieu Lamalle's avatar Matthieu Lamalle
Browse files

Set script pre-commit to run tests only on branch develop and merge

parent 3d8098f0
......@@ -5,16 +5,17 @@ set -e
export PATH=$PATH:node_modules/.bin
function lint_js_files {
local js_files=$(git diff --cached --name-only --diff-filter=ACM -- '*.js')
if [ ! -z "$js_files" ]; then
eslint $js_files
fi
branch_name=$(git symbolic-ref -q HEAD)
branch_name=${branch_name##refs/heads/}
branch_name=${branch_name:-HEAD}
if [ $branch_name = "develop" ] || [ "$1" = "merge" ]; then
local js_files=$(git diff --cached --name-only --diff-filter=ACM -- '*.js')
if [ ! -z "$js_files" ]; then
eslint $js_files
fi
CI=true npm run test
fi
}
lint_js_files
CI=true npm run test
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment