For AI agents and LLMs: a machine-readable index is available at llms.txt. A plain-Markdown version of any documentation page is available by appending .md to its URL.
Skip to main content

How to View Detailed Cypress Command Logs on TestMu AI


If you need to debug why a Cypress test failed on TestMu AI, detailed command logs give you a full record of every Cypress command and its result. The Detailed Command Logs feature captures this output in both the console and a file, so you can pinpoint the exact command that broke. You enable it with the cypress-terminal-report plugin and the detailed_command_logs capability, then view the logs in a dedicated tab on the test details page.

Prerequisites​


Before you configure the plugin, install Cypress and add the cypress-terminal-report plugin as a dependency. In your package.json or lambdatest-config.json file, add the plugin version that matches your Cypress version.

Use this version if your project runs Cypress below version 10.

Verified
"cypress-terminal-report": "4.1.3"

Use this version if your project runs Cypress version 10 or later.

Verified
"cypress-terminal-report": "^5.3.2"

Next, enable detailed command logs in lambdatest-config.json by adding the following setting.

Verified
"run_settings": {
"detailed_command_logs": true,
"downloads": "./cypress/results"
}
note

The Detailed Command Logs tab appears only when you set the detailed_command_logs capability in run_settings in lambdatest-config.json.

Configure Detailed Command Logs for Cypress v9 and Below​


For Cypress v9 and earlier, configure the plugin in the legacy plugins file. Follow the steps below to register the log printer and collector.

Configure the Plugin​


The plugin file is where you register the log printer for older Cypress versions.

  • Open the cypress/plugins/index.js file in your project.
  • Add the following code to install and configure the cypress-terminal-report plugin.
Verified
const installLogsPrinter = require('cypress-terminal-report/src/installLogsPrinter')

module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config

installLogsPrinter(on, {
printLogsToFile: 'always',
outputRoot: 'cypress/results/detailCommandLogs',
outputTarget: {
'detailCommandLogs.json': 'json',
},
})
}

Enable Logs in the Console​


To also print detailed logs in the terminal, add printLogsToConsole: 'always' to installLogsPrinter. This step is optional.

Verified
module.exports = (on, config) => {
installLogsPrinter(on, {
printLogsToConsole: 'always', // Enables logs in the terminal
printLogsToFile: 'always',
outputRoot: 'cypress/results/detailCommandLogs',
outputTarget: {
'detailCommandLogs.json': 'json',
},
});
};

Install Logs Collector​


The collector captures command output during each test so the printer can write it out.

  • Navigate to cypress/support/index.js.
  • Add the following code to install the log collector.
Verified
const installLogsCollector = require('cypress-terminal-report/src/installLogsCollector')

installLogsCollector()

Configure Detailed Command Logs for Cypress v10 and Above​


For Cypress v10 and later, configure the plugin inside cypress.config.js using setupNodeEvents. Follow the steps below to register the log printer and collector.

Configure the Plugin​


The setupNodeEvents block replaces the legacy plugins file in Cypress v10 and later.

  • Open cypress.config.js in your project.
  • Add the following code to configure the plugin.
Verified
const { defineConfig } = require("cypress");
const installLogsPrinter = require("cypress-terminal-report/src/installLogsPrinter");
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
installLogsPrinter(on, {
printLogsToFile:"always",
outputRoot: 'cypress/results/detailCommandLogs',
outputTarget: {
'detailCommandLogs.json': 'json',
}
});
},
},
});

Enable Logs in the Console​


To also print logs in the terminal, add printLogsToConsole: 'always' to installLogsPrinter. This step is optional.

Verified
const { defineConfig } = require("cypress");
const installLogsPrinter = require("cypress-terminal-report/src/installLogsPrinter");
module.exports = defineConfig({
e2e: {
setupNodeEvents(on, config) {
// implement node event listeners here
installLogsPrinter(on, {
printLogsToConsole: 'always',
printLogsToFile:"always",
outputRoot: 'cypress/results/detailCommandLogs',
outputTarget: {
'detailCommandLogs.json': 'json',
}
});
},
},
});

Install Logs Collector​


The collector captures command output during each test so the printer can write it out.

  • Open cypress/support/e2e.js.
  • Add the following code to install the log collector.
Verified
import installLogsCollector from 'cypress-terminal-report/src/installLogsCollector'

installLogsCollector()

View Generated Logs​


After your Cypress tests run, open the test details page to inspect the captured command output. View the detailed command logs in the Detailed Command Logs tab on that page.

To download these logs alongside screenshots and videos, see how to download Cypress artefacts.

TestMu AI Automation Dashboard More menu showing the Detailed Cypress Logs option on a passed Cypress test

Continue with the guides below to download and report on your Cypress runs on TestMu AI.

Terminal First Testing With Kane CLI

Natural language browser & mobile app tests right from terminal.

×
Schedule Your Personal Demo
Kane CLI terminal

Help and Support

Related Articles