Skip to content

feat(person)!: include 'generic' in person.sexType() by default - #4150

Open
saadkhantareen wants to merge 1 commit into
faker-js:nextfrom
saadkhantareen:feat/3694-sextype-include-generic-default
Open

saadkhantareen wants to merge 1 commit into
faker-js:nextfrom
saadkhantareen:feat/3694-sextype-include-generic-default

Conversation

@saadkhantareen

Copy link
Copy Markdown

Summary

Implements the v11 target behavior described in #3694: faker.person.sexType() now includes 'generic' in its potential outputs by default. The includeGeneric option now defaults to true instead of false.

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 the generic definition lists, as specified in the issue's target behavior.

Changes

  • src/modules/person/sex-type.ts: default includeGeneric to true; updated the JSDoc (@default true).
  • src/modules/person/module.ts: same JSDoc default update for PersonModule.sexType().
  • src/modules/image/person-portrait.ts: when re-rolling a 'generic' sex, call personSexType() 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 any Sex value (including 'generic') instead of only 'female'/'male'.
  • Updated seeded snapshots that change as a consequence of the new default (person, image, internet, location, git, and the API-docs markdown snapshot). For example, seed 42 now yields sexType() // "generic" and firstName() 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.
  • Full suite pnpm exec vitest run -u — 55802 tests passed, 13 snapshots updated. The remaining failures in test/locale-imports.spec.ts, test/exports.spec.ts, test/require.spec.cts, test/docs/versions.spec.ts, test/scripts/** and test/simple-faker.spec.ts also occur on the unmodified next branch in this environment (they require build artifacts), and are unrelated to this change.
  • pnpm run generate:module-tree and pnpm run generate:api-docs — no additional diffs.
  • oxlint on the changed source files — 0 warnings, 0 errors. oxfmt --check on the changed files — clean.

Fixes #3694

@saadkhantareen
saadkhantareen requested a review from a team as a code owner October 14, 2026 10:39
Copilot AI balanced review requested due to automatic review settings October 14, 2026 10:39
@netlify

netlify Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for fakerjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit a6b3fe2
🔍 Latest deploy log https://app.netlify.com/projects/fakerjs/deploys/6acf5bd1866e15ac9b0b21ca
😎 Deploy Preview https://deploy-preview-4150.fakerjs.dev
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

person.sexType change options.includeGeneric default value to true

2 participants