test: use standard snapshots for generated files - #32
Merged
Merged
Conversation
expectGenerated wrote a folder per suite and test, with a file per generated module. It now records each file whole in the suite's standard .snap, keyed by test name and file name. All 50 snapshots are byte-identical to the files they replace. With no generated .ts left under __snapshots__, oxfmt, oxlint, fallow and tsconfig no longer need to ignore it. Co-Authored-By: LLM <noreply@block65.dev>
The helper had become a loop around one matcher call. Each test now snapshots its generated files itself, with the same hints, so the .snap keys don't change. Co-Authored-By: LLM <noreply@block65.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Generated files were snapshotted with
toMatchFileSnapshotinto__tests__/__snapshots__/<suite>/<test>/<file>.ts, through anexpectGeneratedhelper. On #25 those folders are named<suite>.test.ts/. Tests now callexpect(result.typesFile.getText()).toMatchSnapshot("types.ts")directly, so each suite gets the standard__snapshots__/<suite>.test.ts.snap, keyed<test name> > types.ts 1. Every file is still snapshotted whole.expectGenerated(__tests__/generated-snapshot.ts) is deleted..snapand comparing its entries with the old files at master.__snapshots__ignores from oxfmt, oxlint, fallow and tsconfig. They only existed because generated.tslived there.just checkpasses.When #25 is rebased onto this, it drops its own
expectGeneratedin__tests__/helpers.tsthe same way.