Skip to content

feat(helpers): resolve primitive fake property chains#3882

Open
puneetdixit200 wants to merge 1 commit into
faker-js:nextfrom
puneetdixit200:fix-fake-primitive-property-chain
Open

feat(helpers): resolve primitive fake property chains#3882
puneetdixit200 wants to merge 1 commit into
faker-js:nextfrom
puneetdixit200:fix-fake-primitive-property-chain

Conversation

@puneetdixit200
Copy link
Copy Markdown

Summary

  • resolve properties on primitive values returned while evaluating helpers.fake/fakeEval chains
  • bind resolved prototype methods to their source value so chained calls keep the correct receiver
  • add regressions for implicit and explicit generated primitive property chains

Closes #3465

Verification

  • corepack pnpm exec vitest run test/modules/helpers-eval.spec.ts test/modules/helpers.spec.ts
  • corepack pnpm exec prettier --check src/modules/helpers/eval.ts test/modules/helpers-eval.spec.ts test/modules/helpers.spec.ts
  • corepack pnpm exec eslint src/modules/helpers/eval.ts test/modules/helpers-eval.spec.ts test/modules/helpers.spec.ts
  • git diff --check
  • corepack pnpm exec vitest run test/scripts/shared/markdown.spec.ts
  • corepack pnpm run ts-check
  • corepack pnpm run test

@puneetdixit200 puneetdixit200 requested a review from a team as a code owner June 4, 2026 05:05
@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 4, 2026

Deploy Preview for fakerjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 14c0ba1
🔍 Latest deploy log https://app.netlify.com/projects/fakerjs/deploys/6a21079577f7180008a183b5
😎 Deploy Preview https://deploy-preview-3882.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
Copy link
Copy Markdown

codecov Bot commented Jun 4, 2026

Codecov Report

❌ Patch coverage is 87.50000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 98.89%. Comparing base (5bd8709) to head (14c0ba1).
⚠️ Report is 1 commits behind head on next.

Files with missing lines Patch % Lines
src/modules/helpers/eval.ts 87.50% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #3882      +/-   ##
==========================================
- Coverage   98.92%   98.89%   -0.03%     
==========================================
  Files         908      908              
  Lines        3159     3165       +6     
  Branches      581      566      -15     
==========================================
+ Hits         3125     3130       +5     
- Misses         30       31       +1     
  Partials        4        4              
Files with missing lines Coverage Δ
src/modules/helpers/eval.ts 94.66% <87.50%> (-0.99%) ⬇️
🚀 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
Copy link
Copy Markdown
Member

ST-DDT commented Jun 4, 2026

Thanks for contributing to faker. ❤️

Please note: This may cause a merge conflict with #3857

So this may take far longer than usual to merge.

@ST-DDT ST-DDT added c: feature Request for new feature p: 1-normal Nothing urgent m: helpers Something is referring to the helpers module labels Jun 4, 2026
@ST-DDT
Copy link
Copy Markdown
Member

ST-DDT commented Jun 4, 2026

Please update the relevant jsdoc as well e.g.

* It is also NOT possible to use any non-faker methods or plain javascript in such patterns.

@ST-DDT ST-DDT changed the title fix(helpers): resolve primitive fake property chains feat(helpers): resolve primitive fake property chains Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c: feature Request for new feature m: helpers Something is referring to the helpers module p: 1-normal Nothing urgent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

helpers.fake - patterns after root expression fail when referencing instance members

2 participants