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

Add Jest.mergePreset helper function #126

Merged
merged 7 commits into from
Jun 29, 2020
Merged

Add Jest.mergePreset helper function #126

merged 7 commits into from
Jun 29, 2020

Conversation

72636c
Copy link
Member

@72636c 72636c commented Jun 29, 2020

This concatenates array options, unlike Jest's built-in preset support which discards the original array elements.

This concatenates array options, unlike Jest's built-in `preset` support
which discards the original array elements.
@changeset-bot
Copy link

changeset-bot bot commented Jun 29, 2020

🦋 Changeset is good to go

Latest 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

@72636c 72636c changed the title [RFC] Add Jest.extends helper function [RFC] Add Jest.extend helper function Jun 29, 2020
@72636c 72636c requested a review from a team June 29, 2020 11:04
@72636c 72636c changed the title [RFC] Add Jest.extend helper function [RFC] Add Jest.preset helper Jun 29, 2020
@etaoins
Copy link
Contributor

etaoins commented Jun 29, 2020

I like the idea but I think the name is non-obvious. Would something like Jest.mergePreset make sense?

@72636c 72636c changed the title [RFC] Add Jest.preset helper Add Jest.mergePreset helper function Jun 29, 2020
@72636c 72636c marked this pull request as ready for review June 29, 2020 23:22
@72636c 72636c merged commit 9146b4a into master Jun 29, 2020
@72636c 72636c deleted the jest-extends branch June 29, 2020 23:33
Comment on lines +6 to +19
type Props = Pick<
Config.InitialOptions,
| 'collectCoverage'
| 'collectCoverageFrom'
| 'collectCoverageOnlyFrom'
| 'coveragePathIgnorePatterns'
| 'coverageThreshold'
| 'globals'
| 'globalSetup'
| 'globalTeardown'
| 'setupFiles'
| 'setupFilesAfterEnv'
| 'testPathIgnorePatterns'
>;

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 :)

Copy link
Member Author

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).

Copy link
Member Author

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

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.

None yet

3 participants