{"id":13041,"library":"cypress-json-results","title":"Cypress JSON Test Results","description":"This plugin for Cypress tests automatically saves test execution results into a JSON file, or formats them for GitHub Actions summaries or Markdown tables. Its current stable version is 1.5.0, with minor feature releases occurring somewhat frequently, as seen by the rapid succession of v1.3.0, v1.4.0, and v1.5.0 in May 2023, indicating active maintenance. Key differentiators include its simplicity in generating a structured JSON output of test statuses, its ability to automatically update Markdown tables within a project with aggregated test counts, and its direct integration with GitHub Actions to provide summary reporting, which is highly beneficial for CI/CD pipelines to quickly grasp test outcomes without needing to download artifacts. Unlike some more comprehensive test reporting solutions, `cypress-json-results` focuses specifically on machine-readable JSON and concise formatted summaries rather than rich, interactive HTML reports, making it ideal for programmatic consumption or quick glance overviews.","status":"active","version":"1.5.0","language":"javascript","source_language":"en","source_url":"https://github.com/bahmutov/cypress-json-results","tags":["javascript","cypress-plugin"],"install":[{"cmd":"npm install cypress-json-results","lang":"bash","label":"npm"},{"cmd":"yarn add cypress-json-results","lang":"bash","label":"yarn"},{"cmd":"pnpm add cypress-json-results","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency, as this is a Cypress plugin that interacts with the Cypress test runner lifecycle.","package":"cypress","optional":false}],"imports":[{"note":"This package is a Cypress plugin initialized directly within 'cypress/plugins/index.js' (or equivalent configuration file) using a CommonJS 'require' call and immediate invocation. It does not export named symbols for ES module 'import' statements.","wrong":"import { initialize } from 'cypress-json-results'","symbol":"plugin initialization","correct":"require('cypress-json-results')({ on, filename: 'results.json' })"}],"quickstart":{"code":"// cypress/plugins/index.js\nmodule.exports = (on, config) => {\n  // save all test results as a JSON file\n  // https://github.com/bahmutov/cypress-json-results\n  require('cypress-json-results')({\n    on,\n    filename: 'results.json', // default filename\n  })\n\n  // Optionally, you can also enable GitHub Actions summary or Markdown table updates\n  // require('cypress-json-results')({\n  //   on,\n  //   filename: false, // disable JSON file writing if only summary is needed\n  //   githubActionsSummary: 'spec', // 'spec' or 'test'\n  //   updateMarkdownFile: 'README.md' // path to the markdown file to update\n  // })\n}","lang":"javascript","description":"Demonstrates how to register the `cypress-json-results` plugin in `cypress/plugins/index.js` to save test results to a JSON file."},"warnings":[{"fix":"Ensure the target directory exists before running Cypress tests (e.g., create it with `mkdir -p your/output/path`).","message":"The plugin assumes that the output directory for the specified 'filename' already exists. It will not create parent directories if they are missing.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Configure the plugin with `{ filename: false }` if you do not want a JSON output file.","message":"To prevent writing a JSON file while still utilizing other features like GitHub Actions summaries or Markdown table updates, you must explicitly set the `filename` option to `false`.","severity":"gotcha","affected_versions":">=1.3.0"},{"fix":"Verify that the Markdown file contains the exact `<!-- cypress-test-counts -->` and `<!-- cypress-test-counts-end -->` comments surrounding your table.","message":"When using `updateMarkdownFile`, the plugin relies on specific HTML comments (`<!-- cypress-test-counts -->` and `<!-- cypress-test-counts-end -->`) to locate and update the table. Incorrect or missing comments will prevent the table from being updated.","severity":"gotcha","affected_versions":">=1.2.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Create the directory manually or ensure your CI pipeline creates it before running Cypress tests. For example: `mkdir -p path/to/output`.","cause":"The directory specified in the `filename` option does not exist.","error":"Error: ENOENT: no such file or directory, open 'results.json'"},{"fix":"Ensure `require('cypress-json-results')({ on, filename: '...' })` is called exactly once within your `cypress/plugins/index.js` file and receives the `on` and `config` objects from the plugin's `module.exports` function.","cause":"The plugin is being called incorrectly, likely outside of `cypress/plugins/index.js` or with incorrect arguments, or attempting an ES module import.","error":"TypeError: require(...) is not a function"},{"fix":"Check the target Markdown file (`e.g. README.md`) and ensure it contains the precise HTML comment markers `<!-- cypress-test-counts -->` and `<!-- cypress-test-counts-end -->` surrounding the table you wish to update.","cause":"The `updateMarkdownFile` option is set, but the required HTML comment markers (`<!-- cypress-test-counts -->` and `<!-- cypress-test-counts-end -->`) are not found or are malformed in the specified Markdown file.","error":"Markdown table in 'README.md' was not updated"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":""}