#!/usr/bin/env bash # The path list in cypress-changes.sh is the whole gate: drop an alternative # and the Cypress suite silently stops running for a class of change, with a # green job that just finished sooner. These cases pin the list to what the # suite actually reads, and run in the build job on every pull request. # # Run by hand: bash .gitea/scripts/tests/cypress-changes.test.sh set -uo pipefail here="$(cd "$(dirname "$0")" && pwd)" matcher="$here/../cypress-changes.sh" fails=0 check() { # ... local want="$1" got shift got=$(printf '%s\n' "$@" | bash "$matcher" --match) if [ "$got" != "$want" ]; then echo "FAIL: expected $want for: $*" echo " got: $got" fails=$((fails + 1)) fi } # Everything the Cypress job reads: the client it drives, the mock estate it # deploys, the CLI pin it installs, the scripts that decide what it runs, and # the dependency/workflow files that change the first two. check true client/src/app/app.component.ts check true sas/mocks/sasjs/services/admin/makedata.js check true sas/mocks/sasjs/services/admin/createdemodata.js check true sas/package.json check true .gitea/scripts/cypress-specs.sh check true package-lock.json check true .gitea/workflows/build.yaml # Not inputs: a sas/ service the mock estate does not deploy, documentation, # another workflow (only build.yaml decides what these jobs run), an unrelated # directory whose name starts with "client", and the sas lockfile (the job # installs the CLI by version string, so the lockfile cannot change what it # resolves). check false sas/macros/mp_abort.sas check false AGENTS.md check false docs/readme.md check false .gitea/workflows/release.yaml check false clientx/foo.ts check false sas/package-lock.json # The mock tree's own tests are not deployed, so a pull request that changes # only them cannot change what the browser is served. A change that touches # them next to a service still counts. check false sas/mocks/test/sas9-separators.test.js check false sas/mocks/test/sasjs-webout.test.js check true sas/mocks/test/sas9-separators.test.js sas/mocks/sasjs/services/x.js check true sas/mocks/sas9/sasjs/services/editors/getdata.js if [ "$fails" -ne 0 ]; then echo "cypress-changes matcher: $fails case(s) failed" exit 1 fi echo "cypress-changes matcher: all cases passed"