diff --git a/.github/workflows/cypress.yml b/.github/workflows/cypress.yml index 478b7b9..d506c84 100644 --- a/.github/workflows/cypress.yml +++ b/.github/workflows/cypress.yml @@ -27,7 +27,22 @@ jobs: run: | cd docs bundle exec jekyll build - - name: Run Cypress tests - run: yarn run cypress:ci - env: - NODE_NO_WARNINGS: 1 \ No newline at end of file + - name: Run Cypress (start Jekyll, run tests, kill Jekyll) + shell: bash + run: | + set -o pipefail + node scripts/start-jekyll.js & + JEKYLL_PID=$! + + sleep 8 + + yarn cypress run + CYPRESS_EXIT_CODE=$? + + node scripts/kill-jekyll.js || true + + if kill -0 $JEKYLL_PID 2>/dev/null; then + kill $JEKYLL_PID || true + fi + + exit $CYPRESS_EXIT_CODE \ No newline at end of file diff --git a/package.json b/package.json index 283870e..05943a6 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,8 @@ "main": "dest/simple-jekyll-search.js", "type": "module", "scripts": { - "cypress": "cypress", - "cypress:ci": "node scripts/start-jekyll.js & sleep 5 && cypress run", - "cypress:run": "node scripts/start-jekyll.js & sleep 5 && cypress run && node scripts/kill-jekyll.js", + "cypress": "cypress run", + "cypress:run": "node scripts/start-jekyll.js && sleep 8 && cypress run; node scripts/kill-jekyll.js", "lint": "eslint . --ext .ts", "pretest": "yarn run lint", "build": "tsc && vite build && terser dest/simple-jekyll-search.js -o dest/simple-jekyll-search.min.js",