Repository navigation
feat(person)!: include 'generic' in person.sexType() by default - #4150
Open
saadkhantareen wants to merge 1 commit into
Open
saadkhantareen wants to merge 1 commit into
saadkhantareen wants to merge 1 commit into
Conversation
✅ Deploy Preview for fakerjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the v11 target behavior described in #3694:
faker.person.sexType()now includes'generic'in its potential outputs by default. TheincludeGenericoption now defaults totrueinstead offalse.Because name generation picks a random sex type when no sex is provided, methods such as
faker.person.firstName()can now also select entries from thegenericdefinition lists, as specified in the issue's target behavior.Changes
src/modules/person/sex-type.ts: defaultincludeGenerictotrue; updated the JSDoc (@default true).src/modules/person/module.ts: same JSDoc default update forPersonModule.sexType().src/modules/image/person-portrait.ts: when re-rolling a'generic'sex, callpersonSexType()with{ includeGeneric: false }. With the new default, a plain re-roll could return'generic'again and produce a portrait URL for a sex that has no portrait directory.test/modules/person.spec.ts: the default-behavior test now expects anySexvalue (including'generic') instead of only'female'/'male'.42now yieldssexType() // "generic"andfirstName()draws from the generic-inclusive selection.docs/guide/upgrading_v11/3694.md: migration note describing the change and how to keep the previous behavior via{ includeGeneric: false }.Tests
pnpm exec vitest run test/modules/person.spec.ts test/modules/image.spec.ts— all tests pass after updating the affected snapshots (323 tests).pnpm exec vitest run test/locale-data.spec.ts test/modules/person.spec.ts test/modules/image.spec.ts— 3187 passed, 0 failed, no type errors.pnpm exec vitest run -u— 55802 tests passed, 13 snapshots updated. The remaining failures intest/locale-imports.spec.ts,test/exports.spec.ts,test/require.spec.cts,test/docs/versions.spec.ts,test/scripts/**andtest/simple-faker.spec.tsalso occur on the unmodifiednextbranch in this environment (they require build artifacts), and are unrelated to this change.pnpm run generate:module-treeandpnpm run generate:api-docs— no additional diffs.oxlinton the changed source files — 0 warnings, 0 errors.oxfmt --checkon the changed files — clean.Fixes #3694