Cypress reporter error in 10.7.0+ in Azure Pipileines with CRA
See original GitHub issueCurrent behavior
After ugrading cypress from 8 to 10.8.0 we are experience flaky component tests with the reporter reporting null issues. We have tried 10.9.0 (hung completly) and 10.7.0 experiencing the same.
We are using CRA with cypress, babel, ny, istanbul, cypress/code-coverage
Invalid array length
RangeError: Invalid array length
at Runner.runner._events.pass.<computed> (/home/vsts/.cache/Cypress/10.8.0/Cypress/resources/app/packages/server/lib/reporter.js:314:11)
at Runner.emit (node:events:538:35)
at Runner.emit (node:domain:475:12)
at Reporter.emit (/home/vsts/.cache/Cypress/10.8.0/Cypress/resources/app/packages/server/lib/reporter.js:362:46)
at Object.onMocha (/home/vsts/.cache/Cypress/10.8.0/Cypress/resources/app/packages/server/lib/project-base.js:272:34)
at Socket.<anonymous> (/home/vsts/.cache/Cypress/10.8.0/Cypress/resources/app/packages/server/lib/socket-base.js:260:40)
at Socket.emit (node:events:526:28)
at Socket.emit (node:domain:475:12)
at Socket.emitUntyped (/home/vsts/.cache/Cypress/10.8.0/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/typed-events.js:69:22)
at /home/vsts/.cache/Cypress/10.8.0/Cypress/resources/app/packages/socket/node_modules/socket.io/dist/socket.js:428:39
at processTicksAndRejections (node:internal/process/task_queues:78:11)
Desired behavior
The tests should run and report on code coverage as previously.
Test code to reproduce
The config is here:
import { defineConfig } from 'cypress';
export default defineConfig({
viewportHeight: 768,
viewportWidth: 1024,
video: false,
defaultCommandTimeout: 12000,
requestTimeout: 12000,
retries: {
// Configure retry attempts for `cypress run`
runMode: 2,
// Configure retry attempts for `cypress open`
openMode: 0,
},
component: {
specPattern: 'src/**/*.spec.{js,jsx,ts,tsx}',
setupNodeEvents(on, config) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
require('@cypress/code-coverage/task')(on, config);
return config;
},
devServer: {
framework: 'create-react-app',
bundler: 'webpack',
webpackConfig: {
mode: 'development',
devtool: false,
module: {
rules: [
// application and Cypress files are bundled like React components
// and instrumented using the babel-plugin-istanbul
// (we will filter the code coverage for non-application files later)
{
test: /\.(ts|tsx)$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-typescript'],
plugins: [
// we could optionally insert this plugin
// only if the code coverage flag is on
'istanbul',
],
},
},
},
],
},
},
},
experimentalSingleTabRunMode: true,
},
});
I haven’t enclosed a test as it’ pretty random - can do at request.
Cypress Version
10.7.0
Node version
16.15.0
Operating System
Linux
Debug Logs
No response
Other
No response
Issue Analytics
- State:
- Created a year ago
- Reactions:5
- Comments:28 (6 by maintainers)
Top Results From Across the Web
Cypress pipeline fails after running for 1hr 10 min and will be ...
The pipeline for Cypress runs for 1hr and 10 min and fails with below error. "##[error]We stopped hearing from agent Hosted Agent. Verify...
Read more >package.json - rouch/Cypress - NotABug.org
Cypress - Fast, easy and reliable testing for anything that runs in a browser.
Read more >Run Cypress Tests on Azure DevOps Pipeline and ... - YouTube
In this video I've shown how to Run Cypress Tests on Azure DevOps and Publish the Merged JUnit ReportGithub Repo ...
Read more >Code Coverage - Cypress Documentation
As part of your code transpilation pipeline using the babel-plugin-istanbul tool. Using NYC. To instrument the application code located in your src folder...
Read more >Untitled
Pasien sakit jantung, Os x 10.7.0 download free, 7abibitv instagram, Wir fahren gegen ... The wigan reporter newspaper, Rodanthe beach house collapses 2012, ......
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@zzzorgo - which version of cypress are you running? This fix did not work for me -
Invalid array length RangeError: Invalid array length at indent (C:\Users\paulg\AppData\Local\Cypress\Cache\10.11.0\Cypress\resources\app\node_modules\mocha-7.0.1\lib\reporters\spec.js:45:12)
@amehta265 - putting a null check in the indent function did work :
if(isNaN(indents)) { indents = 0; }
So your educated guess would be correct and lies in the indents counter in the cypress version of mocha - 7.0.1 C:\Users\paulg\AppData\Local\Cypress\Cache\10.11.0\Cypress\resources\app\node_modules\mocha-7.0.1\lib\reporters\spec.js
This issue is not addressed in mocha 10.10 https://github.com/mochajs/mocha/blob/master/lib/reporters/spec.js
Thanks Alex, one immediate difference I see is in your cypress config file, we are using the component setup, not the e2e setup. https://docs.cypress.io/guides/component-testing/quickstart-react#Configuring-Component-Testing
I believe it is actually down to Azure Pipelines and it not having enough processing power - this is under review for us now. I will review your github over the next day or so - see if I can reproduce the issue! PG On Tuesday, 25 October 2022 at 13:55:47 BST, AlexandreGaubert @.***> wrote:
I’ve managed to setup a reproducible repository here by forking your examples repository (directory react-cra5-ts).
I’ve made it pretty close to our configuration, but I didn’t reproduced the error in CI. But you can clearly see that tests are reported twice here in the run npm ci job.
But this bug didn’t happened in this run here.
So it must be something in this commit
— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>