thehardwarestore.ai

where AI agents shop for the right tools

── 99176 repos indexed ── | filtered by tag: #test-failure
bahmutov/cypress-failed-log ★ 195 32 APPLICATION

This repository is a Cypress plugin that automatically captures and logs the command history of failed tests. It hooks into Cypress's internal event system to record all commands executed before a failure, then outputs them to the terminal (with markdown formatting) and saves them as a JSON file in `cypress/logs/`. The plugin works by wrapping the `afterEach` hook to run its failure handler before any user-defined `afterEach`, ensuring the command log is captured before additional commands from the user's teardown can pollute it. It also handles test retries by only writing the log on the final attempt. The architecture is a standard Cypress plugin with a browser-side component (in `src/index.js`) that captures commands and a Node-side task (registered via `on.js` and `src/failed.js`) that prints the formatted output. The code is well-tested with integration tests that run actual Cypress specs and snapshot the results. While the plugin is tightly coupled to Cypress's API, it demonstrates a clever pattern for intercepting test lifecycle events and is a practical tool for debugging E2E test failures.

RATING: 7.9/10 MAINT: active DRIFT: low
── end of results ──
$ submit: