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 Node.js without ICU support #1144

Merged
merged 1 commit into from
Aug 14, 2024
Merged

Fix Node.js without ICU support #1144

merged 1 commit into from
Aug 14, 2024

Conversation

ehmicky
Copy link
Collaborator

@ehmicky ehmicky commented Aug 13, 2024

Fixes #1143.

This PR does not add any documentation because this is a very tiny edge case that almost nobody will encounter:

  • Running Node.js without ICU support requires building your own Node.js binary. No pre-built binary without ICU support seems to be available.
  • Then, the user would need to use very special characters in the command, such as isolated surrogate characters or reserve Unicode codepoints (which is quite unlikely) to notice any difference.
  • Even then, the only difference would only be that those special characters would be printed as is on the terminal (when using result.escapedCommand) instead of being represented as a backslash sequence \u..., which is not a big problem.

}

static isMocked = true;
};
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot find a simple way to run tests using Node without ICU support. So this mimics it for our purpose.

};

// Execa computes the RegExp when first loaded, so we must delay this import
await import('./escape.js');
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could mock/unmock RegExp directly in escape.js, and run each test twice. But then each test would need to be serial. Also it makes the test file a little complex (this was my first approach). Using a separate test file that imports the other one results in less code.

@ehmicky ehmicky mentioned this pull request Aug 13, 2024
@sindresorhus sindresorhus merged commit 074ea4a into main Aug 14, 2024
12 checks passed
@sindresorhus sindresorhus deleted the char-escape branch August 14, 2024 12:54
@Uzlopak
Copy link

Uzlopak commented Aug 14, 2024

When will it be released? :)

@ehmicky
Copy link
Collaborator Author

ehmicky commented Aug 14, 2024

This has now been released in 9.3.1. Thanks again for your help.

Is this working?

@Uzlopak
Copy link

Uzlopak commented Aug 14, 2024

Thank you. Yes :). Great Success.

PS:
https://x.com/uzlopak_js/status/1823796028182814975

@ehmicky
Copy link
Collaborator Author

ehmicky commented Aug 14, 2024

Thanks for the shout out @Uzlopak, that's very kind! 🙏

@Uzlopak
Copy link

Uzlopak commented Aug 14, 2024

Unfortunately, you are not on twitter, or else I would have linked you.

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.

Intl needed for v. 9
3 participants