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
test: enable typecheck for _config files #4954
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov Report
@@ Coverage Diff @@
## master #4954 +/- ##
==========================================
- Coverage 98.99% 98.96% -0.03%
==========================================
Files 222 222
Lines 8123 8123
Branches 2237 2237
==========================================
- Hits 8041 8039 -2
- Misses 28 29 +1
- Partials 54 55 +1 |
I tried to understand what each configuration stands for in the tsdocs - feel free to directly update them if you see any improvements. |
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 actually a great idea! One thing that could be improved, though: The different test types do not support the same fields. Many are shared, of course, like description
or solo
. But only function tests support exports
and global
and some other props, while formats
I think is specific to chunking-form (would need to check). It would be nice to have this difference also in the type check. One thing that happens quite often is that a test is converted between function
and form
. At that point, the additional check would help to highlight if the config needs to be changed.
One idea could be to have different helpers, e.g. defineFunctionTest
, defineChunkingTest
, defineFormTest
,... (and I do not think we need Rollup in the name to keep the names shorter).
While you would get no warning if you use the wrong global, using the wrong global would immediately turn the actual test red because each test type only injects the global for this type (or injects something that throws a more helpful error for the others).
Or maybe you have a better idea?
Interesting! I think maybe I could make it work using the same function name in different directly. Let me play with it! |
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.
That looks amazing! Now the only thing is that we have a million of type errors...
Maybe we could disable the typecheck for now (but we will still get the autocomplete, etc.) and opt-in by |
d935194
to
9db29e0
Compare
I finalized the types for the available properties per test now and would merge this now. There are still some subtle things I am not happy about, though. Mostly, there are some issues as TypeScript does not like importing types from outside the current tsconfig file. One way to solve this could be to go back to a single tsconfig for tests and have different test helpers per test type, but maybe for another PR. |
714fafd
to
218bea1
Compare
218bea1
to
fceb680
Compare
Thanks! |
This PR has been released as part of rollup@3.21.3. You can test it via |
This PR contains:
Are tests included?
Breaking Changes?
List any relevant issue numbers:
Description
This would be helpful for contributors to write tests, and see what is available as test options.
Currently, it only enables IDE type-checking as some of the functions are not fully type-covered. We could improve the along the way, but right now, being able to typecheck the Rollup options field
options
is a huge improve to me already.