Closed ST-DDT closed 1 year ago
Also:
VITEST_SEQUENCE_SEED 1675271531940 https://github.com/faker-js/faker/actions/runs/4066878355/jobs/7003536672
The same error again:
VITEST_SEQUENCE_SEED 1675275945101
https://github.com/faker-js/faker/actions/runs/4067493397/jobs/7004904658
the name comes from faker.person.fullName
, which in the English locale can contain ' in addition to A-Za-z.
Whereas the regex only allows \w (which doesn't include '), . and space.
So blindly adding ' would indeed fix it.
If the same test was run in other locales, it would still fail as they could contain other unicode chars. But as the test is only run in English at the moment i think this would suffice.
btw is there any way in the logs to make it print out the full string for expected value? The way it ellipsizes the full value is annoying.
btw is there any way in the logs to make it print out the full string for expected value? The way it ellipsizes the full value is annoying.
Vitest also has a documentation website, even with search function https://vitest.dev/config/#outputtruncatelength
Now the funny part: the option does not work 🤦 I will open an issue in Vitest...
So blindly adding ' would indeed fix it.
I would still like to know which characters are allowed there (and how it is called).
We could see the failing test as an implementation error as well. The questions we have to answer are:
If the same test was run in other locales, it would still fail as they could contain other unicode chars.
This could be solved by defining that the generated user is always a username instead of using a fullname.
Unicode characters are permissible according to https://stackoverflow.com/questions/24845258/is-it-ok-to-use-a-long-non-ascii-name-for-the-user-name-git-configuration
Honestly I'd just add the ' for now to fix the intermittent CI errors and leave a TODO to revisit this later if tests are added for every locale. Regex for Unicode text can be quite tricky, and I don't think this is a heavily used method in faker.
instead of [\w_\. ']+
you could just do something like [^<]+
as <
will be the first char of the email address.
i noticed if i do
git config user.name "matt < hello"
then my author line looks like
Author: matt hello <matt@example.com>
so it seems to be stripping out angle brackets to avoid confusion with the email
bit more info on stripping:
Now we coming closer to an appropriated solution 👍
So we should actually refactor the implementation to normalize the username/full name before using it in the commit entry.
What are you referring to with normalization? IMO we should make sure we pass the correct validation, but for that we need to actually have the correct validation.
What are you referring to with normalization? IMO we should make sure we pass the correct validation, but for that we need to actually have the correct validation.
They mean normalize the generated values inside commitEntry
to strip out invalid chars
Like doing an extra step in line 114 for variable user
Hmm how would you test that though considering fullName never includes a <
VITEST_SEQUENCE_SEED 1675266128640
https://github.com/faker-js/faker/actions/runs/4066068064/jobs/7002435580
The regex needs to be checked for correctness (blindy adding
'
is a non goal).