Cypress: Using custom report cause problem with the command line output

Created on 9 Apr 2018  路  4Comments  路  Source: cypress-io/cypress

Current behavior:

When I use a custom reporter configuration like this:

cypress.json

{
    "fileServerFolder": "./test/e2e",
    "fixturesFolder": "./test/e2e/fixtures",
    "integrationFolder": "./test/e2e/features",
    "pluginsFile": "./test/e2e/plugins/index.js",
    "screenshotsFolder": "./test/e2e/screenshots",
    "supportFile": "./test/e2e/support/index.js",
    "videosFolder": "./test/e2e/videos",

    "baseUrl": "http://localhost:3000",
    "reporter": "reporters/custom.js"

}

./reporters/custom.js

module.exports = function(runner) {
    const scoreMatrix = {
        'passed': 1,
        'failed': 0
    };
    let score = 0;
    let passes = 0;
    let failures = 0;

    runner.on('pass', function(test){
        passes++;
        // console.log('pass: %s', test.fullTitle());
        score += scoreMatrix[test.state] || 0;
    });

    runner.on('fail', function(test, err){
        failures++;
        // console.log('fail: %s -- error: %s', test.fullTitle(), err.message);
        score += scoreMatrix[test.state] || 0;
    });

    runner.on('end', function(){
        // console.log('end: %d/%d', passes, passes + failures);
        console.log(`Your score is ${score}`);
        console.log(`passes: ${passes} , failures: ${failures}`);
        process.exit();
    });
};

When I run cypress run the output panel shows the following:

captura de pantalla 2018-04-09 a las 10 09 51 a m

Notice this undefined values for some texts.

Desired behavior:

I need that the panel with undefined values won't showed or some way to pass the values from my custom reporter to cypress output

How to reproduce:

  • git clone https://github.com/gpincheiraa/proyecto_1.git
  • cd proyecto_1
  • git checkout evaluation
  • npm install
  • npm start
  • open new terminal tub and run npm run e2e:ci

  • Operating System: MacOS Sierra

  • Cypress Version: [email protected]
reporters 馃搫 bug

Most helpful comment

The develop branch is ahead of the 2.1.0 release, so it is likely fixed in our next release (which has had work done to the output panel) The changes in develop will be released in 3.0.0.

All 4 comments

Related issue on Cypress CLI reporter output: https://github.com/cypress-io/cypress/issues/1483

Hi again!
I am trying to reproduce this error cloning cypress repo and running the dev version over my project and that is weird, in development mode this it is working!

Running my project in development mode
captura de pantalla 2018-04-17 a las 11 48 48 p m

  • The summary have the red color (in this case it is ok because exists 2 test failing)
  • The values for passes, failures, etc in the summary are ok.
  • My custom report configured in cypress.json are working as I expected.

Running my project inside my project
captura de pantalla 2018-04-18 a las 12 01 06 a m

  • The summary have the green color (in this case it is wrong because exists 2 test failing)
  • The values for passes, failures, etc in the summary are undefined.
  • My custom report configured in cypress.json are working as I expected.

Notice that I am using the same version of cypress (2.1.0)

The develop branch is ahead of the 2.1.0 release, so it is likely fixed in our next release (which has had work done to the output panel) The changes in develop will be released in 3.0.0.

Closing as fixed in 3.0.0. Please comment if you are still encountering this issue and we will reopen.

Was this page helpful?
0 / 5 - 0 ratings