Skip to content

feat: Add support for UPC - #3648

Merged
xDivisionByZerox merged 7 commits into
faker-js:nextfrom
Dhanush-K-Gowda:feature_commerce_upc
Nov 9, 2025
Merged

feat: Add support for UPC#3648
xDivisionByZerox merged 7 commits into
faker-js:nextfrom
Dhanush-K-Gowda:feature_commerce_upc

Conversation

@Dhanush-K-Gowda

Copy link
Copy Markdown
Contributor

This PR fixes #3446
Have introduced support for UPC

@Dhanush-K-Gowda
Dhanush-K-Gowda requested a review from a team as a code owner November 3, 2025 19:51
@netlify

netlify Bot commented Nov 3, 2025

Copy link
Copy Markdown

Deploy Preview for fakerjs ready!

Name Link
🔨 Latest commit b6797be
🔍 Latest deploy log https://app.netlify.com/projects/fakerjs/deploys/690fee8093e3aa0008f88e5a
😎 Deploy Preview https://deploy-preview-3648.fakerjs.dev
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

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

@xDivisionByZerox xDivisionByZerox added c: feature Request for new feature p: 1-normal Nothing urgent m: commerce Something is referring to the commerce module labels Nov 3, 2025
Comment thread src/modules/commerce/index.ts Outdated
Comment thread src/modules/commerce/index.ts Outdated
Comment thread src/modules/commerce/index.ts Outdated
Comment thread src/modules/commerce/index.ts
Comment thread src/modules/commerce/index.ts Outdated
Comment thread src/modules/commerce/index.ts Outdated
@Shinigami92
Shinigami92 marked this pull request as draft November 6, 2025 11:29
@matthewmayer

Copy link
Copy Markdown
Contributor

please update snapshot tests using pnpm run test -u

In general you can run pnpm run preflight locally to lint and test everything locally to avoid CI errors.

@Dhanush-K-Gowda

Copy link
Copy Markdown
Contributor Author

please update snapshot tests using pnpm run test -u

In general you can run pnpm run preflight locally to lint and test everything locally to avoid CI errors.

I'm really sorry, I ran pnpm run preflight on my local Ubuntu machine and didn’t encounter any errors. I’m not sure what’s causing these test failures here, but I’ll look into it and follow up shortly.

@Dhanush-K-Gowda

Copy link
Copy Markdown
Contributor Author

Just realized the CI builds were failing because I hadn’t included the snapshots in the PR. Added them now , should work fine

@Dhanush-K-Gowda
Dhanush-K-Gowda marked this pull request as ready for review November 7, 2025 04:29
@codecov

codecov Bot commented Nov 7, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.18919% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.97%. Comparing base (bfb1bdb) to head (b6797be).
⚠️ Report is 1 commits behind head on next.

Files with missing lines Patch % Lines
src/modules/commerce/upc-check-digit.ts 75.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #3648      +/-   ##
==========================================
- Coverage   99.97%   99.97%   -0.01%     
==========================================
  Files        2993     2994       +1     
  Lines      236268   236305      +37     
  Branches      930      940      +10     
==========================================
+ Hits       236215   236248      +33     
- Misses         53       57       +4     
Files with missing lines Coverage Δ
src/modules/commerce/index.ts 97.96% <100.00%> (+0.24%) ⬆️
src/modules/commerce/upc-check-digit.ts 75.00% <75.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.

Comment thread test/modules/commerce.spec.ts
Comment thread test/modules/commerce.spec.ts Outdated
Comment thread test/modules/commerce.spec.ts Outdated
Comment thread test/modules/commerce.spec.ts Outdated
@matthewmayer

Copy link
Copy Markdown
Contributor

CI has passed now, thanks! Just have some nitpicks on the tests.

@Shinigami92 Shinigami92 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.

Made a general review, and thanks a lot @matthewmayer for taking over the detailed review here 👍
When the points from Matt are addressed, I can give my approval ✅

@Dhanush-K-Gowda

Copy link
Copy Markdown
Contributor Author

All changes are in. Thanks for checking it out. @matthewmayer @Shinigami92

@xDivisionByZerox xDivisionByZerox 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.

Looks good. Thank you for implementing this feature. 👍

@xDivisionByZerox xDivisionByZerox added this to the v10.x milestone Nov 9, 2025
@xDivisionByZerox
xDivisionByZerox added this pull request to the merge queue Nov 9, 2025
Merged via the queue into faker-js:next with commit 57b2d78 Nov 9, 2025
23 checks passed
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: commerce Something is referring to the commerce module p: 1-normal Nothing urgent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a new method faker.commerce.upc() to generate a valid Universal Product Code (UPC).

4 participants