Cypress Terminal Report is a utility plugin for Cypress that significantly enhances the clarity and detail of test logs within the terminal and in output files. As of version 7.3.3, it is actively maintained and designed for Cypress versions 10.0.0 and newer. The package provides richer debug output by capturing Cypress commands, browser console logs, and network request data (cy.request, cy.intercept), which are crucial for debugging, especially in CI/CD pipelines. Key differentiators include its visually appealing console output, support for logging to files, configurable options for logging only on failure (default) or always, and features for trimming and compacting logs. It also handles multiple and nested Mocha contexts and logs commands from `before all` and `after all` hooks, offering more comprehensive insights than standard Cypress logging, making it an invaluable tool for complex testing environments.
npm install cypress-terminal-reportVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates the full setup for `cypress-terminal-report`, including the Node.js plugin registration in `cypress.config.js|ts` and the client-side log collector in `cypress/support/e2e.js|ts`, along with example Cypress tests to show log capturing for both successful and failing scenarios.
Ensure your `cypress-terminal-report` version matches your Cypress installation's major version requirements. Check the `package.json` peer dependencies or the official documentation for compatibility tables.
To always print logs, configure the `printLogsToConsole` option to `'always'` in your `cypress.config.js|ts` when installing the plugin: `installLogsPrinter(on, { printLogsToConsole: 'always' });`Always use `cy.log()` for logging custom messages within your Cypress test steps. Browser console logs emitted by the application under test (e.g., from `console.warn` or `console.error` in your front-end code) *will* be captured.
Ensure `"esModuleInterop": true` is set under `compilerOptions` in your `tsconfig.json` to correctly handle CommonJS modules being imported via ES6 syntax (e.g., `import installLogsPrinter from '...'`).
Ensure `"esModuleInterop": true` in `tsconfig.json`. If using CommonJS, stick to `const installLogsPrinter = require('cypress-terminal-report/src/installLogsPrinter');`. For ESM, ensure correct default import or adjust `moduleResolution`.Double-check the exact paths: `cypress-terminal-report/src/installLogsPrinter` and `cypress-terminal-report/src/installLogsCollector`. Ensure `node_modules` is correctly configured in your build system's resolution paths if using a custom setup.
Modify the plugin configuration in `cypress.config.js|ts` to always print logs: `installLogsPrinter(on, { printLogsToConsole: 'always' });`Use `cy.log('Your message')` within your Cypress test code to ensure messages are captured and displayed by `cypress-terminal-report`.