Skip to content
Better terminal output for failed cypress tests.
JavaScript
Branch: master
Clone or download

README.md

Cypress terminal report

Build Status

Plugin for cypress that adds better terminal output when tests fail on the terminal for better debugging. Prints cy commands, console.warn, console.error and request response data captured with cy.route.

Note: If you want to display the logs when test succeed as well then check the options for the support install.

Note: Currently logs do not appear in the dashboard. If you want to see them go to your CI runner and check the pipeline logs there.

demo

Install

  1. Install npm package.
    npm i --save-dev cypress-terminal-report
  2. Register the output plugin in cypress/plugins/index.js
    module.exports = (on) => {
       require('cypress-terminal-report').installPlugin(on);
    };
  3. Register the log collector support in cypress/support/index.js
    require('cypress-terminal-report').installSupport();

Options

Options for the plugin install: .installPlugin(on, options):

  • options.defaultTrimLength - integer; default: 200; max length of cy.log and console.warn/console.error.
  • options.commandTrimLength - integer; default: 600; max length of cy commands.
  • options.routeTrimLength - integer; default: 5000; max length of cy.route request data.

Options for the support install: .installSupport(options):

  • options.printLogs - string; default: 'onFail'; possible values: 'onFail', 'always' - When set to always logs will be printed for successful test as well as failing ones.
  • options.collectTypes - array; default: ['cons:log','cons:info', 'cons:warn', 'cons:error', 'cy:log', 'cy:xhr', 'cy:request', 'cy:route', 'cy:command'] What types of logs to collect and print. By default all types are enabled. The 'cy:command' is the general type that contain all types of commands that are not specially treated.
  • options.filterLog - undefined|([type, message, severity]) => boolean; default: undefined; Callback to filter logs manually. The type is from the same list as for the collectTypes option. Severity can be of ['', 'error', 'warning'].

Release notes

1.2.0

  • Fixed issue with cy.request accepting parameters in multiple formats and the plugin not recognizing this. merge-request by @andrew-blomquist-6
  • Improved browser console logs for Error and other objects. issue-1 issue-2
  • Added support for filtering logs. See collectTypes and filterLog options for the support install. from issue.
  • Removed option printConsoleInfo in favor of above. Also now the console.log and info are by default enabled.

1.1.0

1.0.0

  • Added tests and CI to repository.
  • Added support for showing logs even for successful tests. in issue by @zhex900
  • Fixed issue with incorrectly labeled failed commands. in issue by @zhex900
  • Fixed issue with logs from cy.route breaking tests on XHR API type of requests. merge-request by @zhex900
You can’t perform that action at this time.