bahmutov / bahmutov/cypress-split
Getting error in cypress-split package when running in setupNodeEvents even with the basic configuration.
- Dominant language
- JavaScript
- Stars
- 285
- Forks
- 28
- PR merge metrics
- No merged PRs in 30d
Description
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. (/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. (/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:
```ts
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:
```yml
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:
```yml
- 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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with cypress.config.ts and the cypress-split import used inside setupNodeEvents, then review the package's export and compatibility with Cypress 13.16.1. Reproduce the failure using the shown GitHub Actions matrix, SPLIT/SPLIT_INDEX values, and basic configuration; done means setupNodeEvents loads without the TypeError and the parallel Cypress jobs complete.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cypress, github-actions, javascript, typescript
- Domain
- ci-cd, testing-qa
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100