Skip to content

Commit

Permalink
ci: add afterEach hook to fail fast
Browse files Browse the repository at this point in the history
  • Loading branch information
fgnass committed Dec 24, 2024
1 parent 8103f29 commit beb8fb8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 0 additions & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ jobs:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
NODE_OPTIONS: --max-old-space-size=4096
TZ: Europe/Amsterdam
CYPRESS_BAIL: true
- uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest' && matrix.node-version == '20.x' && failure()
with:
Expand Down
4 changes: 0 additions & 4 deletions cypress/run.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@ import { globby } from 'globby';
async function runCypress() {
const args = ['run', '--browser', 'chrome', '--headless'];

if (process.env.CYPRESS_BAIL === 'true') {
args.push('--exit-on-first-failure');
}

const specs = await globby(['cypress/e2e/*spec*.js']);
if (specs.length === 0) {
console.log('No test files found in cypress/e2e/*spec*.js');
Expand Down
6 changes: 6 additions & 0 deletions cypress/support/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,9 @@ addMatchImageSnapshotCommand({
Cypress.on('uncaught:exception', () => false);

import './commands';

afterEach(function () {
if (this.currentTest.state === 'failed') {
Cypress.runner.stop();
}
});

0 comments on commit beb8fb8

Please sign in to comment.