Skip to content

test: one snapshot per fixture test #1491

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

Closed
wants to merge 2 commits into from
Closed

test: one snapshot per fixture test #1491

wants to merge 2 commits into from

Conversation

armano2
Copy link
Collaborator

@armano2 armano2 commented Jan 22, 2020

This is alternative approach to ticket #1142 and change proposed in #1152

Main difference is that this code does not require generation of additional files (test per file) but extends jest functionality by allowing us to provide path to generated snapshot

Changes:
In test files i added one property (path): https://github.com/typescript-eslint/typescript-eslint/pull/1491/files#diff-8b3fe597033edf9c839ecff70500df9e

In test utils from ts-estree i added small piece of code to split snapshots:
e4722e8#diff-c976a68babc2637f35c7d6074d995843R41-R47

@armano2 armano2 added package: typescript-estree Issues related to @typescript-eslint/typescript-estree RFC labels Jan 22, 2020
@armano2 armano2 self-assigned this Jan 22, 2020
@typescript-eslint

This comment has been minimized.

@armano2 armano2 changed the title [RFC] test: one snapshot per fixture test [RFC] test: one snapshot per fixture test (alternative) Jan 22, 2020
@armano2 armano2 added tests anything to do with testing DO NOT MERGE PRs which should not be merged yet and removed package: typescript-estree Issues related to @typescript-eslint/typescript-estree labels Jan 22, 2020
@bradzacher
Copy link
Member

what's the runtime like?
The biggest problem with #1152 is the perf hit:

@armano2
Copy link
Collaborator Author

armano2 commented Jan 22, 2020

in my local env difference is +-10sec, and i did change this only for estree (as POC)

Conflicts:
	packages/typescript-estree/tests/lib/__snapshots__/javascript.ts.snap
	packages/typescript-estree/tests/lib/__snapshots__/jsx.ts.snap
	packages/typescript-estree/tests/lib/__snapshots__/typescript.ts.snap
@armano2
Copy link
Collaborator Author

armano2 commented Jan 22, 2020

CI is complaining about path that i used ./__snapshots__/**/*

@bradzacher
Copy link
Member

Surprising that it's so much faster. It must be because it circumvents the checks to clean up the snapshot afterward.

@armano2
Copy link
Collaborator Author

armano2 commented Jan 22, 2020

i played yesterday a little with this plugin and it seems that i can make it work with jest update (it requires small modification to this plugin)

@bradzacher bradzacher changed the title [RFC] test: one snapshot per fixture test (alternative) test: one snapshot per fixture test May 25, 2020
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 17, 2020
@armano2 armano2 deleted the snapshot-test branch February 7, 2021 08:39
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
DO NOT MERGE PRs which should not be merged yet tests anything to do with testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants