trentrand / cypress-utils

⚙ Easily parallelize and stress-test your Cypress tests
MIT License
25 stars 6 forks source link

Error when trying to execute commands #8

Closed sergiomrd closed 3 years ago

sergiomrd commented 3 years ago

Hi, I'm having an issue when trying to execute parallel and stress commands.

When I execute run-parallel with two specific files it runs well until the end and then this appears:

Command completed in 14 seconds.

D:(...)\node_modules\cypress-utils\node_modules\async\asyncify.js:114
            throw e;
            ^

TypeError: results.filter(...).map(...).flat is not a function
    at computeResults (D:(...)\node_modules\cypress-utils\index.js:88:84)
    at handleResults (D:(...)\node_modules\cypress-utils\index.js:128:28)
    at err (D:(...)\node_modules\cypress-utils\node_modules\async\internal\map.js:27:9)
    at wrapper (D:(...)\node_modules\cypress-utils\node_modules\async\internal\once.js:12:16)
    at iterateeCallback (D:(...)\node_modules\cypress-utils\node_modules\async\internal\eachOfLimit.js:63:24)
    at D:(...)\node_modules\cypress-utils\node_modules\async\internal\onlyOnce.js:12:16
    at _iteratee (D:(...)\node_modules\cypress-utils\node_modules\async\internal\map.js:24:13)
    at invokeCallback (D:(...)\node_modules\cypress-utils\node_modules\async\asyncify.js:111:9)
    at promise.then.value (D:(...)\node_modules\cypress-utils\node_modules\async\asyncify.js:103:9)`

When I execute the stress command as npx cypress-utils stress-test business --trialCount 12 --threads 4, the same error appears:

Array(...).fill(...).flat is not a function

Do you have any idea about this and how to solve it?

trentrand commented 3 years ago

Hey Sergio 👋🏻

I'm pretty certain that you are running this from a version of NodeJS older than 11.0. As a general rule, you'll have the best success with running NodeJS code if you keep your local version updated to the latest Long Term Support (LTS) version.

If you look at the compatibility charts for Array#flat, you'll see that the minimum Node version is 11.0.0.

Try checking your current version of NodeJS with node --version and upgrade it if necessary.

Let me know how it goes! I opened a PR (shown below) that will add a minimum Node version in the package.json to warn consumers of the incompatible version. I'll merge it if my assumptions here are correct.

trentrand commented 3 years ago

I've published cypress-utils@2.0.1 which enforces the user to have a compatible Node version.

Going to close this issue as resolved, but please leave a comment if you continue to have issues!