Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove nullish coalescing in js files to support node 12 #20094

Merged
merged 1 commit into from
Feb 8, 2022

Conversation

ZachJW34
Copy link
Contributor

@ZachJW34 ZachJW34 commented Feb 8, 2022

User facing changelog

Remove nullish coalescing operator in js files

Additional details

plugins/react-scripts was failing on Node v12 due to the ?? operator. It's fine in typescript files since we transpile them, but not in javascript files.

How has the user experience changed?

@cypress/react/plugins/react-scripts works with node v12

Testing

I tested this by checkout out cypress-component-testing-examples and testing against create-react-app using nvm to switch to node v12. Running npx cypress open-ct throws:

The plugins file is missing or invalid.

Your `pluginsFile` is set to `/Users/zachjw/work/cypress-component-testing-examples/create-react-app/cypress/plugins/index.js`, but either the file is missing, it contains a syntax error, or threw an error when required. The `pluginsFile` must be a `.js`, `.ts`, or `.coffee` file.

Or you might have renamed the extension of your `pluginsFile`. If that's the case, restart the test runner.

Please fix this, or set `pluginsFile` to `false` if a plugins file is not necessary for your project.

 /Users/zachjw/work/cypress-component-testing-examples/create-react-app/node_modules/@cypress/react/plugins/utils/get-transpile-folders.js:5
  const rawFolders = config.addTranspiledFolders ?? []
                                                  ^

SyntaxError: Unexpected token '?'

...

Then, run yarn workspace @cypress/react build and copy and paste the npm/react/plugins and npm/react/dist folders into ~/<path-to-repo>/cypress-component-testing-examples/create-react-app/node_modules/@cypress/react and run npx cypress open-ct. No failure!

PR Tasks

  • Have tests been added/updated?
  • Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • Has a PR for user-facing changes been opened in cypress-documentation?
  • Have API changes been updated in the type definitions?
  • Have new configuration options been added to the cypress.schema.json?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Feb 8, 2022

Thanks for taking the time to open a PR!

@cypress
Copy link

cypress bot commented Feb 8, 2022



Test summary

576 0 0 0Flakiness 0


Run details

Project cypress
Status Passed
Commit 32b061f
Started Feb 8, 2022 5:28 PM
Ended Feb 8, 2022 5:38 PM
Duration 09:08 💡
OS Linux Debian - 10.10
Browser Electron 94

View run in Cypress Dashboard ➡️


This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@ZachJW34 ZachJW34 merged commit dd11945 into master Feb 8, 2022
@ZachJW34 ZachJW34 deleted the fix-react-scripts-node-12 branch February 8, 2022 17:57
tgriesser added a commit that referenced this pull request Feb 14, 2022
* develop:
  feat: gray out the path to system node in cypress run header (#20121)
  feat: redesign server errors (#20072)
  test: fix awesome-typescript-loader test and remove test-binary job (#20131)
  fix: Fix issues with stack traces and command log in Chrome 99 (#20049)
  fix: `cy.type(' ')` fires click event on button-like elements. (#20067)
  fix: `change`, `input` events are not fired when the same option is selected again. (#19623)
  build: publish vue3 on latest (#20099)
  chore: release @cypress/webpack-preprocessor-v5.11.1
  chore: release @cypress/webpack-dev-server-v1.8.1
  fix: detect newly added specs in dev-server compilation (#17950)
  chore: Remove pkg/driver //@ts-nocheck part 3 (#19837)
  chore: set up semantic-pull-request GitHub Action (#20091)
  chore: release @cypress/react-v5.12.2
  fix: remove nullish coalescing in js files to support node 12 (#20094)
  docs: update @cypress/webpack-preprocessor links (#19902)
  refactor: use aliases instead of meta (#19566)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants