-
Notifications
You must be signed in to change notification settings - Fork 34
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
Add Jest.mergePreset
helper function
#126
Conversation
This concatenates array options, unlike Jest's built-in `preset` support which discards the original array elements.
🦋 Changeset is good to goLatest commit: 04d452a We got this. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Jest.extends
helper functionJest.extend
helper function
Jest.extend
helper functionJest.preset
helper
I like the idea but I think the name is non-obvious. Would something like |
Jest.preset
helperJest.mergePreset
helper function
type Props = Pick< | ||
Config.InitialOptions, | ||
| 'collectCoverage' | ||
| 'collectCoverageFrom' | ||
| 'collectCoverageOnlyFrom' | ||
| 'coveragePathIgnorePatterns' | ||
| 'coverageThreshold' | ||
| 'globals' | ||
| 'globalSetup' | ||
| 'globalTeardown' | ||
| 'setupFiles' | ||
| 'setupFilesAfterEnv' | ||
| 'testPathIgnorePatterns' | ||
>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@72636c Sorry to comment on an old PR, but I'm trying to understand why only a subset of jest configuration options is "Pick"ed in this type Props
. Couldn't teams be given access to all Jest options? Ones that we would like to use for instance is https://jestjs.io/docs/configuration#clearmocks-boolean and https://jestjs.io/docs/configuration#resetmocks-boolean
I can definitely add those as types to the list or ignore the typescript issue in our project, just wondering the background context as to why its limited :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @benjaminpearson! The idea was to only expose options that "safely" extend our preset and wouldn't conflict with things we'd want to manage internally now or in future. But given how long this allowlist has grown, I'm 50:50 on whether to keep extending it or just allow the full list through.
Those two look perfectly reasonable (I wonder if they could even be defaults at some point).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be resolved in the next release: #798
This concatenates array options, unlike Jest's built-in
preset
support which discards the original array elements.