Skip to content

Commit

Permalink
Merge pull request #11 from newfold-labs/add/check-module-has-Cypress…
Browse files Browse the repository at this point in the history
…-tests-before-running-them

In its own step, determine if no module Cypress tests found
  • Loading branch information
BrianHenryIE authored May 9, 2024
2 parents 1de12fd + 1215103 commit 0b9ab9c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion .github/workflows/module-plugin-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -228,8 +228,15 @@ jobs:
- name: Install WordPress
run: npx @wordpress/env@latest start --debug

- name: Check for module tests
id: check-for-module-tests
run:
if [[ $(find ./vendor/${{ inputs.module-repo }} -depth -name '*.cy*') ]]; then MODULE_TESTS_FOUND=1; else MODULE_TESTS_FOUND=0; fi
if [[ $MODULE_TESTS_FOUND -eq 0 ]]; then echo "No module Cypress tests found"; fi
echo "MODULE_TESTS_FOUND=$MODULE_TESTS_FOUND" >> $GITHUB_OUTPUT;

- name: Run Module Cypress Tests
if: $([[ ! $(find ./vendor/${{ inputs.module-repo }} -depth -name '*.cy*') ]])
if: ${{ steps.check-for-module-tests.outputs.MODULE_TESTS_FOUND }}
run: npm run test:e2e -- --browser chrome --spec "vendor/(${{ inputs.module-repo }}/**/*.cy.js)"

- name: Run Remaining Cypress Tests
Expand Down

0 comments on commit 0b9ab9c

Please sign in to comment.