cypress-io / circleci-orb

Install, cache and run Cypress.io tests on CircleCI with minimal configuration.
https://circleci.com/orbs/registry/orb/cypress-io/cypress
MIT License
161 stars 101 forks source link

Node 10 limits ES6 features? #335

Closed lucksp closed 1 year ago

lucksp commented 3 years ago

The orb does not work as expected

executors: node: docker:



- describe what you think should happen
  - flatMap should be a supported ES6 method

- describe what happens
This only happens when running the orb within CircleCI/Docker environment.  Local development running Cypress has no issues.
I think this is related to using @types/node version 10 [as listed in package.json](https://github.com/cypress-io/circleci-orb/blob/master/package.json#L40)
![image](https://user-images.githubusercontent.com/15162169/109220033-a64ee780-7775-11eb-8a76-d510ab6931d2.png)
Phonesis commented 2 years ago

I have encountered this issue today when trying to use the orb with Percy and the @Percy/CLI package. It includes await syntax which breaks the orb.

The orb needs to be upgraded to support modern node versions.

admah commented 2 years ago

@Phonesis what version of the orb are you using? The latest is v2.1.0.

Phonesis commented 2 years ago

@admah using the latest 2.1.0

It still seems to be limited to node 10. So no way to use in conjunction with Percy

admah commented 2 years ago

@Phonesis I think #380 fixes this.

Phonesis commented 2 years ago

Thanks @admah I will test once merged. Will I just need to use a new orb version number?

Phonesis commented 2 years ago

@admah seeing same issue still. Do I need to update the circleCI config to specify a new orb version?

admah commented 2 years ago

It's not released quite yet. I'm working on that now, and will update this issue once it's published. You won't need to specify a new version if you're using the major version marker like cypress-io/cypress@2.

Phonesis commented 2 years ago

Great thanks @admah

admah commented 2 years ago

@Phonesis the latest version (2.2.0) is published and ready to use - https://circleci.com/developer/orbs/orb/cypress-io/cypress

Phonesis commented 2 years ago

@admah thanks for this, unfortunately getting same error with 2.2.0

> core-js-pure@3.24.1 postinstall /root/project/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"

> @percy/core@1.10.1 postinstall /root/project/node_modules/@percy/core
> node ./post-install

(node:127) ExperimentalWarning: The ESM module loader is experimental.
file:///root/project/node_modules/@percy/core/post-install.js:6
    await import('./dist/install.js').then(install => install.chromium());
    ^^^^^

SyntaxError: Unexpected reserved word
    at Loader.moduleStrategy (internal/modules/esm/translators.js:117:18)
    at async link (internal/modules/esm/module_job.js:42:21)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @percy/core@1.10.1 postinstall: `node ./post-install`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @percy/core@1.10.1 postinstall script.
admah commented 2 years ago

@Phonesis I'm not sure what else we can do via the orb. I have updated the image that CircleCI uses to 16.14.2 (seen here), updated ts-node to its latest, and @types/node to the latest for 16.

What executor are you using?

Phonesis commented 2 years ago

Thanks @admah this is the config with executor (thought only applied to what Cypress uses as browser):

version: 2.1

orbs:
  sonarcloud: sonarsource/sonarcloud@1.1.1
  cypress: cypress-io/cypress@2.2.0
executors:
  with-chrome:
    docker:
      - image: 'cypress/browsers:node16.14.2-slim-chrome103-ff102'

Are you not able to reproduce this at your end? From what I can tell, the orb is basically incompatible with Percy as it stands

Phonesis commented 2 years ago

Further update. I managed to get this to work now but had to apply a different approach to what is outlined in your documentation for the orb.

As a command-prefix I had to add the installation of percy/cli and remove it from package.json in the src code

          command-prefix: npm i @percy/cli && npx percy exec --
admah commented 2 years ago

@Phonesis glad you were able to find a workaround. Do you have a link to the doc you reference? I'd be happy to get that updated.

Phonesis commented 2 years ago

@admah it is in all the orb docs (the main readme) example of percy usage when using a command-prefix.

Might be worth adding a section specific to Percy and making it clear the cli needs to be installed after the cypress/install job

Phonesis commented 1 year ago

@admah See this https://github.com/percy/cli/discussions/1048

Any thoughts? We are still getting this issue and cannot use the latest Percy features when using the Cypress orb as a result.

jordanpowell88 commented 1 year ago

Closing as this appears to be solved via command-prefix