agent-js-cypress icon indicating copy to clipboard operation
agent-js-cypress copied to clipboard

ERR_IPC_CHANNEL_CLOSED when autoMerge set to true.

Open kpmck opened this issue 4 years ago • 5 comments

I have an Angular Nx project with Cypress. When I did not set autoMerge, the tests ran and were all reported to my instance of ReportPortal.

Once I switched to autoMerge, the first spec file ran successfully, and the second (and subsequent) spec files failed out with the ERR_IPC_CHANNEL_CLOSED failure, causing only the first spec file to run.

I was able to get the autoMerge to run successfully a handful of times, but once any change was made to the Cypress.json file, I was not able to get it to run again.

I have included a repo where this can be reproduced: https://github.com/kpmck/angular-nx-cypress-reportportal

Steps to reproduce:

  1. open solution in VS Code
  2. run npm i to install packages
  3. add your ReportPortal details in the cypress.json file
  4. run ng e2e to execute e2e tests

Cypress: 4.12.1 (I have also tried 5.4.0 and 4.1.0) Node: 8.9.5 reportportal/agent-js-cypress: 5.0.1

Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed at ChildProcess.target.send (internal/child_process.js:678:16) at Runner. (C:\sandbox\angular-nx-cypress-reportportal\node_modules@reportportal\agent-js-cypress\lib\cypressReporter.js:109:21)
at Runner.emit (events.js:215:7) at Reporter.emit (C:\Users\user1\AppData\Local\Cypress\Cache\4.12.1\Cypress\resources\app\packages\server\lib\reporter.js:263:54) at Object.onMocha (C:\Users\user1\AppData\Local\Cypress\Cache\4.12.1\Cypress\resources\app\packages\server\lib\project.js:381:18) at Socket. (C:\Users\user1\AppData\Local\Cypress\Cache\4.12.1\Cypress\resources\app\packages\server\lib\socket.js:313:32) at Socket.emit (events.js:210:5) at C:\Users\user1\AppData\Local\Cypress\Cache\4.12.1\Cypress\resources\app\packages\socket\node_modules\socket.io\lib\socket.js:528:12 at processTicksAndRejections (internal/process/task_queues.js:75:11) { code: 'ERR_IPC_CHANNEL_CLOSED' } Error [ERR_IPC_CHANNEL_CLOSED]: Channel closed at ChildProcess.target.send (internal/child_process.js:678:16) at Runner. (C:\sandbox\angular-nx-cypress-reportportal\node_modules@reportportal\agent-js-cypress\lib\cypressReporter.js:109:21)
at Runner.emit (events.js:215:7) at Reporter.emit (C:\Users\user1\AppData\Local\Cypress\Cache\4.12.1\Cypress\resources\app\packages\server\lib\reporter.js:263:54) at Object.onMocha (C:\Users\user1\AppData\Local\Cypress\Cache\4.12.1\Cypress\resources\app\packages\server\lib\project.js:381:18) at Socket. (C:\Users\user1\AppData\Local\Cypress\Cache\4.12.1\Cypress\resources\app\packages\server\lib\socket.js:313:32) at Socket.emit (events.js:210:5) at C:\Users\user1\AppData\Local\Cypress\Cache\4.12.1\Cypress\resources\app\packages\socket\node_modules\socket.io\lib\socket.js:528:12 at processTicksAndRejections (internal/process/task_queues.js:75:11)

kpmck avatar Oct 23 '20 02:10 kpmck

The Project-Repo doesn't exist anymore. Have you found a solution?

brabenetz avatar Feb 10 '22 17:02 brabenetz

@kpmck hello. Have you found the solution?

AM1988 avatar Apr 08 '22 12:04 AM1988

@AM1988 I have done the following: https://github.com/reportportal/agent-js-cypress/issues/64#issuecomment-1038807053 Maybe there is something in it for you.

brabenetz avatar Apr 08 '22 14:04 brabenetz

@brabenetz thank you, will try this. And could you please share the info about how your cypress/plugins/index.js look like?

AM1988 avatar Apr 08 '22 15:04 AM1988

@AM1988

// Plugins enable you to tap into, modify, or extend the internal behavior of Cypress
// For more info, visit https://on.cypress.io/plugins-api
// https://www.npmjs.com/package/cypress-cucumber-preprocessor#typeScript-support

/* eslint-disable @typescript-eslint/no-var-requires */
// cucumber
const browserify = require('@cypress/browserify-preprocessor');
const cucumber = require('cypress-cucumber-preprocessor').default;
const resolve = require('resolve');
// reportportal
const registerReportPortalPlugin = require('@reportportal/agent-js-cypress/lib/plugin');
// cypress-mochawesome-reporter
const { beforeRunHook, afterRunHook } = require('cypress-mochawesome-reporter/lib');

module.exports = (on, config) => {
    // enable cypress-mochawesome-reporter:
    on('before:run', async (details) => {
        await beforeRunHook(details);
    });
    on('after:run', async () => {
        await afterRunHook();
    });

    // enable cucumber:
    const preprocessorOptions = {
        ...browserify.defaultOptions,
        typescript: resolve.sync('typescript', { baseDir: config.projectRoot }),
    };
    on('file:preprocessor', cucumber(preprocessorOptions));

    // enable report-portal only on Jenkins:
    const reportPortalJson = process.env.REPORTPORTAL_JSON;
    if (reportPortalJson) {
        // add reportPortal Config
        const reportportalAttributes = JSON.parse(reportPortalJson);
        const options = {
            endpoint: ...,
            token: ...,
            launch: '...,
            project: ...,
            description: ...,
            autoMerge: true,
            attributes: [...],
            restClientConfig: {
                // timoutconfig: https://github.com/reportportal/client-javascript#timeout-30000ms-on-axios-requests
                timeout: 900000, // (15m) default 30000 (30s)
            },
        };
        config.reporterOptions.reporterEnabled = config.reporterOptions.reporterEnabled + ', @reportportal/agent-js-cypress';
        config.reporterOptions.reportportalAgentJsCypressReporterOptions = options;
        // enable reportPortal plugin
        registerReportPortalPlugin(on, config);
    }
    return config;
};

brabenetz avatar Apr 08 '22 15:04 brabenetz