Skip to content

docs(lorem): document the fail default strategy for word#3944

Open
spokodev wants to merge 1 commit into
faker-js:nextfrom
spokodev:fix/lorem-word-default-strategy
Open

docs(lorem): document the fail default strategy for word#3944
spokodev wants to merge 1 commit into
faker-js:nextfrom
spokodev:fix/lorem-word-default-strategy

Conversation

@spokodev

@spokodev spokodev commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

faker.lorem.word documents an any-length default resolution strategy, returning a word of any length when none matches the requested length. The change that switched the shared word length filter to the fail strategy (#3560) targeted only the word module, but lorem.word forwards its options to that filter without a strategy, so it started throwing No words found that match the given length. The upgrade guide only lists faker.word.* methods for this breaking change, and lorem.word's JSDoc still documents any-length.

This passes any-length as the default while still letting a caller-provided strategy override it, restoring the documented behavior. Adds a regression test.

@spokodev spokodev requested a review from a team as a code owner July 8, 2026 13:44
@netlify

netlify Bot commented Jul 8, 2026

Copy link
Copy Markdown

Deploy Preview for fakerjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 409f25d
🔍 Latest deploy log https://app.netlify.com/projects/fakerjs/deploys/6a5149bc4096550008779584
😎 Deploy Preview https://deploy-preview-3944.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.

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.84%. Comparing base (c2cd91d) to head (409f25d).

Additional details and impacted files
@@           Coverage Diff           @@
##             next    #3944   +/-   ##
=======================================
  Coverage   98.84%   98.84%           
=======================================
  Files         923      923           
  Lines        3216     3216           
  Branches      583      583           
=======================================
  Hits         3179     3179           
  Misses         33       33           
  Partials        4        4           
Files with missing lines Coverage Δ
src/modules/lorem/module.ts 100.00% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ST-DDT ST-DDT left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nicely spottled.

AFAICT the implementation was changed as part of a major change.
While not exlicitly in the breaking changes list, it has been like this for the entirety of v10, so IMO we should change the jsdocs. Not the implementation.
I consider the current implementation to be correct.

Comment thread src/modules/lorem/module.ts Outdated
Comment thread src/modules/lorem/module.ts Outdated
@ST-DDT ST-DDT added c: bug Something isn't working c: docs Improvements or additions to documentation m: lorem Something is referring to the lorem module labels Jul 8, 2026
@ST-DDT ST-DDT added this to the v10.x milestone Jul 8, 2026
@spokodev spokodev force-pushed the fix/lorem-word-default-strategy branch from fcdb2a5 to 615800b Compare July 8, 2026 20:15
@spokodev spokodev changed the title fix(lorem): keep the any-length default strategy for word docs(lorem): document the fail default strategy for word Jul 8, 2026
@spokodev

spokodev commented Jul 8, 2026

Copy link
Copy Markdown
Contributor Author

Makes sense — reverted the implementation change and fixed the word() JSDoc instead (it documented the default as any-length, when it's actually fail). The PR is docs-only now.

@spokodev spokodev force-pushed the fix/lorem-word-default-strategy branch from 615800b to 409f25d Compare July 10, 2026 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: bug Something isn't working c: docs Improvements or additions to documentation m: lorem Something is referring to the lorem module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants