-
Notifications
You must be signed in to change notification settings - Fork 565
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
tests as docs: split snapshot files to make test outputs better accessible #856
Comments
@milahu I like your idea! our test snapshot files are enormous because of the number of snapshots, and the different combinations of generator options. If you're interested in giving it a shot and contributing this change, that would be great! I'm down to see what it looks like. One note I think the format should be:
One issue is that we run the same generators with multiple combinations of options. So for Vue3, we would have:
So we would have 1 file per combination, and its filename would encode these options:
Those file names could get pretty long, but I think that's ok. 🤔 |
draft in https://github.com/milahu/mitosis/tree/test-snapshots-to-separate-files i solved the "options problem" with example files
nitpick: the folder layout is secondary |
I think this is pretty cool! Thank you for this initiative @milahu 🙏🏽 . I'd be down to have this change in the core repository if you can bring it to life. NOTE: we recently migrated to Let me know if you encounter any issues 😄 |
This seems interesting, any progress @milahu ? |
abandoned, sorry : / |
actual:
test inputs are stored in separate files with
tsx
file extensiontest outputs (snapshots) are stored in one file per framework with
snap
file extensionexpected:
test outputs should be stored in separate files with
tsx
file extensiontest output files should have a similar file path as test input files
why:
help with porting components to mitosis
so the test outputs are accessible via the github blob API
so its easier to
grep
for a desired output, for examplecreateEffect
in solidalternative:
postprocess the
snap
files and generate pretty html docswith side-by-side comparisons of input and output code
similar to https://party.sveltosis.dev/
jest issue: jestjs/jest#2676
possible solution:
toMatchSpecificSnapshot
fromjest-specific-snapshot
storybook: storybookjs/storybook#1584
typescript-eslint: typescript-eslint/typescript-eslint#2290
example
input
packages/core/src/__tests__/data/advanced-ref.raw.tsx
output for solid is stored in
packages/core/src/__tests__/__snapshots__/solid.test.ts.snap
test runner
packages/core/src/__tests__/shared.ts
snapshot is compared in
toMatchSnapshot
The text was updated successfully, but these errors were encountered: