Skip to content
Snippets Groups Projects
Commit a814ad2a authored by Doug Ayers's avatar Doug Ayers
Browse files

add test reports and code coverage

parent 180167b6
No related branches found
No related tags found
No related merge requests found
...@@ -122,6 +122,11 @@ test-apex: ...@@ -122,6 +122,11 @@ test-apex:
- scratch_org_auth_url=$(cat SCRATCH_ORG_AUTH_URL.txt) - scratch_org_auth_url=$(cat SCRATCH_ORG_AUTH_URL.txt)
- authenticate $scratch_org_username $scratch_org_auth_url - authenticate $scratch_org_username $scratch_org_auth_url
- test_scratch_org $scratch_org_username - test_scratch_org $scratch_org_username
artifacts:
reports:
junit: tests/apex/*-junit.xml
coverage: '/name="testRunCoverage" value="([\d]+%)"/'
#################################################### ####################################################
...@@ -374,13 +379,17 @@ deploy-production: ...@@ -374,13 +379,17 @@ deploy-production:
npm init -y npm init -y
fi fi
# Make directory to output test results
# https://gitlab.com/help/ci/yaml/README.md#artifactsreports
mkdir -p ./tests/apex
# Check if the scripts property in package.json contains key for "test:scratch" # Check if the scripts property in package.json contains key for "test:scratch"
local scriptValue=$(jq -r '.scripts["test:scratch"]' < package.json) local scriptValue=$(jq -r '.scripts["test:scratch"]' < package.json)
# If no "test:scratch" script property, then add one # If no "test:scratch" script property, then add one
if [[ -z "$scriptValue" || $scriptValue == null ]]; then if [[ -z "$scriptValue" || $scriptValue == null ]]; then
local tmp=$(mktemp) local tmp=$(mktemp)
jq '.scripts["test:scratch"]="sfdx force:apex:test:run --codecoverage --resultformat human --wait 10"' package.json > $tmp jq '.scripts["test:scratch"]="sfdx force:apex:test:run --codecoverage --resultformat junit --wait 10 --outputdir ./tests/apex"' package.json > $tmp
mv $tmp package.json mv $tmp package.json
echo "added test:scratch script property to package.json" >&2 echo "added test:scratch script property to package.json" >&2
cat package.json >&2 cat package.json >&2
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment