Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERR_IPC_CHANNEL_CLOSED when autoMerge set to true. #61

Open
kpmck opened this issue Oct 23, 2020 · 5 comments
Open

ERR_IPC_CHANNEL_CLOSED when autoMerge set to true. #61

kpmck opened this issue Oct 23, 2020 · 5 comments
Assignees

Comments

@kpmck
Copy link

kpmck commented Oct 23, 2020

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)

@AmsterGet AmsterGet self-assigned this Oct 23, 2020
@brabenetz
Copy link

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

@AM1988
Copy link
Contributor

AM1988 commented Apr 8, 2022

@kpmck hello. Have you found the solution?

@brabenetz
Copy link

@AM1988 I have done the following: #64 (comment)
Maybe there is something in it for you.

@AM1988
Copy link
Contributor

AM1988 commented Apr 8, 2022

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

@brabenetz
Copy link

@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;
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants