-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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(jest): expose Config
type from jest
#12848
Conversation
This is all about how it looks like. So, here is preview: https://deploy-preview-12848--jestjs.netlify.app/docs/next/configuration |
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.
I like this approach more!
From a quick glance through, the docs now no longer mention the config can export an async function, beyond that it looks like all is covered.
I'm AFK until wednesday (https://en.wikipedia.org/wiki/Constitution_Day_(Norway)), but I'll read through the docs more thoroughly then 👍
It would be nice to make the tabs implementation less verbose, e.g.: :::tabs
// js code
// ts code
:::
I was looking at |
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 is fantastic 👏
I really like defaulting to JS config all over, plus showing both JS and TS examples - the tabs work great 👍
Co-authored-by: Simen Bekkhus <[email protected]>
By the way, I almost finished a Docusaurus plugin which creates a box with two tabs out of this (imagine backtics instead): '''js tabs
// some js code
'''
'''ts tabs
// some ts code
''' |
JestConfig
typeConfig
type from jest
Hm.. Seems like deploy is failing for few days. @SimenB could you take a look, please? (; |
Website deployment was successful today, btw. Thanks for noticing! |
Great. Tabs look really good. I'm happy about the result. Nice! |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Closes #12037
Closes #12801
Summary
This second attempt to unify the style of configuration examples. Previously (in #12037) I was trying to refactor all config to JSON. That looked alright, but something was missing. This PR is based #12817 (comment) in which the user suggesting that the examples could be functioning copy-paste code.
Interesting. Made me think in that direction. In that PR only CJS syntax was covered, but it is possible to have JS, TS tabs. For instance, Playwright’s config examples are written in this way.
JestConfig
type is borrowed from my other PR. This is simply a reexport ofConfig.InitialOptions
. Just thinking out loud, I am fine to use either.The motivation to add
JestConfig
:Config.InitialOptions
is verbose and feels like an internal type.JestConfig
fromjest
does not require to install additional package to pass stricter audit.No feelings hurt is something looks unacceptable. In my projects Jest configs are mostly written in JSON, to be honest ;D
Test plan
Tests are added. Lint should pass.