Merge pull request #1094 from dod-ccpo/test-changes
updates to script/test and JS coverage
This commit is contained in:
commit
ae57baf455
@ -15,7 +15,7 @@
|
||||
<div class="card__title">
|
||||
<span class="h4" v-html='clinTitle'></span>
|
||||
<button
|
||||
v-if='$parent.clinIndex > 0'
|
||||
v-if='clinIndex > 0'
|
||||
class="icon-link icon-link__remove-clin"
|
||||
v-on:click="openModal(removeModalId)"
|
||||
type="button">
|
||||
|
@ -60,7 +60,7 @@
|
||||
<div class="clin-card" v-if="showClin">
|
||||
<div class="card__title">
|
||||
<span class="h4" v-html="clinTitle"></span>
|
||||
<button class="icon-link icon-link__remove-clin" type="button" v-if="$parent.clinIndex > 0" v-on:click="openModal(removeModalId)">
|
||||
<button class="icon-link icon-link__remove-clin" type="button" v-if="clinIndex > 0" v-on:click="openModal(removeModalId)">
|
||||
<span aria-hidden="true" class="icon icon--x"><svg viewbox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M2 2l12 12M14 15c-.256 0-.512-.098-.707-.293l-12-12c-.391-.391-.391-1.023 0-1.414s1.023-.391 1.414 0l12 12c.391.391.391 1.023 0 1.414-.195.195-.451.293-.707.293zm0-13L2 14"></path><path d="M2 15c-.256 0-.512-.098-.707-.293-.391-.391-.391-1.023 0-1.414l12-12c.391-.391 1.023-.391 1.414 0s.391 1.023 0 1.414l-12 12C2.512 14.902 2.256 15 2 15z"></path></svg>
|
||||
</span>
|
||||
</button>
|
||||
@ -192,7 +192,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div class="h5 clin-card__title">Percent Obligated</div>
|
||||
<p v-html="percentObligated"></p>
|
||||
<p id="percent-obligated" v-html="percentObligated"></p>
|
||||
<hr/>
|
||||
<div class="form-row">
|
||||
<div class="h4 clin-card__title">
|
||||
|
@ -7,7 +7,7 @@
|
||||
"watch": "parcel watch js/index.js -d static/assets --public-url /static/assets -o index.js --no-autoinstall",
|
||||
"build": "parcel build js/index.js -d static/assets --public-url /static/assets -o index.js",
|
||||
"test": "jest",
|
||||
"test:coverage": "jest --coverage",
|
||||
"test:coverage": "jest --coverage --collectCoverageFrom='js/**/*.js'",
|
||||
"test:watch": "jest --watch --no-cache"
|
||||
},
|
||||
"author": "",
|
||||
|
@ -40,4 +40,5 @@ def main(arg):
|
||||
|
||||
if __name__ == "__main__":
|
||||
arg = sys.argv[1] if len(sys.argv) > 1 else None
|
||||
print("Finished scanning for secrets")
|
||||
sys.exit(main(arg))
|
||||
|
@ -53,3 +53,19 @@ reset_db() {
|
||||
# Seed database data
|
||||
seed_db
|
||||
}
|
||||
|
||||
output_divider() {
|
||||
if tty -s; then
|
||||
echo "$( tput bold )$( tput smul )$( tput setaf 6 )${1}$( tput sgr 0)"
|
||||
else
|
||||
echo $1
|
||||
fi
|
||||
}
|
||||
|
||||
warning() {
|
||||
if tty -s; then
|
||||
echo "$( tput bold )$( tput setaf 1 )${1}$( tput sgr 0)"
|
||||
else
|
||||
echo $1
|
||||
fi
|
||||
}
|
||||
|
@ -15,12 +15,12 @@ if [ "${RESET_DB}" = "true" ]; then
|
||||
source ./script/get_db_settings
|
||||
|
||||
if [ -n "${PGDATABASE}" ]; then
|
||||
echo "Resetting database ${PGDATABASE}..."
|
||||
output_divider "Reset database ${PGDATABASE}"
|
||||
# Reset the db
|
||||
reset_db "${PGDATABASE}"
|
||||
else
|
||||
echo "ERROR: RESET_DB is set, but PGDATABASE is not!"
|
||||
echo "Skipping database reset..."
|
||||
warning "warning: RESET_DB is set, but PGDATABASE is not!"
|
||||
warning "Skipping database reset..."
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -29,15 +29,18 @@ if [ "${RUN_PYTHON_TESTS}" = "true" ]; then
|
||||
python_test_status=0
|
||||
set +e
|
||||
|
||||
output_divider "Lint Python files"
|
||||
run_python_lint "${PYTHON_FILES}"
|
||||
((python_test_status+=$?))
|
||||
output_divider "Perform static analysis on Python files"
|
||||
run_python_static_analysis "${PYTHON_FILES}"
|
||||
((python_test_status+=$?))
|
||||
output_divider "Run Python unit test suite"
|
||||
run_python_unit_tests "${PYTHON_FILES}"
|
||||
((python_test_status+=$?))
|
||||
|
||||
if [ "${python_test_status}" != "0" ]; then
|
||||
echo "Failed to pass one or more Python checks"
|
||||
warning "Failed to pass one or more Python checks"
|
||||
exit ${python_test_status}
|
||||
fi
|
||||
|
||||
@ -45,5 +48,8 @@ if [ "${RUN_PYTHON_TESTS}" = "true" ]; then
|
||||
fi
|
||||
|
||||
if [ "${RUN_JS_TESTS}" = "true" ]; then
|
||||
output_divider "Render Vue components"
|
||||
run_python_render_vue_component
|
||||
output_divider "Run JavaScript unit test suite"
|
||||
run_javascript_tests
|
||||
fi
|
||||
|
@ -19,6 +19,11 @@ run_python_unit_tests() {
|
||||
return $?
|
||||
}
|
||||
|
||||
run_python_render_vue_component() {
|
||||
run_command "python -m pytest tests/render_vue_component.py --no-cov --no-print-logs --tb=no -q --disable-warnings"
|
||||
return $?
|
||||
}
|
||||
|
||||
run_javascript_tests() {
|
||||
run_command "yarn test:coverage"
|
||||
return $?
|
||||
|
@ -6,9 +6,6 @@ source "$(dirname "${0}")"/../script/include/global_header.inc.sh
|
||||
|
||||
export FLASK_ENV=test
|
||||
|
||||
# create upload directory for app
|
||||
mkdir uploads | true
|
||||
|
||||
# Enable database resetting
|
||||
RESET_DB="true"
|
||||
|
||||
@ -22,9 +19,11 @@ RUN_PYTHON_TESTS="true"
|
||||
RUN_JS_TESTS="true"
|
||||
|
||||
# Check python formatting
|
||||
output_divider "Run formatting check"
|
||||
source ./script/format check
|
||||
|
||||
# Check for secrets
|
||||
output_divider "Run detect secrets"
|
||||
./script/detect_secrets
|
||||
|
||||
# Run the shared test script
|
||||
|
Loading…
x
Reference in New Issue
Block a user