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 optional chaining syntax to fix esm #1234

Conversation

jacobhaile
Copy link

What: Removing the optional chainging "?" syntax from the index file

Why: The optional chaining syntax can cause compilation breaks

How: Break out the optional changing into an && statement

Checklist:

  • [N/A] Documentation added to the
    docs site
  • [N/A] Tests
  • [N/A] TypeScript definitions updated
  • Ready to be merged

Removing the optional chainging "?" syntax from the index file as this
can cause compilation breaks.
@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 2df7922:

Sandbox Source
React Configuration
react-testing-library-examples Configuration

@codecov
Copy link

codecov bot commented Aug 17, 2023

Codecov Report

Merging #1234 (2df7922) into main (6de5f4c) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main     #1234   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            4         4           
  Lines          192       194    +2     
  Branches        38        40    +2     
=========================================
+ Hits           192       194    +2     
Flag Coverage Δ
canary 100.00% <100.00%> (ø)
experimental 100.00% <100.00%> (ø)
latest 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
src/index.js 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@MatanBobi
Copy link
Member

Hi @jacobhaile!
Thanks for taking the time to open this.
Since we're targeting Node 14 as the minimal engine and optional chaining is available from Node 14, I believe this change is not needed.
Thanks again!

@MatanBobi MatanBobi closed this Aug 17, 2023
@jacobhaile
Copy link
Author

Thanks for the time @MatanBobi!

Does this account for esm files? I upgraded react-testing-library to v14 and I'm seeing my cypress runs impacted because of that optional chaining syntax. I'm on node v16.

@MatanBobi MatanBobi reopened this Aug 20, 2023
@MatanBobi
Copy link
Member

That's a good question @jacobhaile, I must admit I'm not entirely on the ESM train. I'll have to look into it a bit more. Not sure I'll have the time for it soon so I'm opening this PR and if someone has an opinion, they're more than free to post it :)

@nickserv
Copy link
Member

Since we're targeting Node 14 as the minimal engine and optional chaining is available from Node 14, I believe this change is not needed.

@MatanBobi I believe this is correct.

@jacobhaile I can't reproduce this issue with Cypress. Can you please share a reproduction?

@jacobhaile
Copy link
Author

I can close out -- I no longer get the error after updating to Cypress v13

@jacobhaile jacobhaile closed this Oct 20, 2023
@MatanBobi
Copy link
Member

Thanks for the update @jacobhaile :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants