Skip to content

Getting error in cypress-split package when running in setupNodeEvents even with the basic configuration. #364

Open
@cacious7

Description

@cacious7

I am getting this error:

Your configFile threw an error from: `/home/runner/work/workspace/app-folder/cypress.config.ts`

The error was thrown while executing your e2e.setupNodeEvents() function:

TypeError: (0 , cypress_split_1.default) is not a function
    at setupNodeEvents (/home/runner/work/workspace/app-folder/cypress.config.ts:15:16)
    at /home/runner/.cache/Cypress/13.16.1/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_plugins.js:122:14
    at tryCatcher (/home/runner/.cache/Cypress/13.16.1/Cypress/resources/app/node_modules/bluebird/js/release/util.js:16:23)
    at Function.Promise.attempt.Promise.try (/home/runner/.cache/Cypress/13.16.1/Cypress/resources/app/node_modules/bluebird/js/release/method.js:39:29)
    at RunPlugins.load (/home/runner/.cache/Cypress/13.16.1/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_plugins.js:119:9)
    at RunPlugins.runSetupNodeEvents (/home/runner/.cache/Cypress/13.16.1/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_plugins.js:59:17)
    at EventEmitter.<anonymous> (/home/runner/.cache/Cypress/13.16.1/Cypress/resources/app/node_modules/@packages/server/lib/plugins/child/run_require_async_child.js:185:22)
    at EventEmitter.emit (node:events:519:28)
    at EventEmitter.emit (node:domain:488:12)
    at process.<anonymous> (/home/runner/.cache/Cypress/13.16.1/Cypress/resources/app/node_modules/@packages/server/lib/plugins/util.js:33:22)
    at process.emit (node:events:519:28)
    at process.emit (node:domain:488:12)
    at process.emit.sharedData.processEmitHook.installedValue [as emit] (/home/runner/.cache/Cypress/13.16.1/Cypress/resources/app/node_modules/@cspotcode/source-map-support/source-map-support.js:[74](https://github.com/account/company/actions/runs/13439759622/job/37551304877#step:4:75)5:40)
    at emit (node:internal/child_process:951:14)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
[2812:0220/162303.229567:ERROR:connection.cc(46)] X connection error received.
[2812:0220/162303.230860:ERROR:connection.cc(46)] X connection error received.
Test run failed, code 1
More information might be available above
Cypress module has returned the following error message:
Could not find Cypress test run results
Error: Could not find Cypress test run results

Here is my cypress.config.ts file:

import { defineConfig } from 'cypress'
import cypressSplit from 'cypress-split'

export default defineConfig({
	e2e: {
		specPattern: 'cypress/e2e/**/*.{cy,spec}.{js,jsx,ts,tsx}',
		baseUrl: 'http://localhost:2030',
		defaultCommandTimeout: 30000,
		downloadsFolder: 'cypress/downloads',
		video: true,
		videosFolder: 'cypress/videos',
		videoCompression: true,
		screenshotsFolder: 'cypress/screenshots',
		setupNodeEvents (on, config) {
			cypressSplit(on, config)
			// IMPORTANT: return the config object
			return config
		}
	}
})

And I have made the following changes in my main.yml file in .github/workflows:

    strategy:
        fail-fast: false # Continue running jobs on different machine/container even if a previous container fails
        matrix:
          # Define the number of parallel jobs
          containers: [1, 2]

and after all the checkout and build process, I have this:

      - name: Cypress run
        uses: cypress-io/github-action@v6
        with:
          start: npm run test:e2e
          browser: chrome
          record: false # Disable saving of recorded videos to Cypress Dashboard
          parallel: true
          group: 'github-action'
        env:
            SPLIT: ${{ strategy.job-total }}
            SPLIT_INDEX: ${{ strategy.job-index }}
            DEBUG: cypress-split

Not sure why it is failing. Need some urgent help please.

Kind Regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions