Skip to content

Conversation

@Noyabronok
Copy link
Contributor

@Noyabronok Noyabronok commented Jun 24, 2025

Status

READY

Description

Fix #2175
Adding an option to pass a seed to faker ensures we always get reproducible output.

Todos

  • Tests
  • Documentation
  • Changelog Entry (unreleased)

Steps to Test

  1. in the tests folder run yarn generate:mock
  2. Observe the fakers.seed(...) calls right after imports in tests/generated/mock/ project files with a seed defined in the mock.config.ts file

@Noyabronok Noyabronok force-pushed the feature-faker-seed branch from 405fcfc to 706fad3 Compare June 24, 2025 23:25
@melloware
Copy link
Collaborator

Looks like failing tests

@Noyabronok Noyabronok force-pushed the feature-faker-seed branch from 706fad3 to f6fa89f Compare June 25, 2025 00:51
@Noyabronok
Copy link
Contributor Author

Looks like failing tests

should be fixed now

@melloware
Copy link
Collaborator

Your changes are in MSW package only? I would have expected some changes in the faker package too?

@Noyabronok
Copy link
Contributor Author

Your changes are in MSW package only? I would have expected some changes in the faker package too?

From what I can tell, the faker folder doesn't contain any faker imports.

@melloware
Copy link
Collaborator

OK yeah i don't use faker i just thought it was odd it was an MSW only change :)

cc @soartec-lab thoughts?

@melloware melloware requested a review from soartec-lab June 25, 2025 13:56
@melloware melloware added mock Related to mock generation msw MSW related issues labels Jun 25, 2025
@soartec-lab soartec-lab self-assigned this Jul 6, 2025
Copy link
Member

@soartec-lab soartec-lab left a comment

Choose a reason for hiding this comment

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

@Noyabronok
Thanks for the great improvements. I left some comments.

const server = setupServer();
server.use(...getPetsMock());
```

Copy link
Member

Choose a reason for hiding this comment

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

We need documentation for the property in the reference too.

https://orval.dev/reference/configuration/output#mock

isAllowSyntheticDefaultImports,
);

const seed = options?.seed;
Copy link
Member

Choose a reason for hiding this comment

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

I think faker's concerns should be grouped in faker-related files like faker/getters.

@soartec-lab soartec-lab marked this pull request as draft August 20, 2025 14:35
@soartec-lab
Copy link
Member

@Noyabronok
I have commented on this, so please check it. Once you have responded, please reopen the page and I will review it at any time 👍

Copy link
Member

@soartec-lab soartec-lab left a comment

Choose a reason for hiding this comment

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

I changed status to "request change"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mock Related to mock generation msw MSW related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Seed faker to reduce mock data diff noise

3 participants