-
Notifications
You must be signed in to change notification settings - Fork 35
chore: allow testMany args to accept glob patterns #702
Conversation
⏱ Benchmark resultslargeDepsEsbuild: 13.5s
Legend
largeDepsZisi: 1m 14.6s
Legend
|
another demo: Screen.Recording.2021-10-05.at.12.22.39.mov |
tests/helpers/globify.ts
Outdated
? '*' | `${Head}*` | `${Head}_${Globify<Tail>}` | ||
: S | '*' | ||
|
||
type Test = Globify<'foo_bar' | 'foo_bar_baz' | 'yeet'> |
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.
Do we need these?
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.
not neccessarily - (I used them for verifying that the type works as expected) - but they don't really hurt either, as they'll never be shipped and are used only be the editor
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.
Sure, but why keep them if they're not doing anything?
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.
good point. I've transformed them into type-level tests: https://github.com/netlify/zip-it-and-ship-it/pull/702/files/7f867da77363718059c2d449e91b8750f9926b86..3ef4abe7fa6e91e9f1657b4e18187ade118971f5
so now they work as documentation & tests :)
(since we haven't integrated our test suite with TypeScript yet, this won't do anything apart from being squiggly in the editor - but that's a start ^^)
Co-authored-by: Netlify Team Account 1 <90322326+netlify-team-account-1@users.noreply.github.com>
…-ship-it into testmany-glob
Co-authored-by: Eduardo Bouças <mail@eduardoboucas.com>
this will likely need to be updated to support the |
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.
Sorry for taking so long to review this! It looks great, I would just say two things:
-
I always try to look for a solid reason to add another dependency, because that always carries a price. I understand that
conditional-type-checks
is being added todevDependencies
, for which the price is considerably lower, but it's there nonetheless. Can you clarify why we need the functionality it introduces, since the types being asserted only exist in the context of the test suite? -
Can we make this PR about adding the glob capability only, and then we decide which tests to convert to globs on a per-test basis, in separate PRs?
advanced typescript types are somewhat hard to understand.
Absolutely! done via 8660f19 |
I understand that, and type assertions feel like something we should do since the types are part of the API we offer to people consuming our libraries. But in this case we're adding type assertions to something that only exists in the context of the test suite, which I find a bit harder to understand.
I think the glob patterns in |
agreed! |
- Summary
(builds on #701)
This PR allows
testMany
variations to be passed in using patterns, and also adds a fancy recursive typescript type to give nice autocomplete to it.- Test plan
- A picture of a cute animal (not mandatory but encouraged)