Skip to content

Commit

Permalink
Added behat code coverage tool.
Browse files Browse the repository at this point in the history
  • Loading branch information
richardgaunt committed Mar 15, 2024
1 parent 52a3381 commit 3922aeb
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
16 changes: 15 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,20 @@ jobs:
name: Lint code with NPM linters
command: docker compose exec -T cli bash -c "npm run --prefix \${DREVOPS_WEBROOT}/themes/custom/\${DRUPAL_THEME} lint" || [ "${DREVOPS_CI_NPM_LINT_IGNORE_FAILURE:-0}" -eq 1 ]
- run:
<<<<<<< Updated upstream
=======
name: Provision site
command: |
if [ -f .data/db.sql ]; then
docker compose exec cli mkdir -p .data
docker compose cp -L .data/db.sql cli:/app/.data/db.sql
fi
docker compose exec $(env | cut -f1 -d= | sed 's/^/-e /') -T cli ./scripts/drevops/provision.sh
no_output_timeout: 30m
- run:
name: Restart server with Xdebug enabled
- run:
>>>>>>> Stashed changes
name: Test with PHPUnit
command: |
XDEBUG_ENABLE=true docker compose up -d cli php nginx # Restart stack with XDEBUG enabled for coverage.
Expand All @@ -349,7 +363,7 @@ jobs:
command: |
if [ "${CIRCLE_NODE_TOTAL:-1}" -gt 1 ]; then export DREVOPS_CI_BEHAT_PROFILE="${DREVOPS_CI_BEHAT_PROFILE:-p${CIRCLE_NODE_INDEX}}"; fi
echo "Running with ${DREVOPS_CI_BEHAT_PROFILE:-default} profile"
docker compose exec -T cli php -d memory_limit=-1 vendor/bin/behat --colors --strict --profile="${DREVOPS_CI_BEHAT_PROFILE:-default}" || \
docker compose exec -T -e XDEBUG_MODE=coverage cli php -d memory_limit=-1 vendor/bin/behat --colors --strict --profile="${DREVOPS_CI_BEHAT_PROFILE:-default}" || \
docker compose exec -T cli php -d memory_limit=-1 vendor/bin/behat --colors --strict --rerun --profile="${DREVOPS_CI_BEHAT_PROFILE:-default}" || \
[ "${DREVOPS_CI_BEHAT_IGNORE_FAILURE:-0}" -eq 1 ]
no_output_timeout: 30m
Expand Down
14 changes: 13 additions & 1 deletion behat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,19 @@ default:
purge: false # Change to 'true' (no quotes) to purge screenshots on each run.
# Show explicit fail information and continue the test run.
DrevOps\BehatFormatProgressFail\FormatExtension: ~

DVDoug\Behat\CodeCoverage\Extension:
filter:
include:
directories:
'src': ~
reports:
text:
showColors: true
showOnlySummary: true
html:
target: '%paths.base%/.logs/coverage/behat/.coverage-html'
cobertura:
target: 'paths.base%/.logs/coverage/behat/cobertura.xml'
# Profile for parallel testing.
# Runs all tests not tagged with "smoke" or "@p1" and not tagged with "@skipped".
p0:
Expand Down
4 changes: 4 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@
"drevops/behat-steps": "^2",
"drupal/core-dev": "^10.2.0",
"drupal/drupal-extension": "^5@rc",
<<<<<<< Updated upstream
"friendsoftwig/twigcs": "^6.2",
=======
"dvdoug/behat-code-coverage": "^5.3",
>>>>>>> Stashed changes
"mglaman/phpstan-drupal": "^1.2",
"palantirnet/drupal-rector": "^0.19",
"phpcompatibility/php-compatibility": "^9.3",
Expand Down

0 comments on commit 3922aeb

Please sign in to comment.