circleci-orb icon indicating copy to clipboard operation
circleci-orb copied to clipboard

Node 10 limits ES6 features?

Open lucksp opened this issue 3 years ago • 15 comments

The orb does not work as expected

  • what version of the orb are you currently using?
    • cypress-io/cypress@1
  • paste the circle.yml file if possible or at least the relevant portion
orbs:
  cypress: cypress-io/cypress@1

executors:
  node:
    docker:
      - image: circleci/node
...
...
...
jobs:
  test:
    executor: node
...
...

  • 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 image

lucksp avatar Feb 25 '21 21:02 lucksp

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.

Phonesis avatar Aug 26 '22 14:08 Phonesis

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

admah avatar Sep 06 '22 19:09 admah

@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

Phonesis avatar Sep 06 '22 21:09 Phonesis

@Phonesis I think #380 fixes this.

admah avatar Sep 06 '22 21:09 admah

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

Phonesis avatar Sep 07 '22 09:09 Phonesis

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

Phonesis avatar Sep 07 '22 15:09 Phonesis

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.

admah avatar Sep 07 '22 15:09 admah

Great thanks @admah

Phonesis avatar Sep 07 '22 15:09 Phonesis

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

admah avatar Sep 07 '22 18:09 admah

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

> [email protected] postinstall /root/project/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"


> @percy/[email protected] 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/[email protected] postinstall: `node ./post-install`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @percy/[email protected] postinstall script.

Phonesis avatar Sep 07 '22 18:09 Phonesis

@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?

admah avatar Sep 07 '22 18:09 admah

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

version: 2.1

orbs:
  sonarcloud: sonarsource/[email protected]
  cypress: cypress-io/[email protected]
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 avatar Sep 08 '22 09:09 Phonesis

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 --

Phonesis avatar Sep 08 '22 11:09 Phonesis

@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.

admah avatar Sep 08 '22 19:09 admah

@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 avatar Sep 09 '22 14:09 Phonesis

@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.

Phonesis avatar Nov 16 '22 13:11 Phonesis

Closing as this appears to be solved via command-prefix

jordanpowell88 avatar Dec 20 '22 20:12 jordanpowell88