Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add onGenerateMock transformer callback (#15429) #15433

Merged
merged 5 commits into from
Jan 15, 2025

Conversation

MillerSvt
Copy link
Contributor

@MillerSvt MillerSvt commented Dec 30, 2024

Summary

Add ability to modify generated mock within presets or project code (Closes #15429, thymikee/jest-preset-angular#2908)

Test plan

Run test in packages/jest-runtime/src/__tests__/runtime_mock.test.js

Copy link

linux-foundation-easycla bot commented Dec 30, 2024

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link

netlify bot commented Dec 30, 2024

Deploy Preview for jestjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit b709d31
🔍 Latest deploy log https://app.netlify.com/sites/jestjs/deploys/6787735ab7306c0008a1f007
😎 Deploy Preview https://deploy-preview-15433--jestjs.netlify.app
📱 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 site configuration.

@MillerSvt MillerSvt force-pushed the jest-on-mock-hook branch 4 times, most recently from ec88557 to 1e3405a Compare December 30, 2024 08:53
Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

this is awesome, thanks!

mind adding some docs in https://github.com/jestjs/jest/blob/main/docs/JestObjectAPI.md as well?

@MillerSvt
Copy link
Contributor Author

Sure

@MillerSvt MillerSvt requested a review from SimenB January 15, 2025 06:58
Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

awesome, thank you!

@SimenB SimenB enabled auto-merge (squash) January 15, 2025 07:01
packages/jest-environment/src/index.ts Outdated Show resolved Hide resolved
packages/jest-environment/src/index.ts Outdated Show resolved Hide resolved
auto-merge was automatically disabled January 15, 2025 07:03

Head branch was pushed to by a user without write access

@MillerSvt MillerSvt requested a review from mrazauskas January 15, 2025 07:03
*
* @param cb
*/
onGenerateMock<T>(cb: (moduleName: string, moduleMock: T) => T): Jest;
Copy link
Member

Choose a reason for hiding this comment

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

this is duplicated now, unless I'm seeing things 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems rebase breaks 😃

@SimenB SimenB enabled auto-merge (squash) January 15, 2025 09:22
@SimenB SimenB merged commit 3088367 into jestjs:main Jan 15, 2025
84 checks passed
mohammednumaan pushed a commit to mohammednumaan/jest that referenced this pull request Jan 17, 2025
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.

[Feature]: Add ability for presets interfere with jest auto mock
3 participants