I am using Cypress on an Angular application.
The following test is working on version 3.8.3
it('cy.get() - query DOM elements', () => {
let x = [...Array(100).keys()].map(x => x + "");
cy.server().route('/test', x);
cy.get('[data-cy=landmark]').invoke('text').should('contain', 'Welcome');
})
but throws an error on 4.4.1
TypeError: Array(...).keys(...).slice is not a function
at Context.<anonymous> (http://localhost:4200/__cypress/tests?p=cypress/integration/examples/querying.spec.js-628:8:35)
Repository demonstrating the problem: https://github.com/Kimserey/cypress-test-issue
master is 3.8.3upgrade-4 is 4.4.1ng serve,npx cypress open,Cypress 4.4.1
I'm not able to reproduce this solely from the snippet provided.

I am able to reproduce this from the repository provided, so this means it is something related to the environment setup. I suspect that it has something to do with the TypeScript configuration, since this begins failing in 4.4.0, which introduced out of the box TypeScript support in https://github.com/cypress-io/cypress/pull/5906
Indeed, I've confirmed that the test code above does not work when there is a devDependency of typescript. cc @sainthkh
spec.js
let x = [...Array(100).keys()].map(x => x + "");
package.json
{
"name": "cypress-test",
"scripts": {},
"devDependencies": {
"cypress": "4.4.1",
"typescript": "3.8.3"
}
}





Downgrade to Cypress 4.3.0 for now.
It happened because I didn't set up downlevelIteration option. It will be fixed in the preprocessor first and added to Cypress.
The code for this is done in cypress-io/cypress#7129, but has yet to be released.
We'll update this issue and reference the changelog when it's released.
Released in 4.5.0.
This comment thread has been locked. If you are still experiencing this issue after upgrading to
Cypress v4.5.0, please open a new issue.