Feature request: Support snapshot testing
See original GitHub issueWe test rules with a custom rule tester doing a snapshot test.
The built-in RuleTester can’t customize the output assertion, we don’t have the output to send to RuleTester
, so we have to use SourceCodeFixer
to apply fix from messages
. Full implementation
We definitely want a better way to do snapshot test, maybe pass an assert
option in future, but before that, can we expose SourceCodeFixer
, so I can apply fix from the message?
The version of ESLint you are using.
8.0.0-beta.0
The problem you want to solve.
Fix our rule tester.
Are you willing to submit a pull request to implement this change?
Yes.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:35 (25 by maintainers)
Top Results From Across the Web
Snapshot Testing - Jest
Snapshot tests are a very useful tool whenever you want to make sure your UI does not change unexpectedly.
Read more >btrfs snapshot management + VM - Page 3 - Forums - Unraid
February 14, 2019 in Feature Requests ... instance consider a subvolume at /mnt/cache/Video_Conversion/test/sv trying to create a snapshot ...
Read more >Frontend testing standards and style guidelines - GitLab Docs
By now you've probably heard of Jest snapshot tests and why they are useful for various reasons. To use them within GitLab, there...
Read more >Snapshot Simple Feature Request. | Proxmox Support Forum
I use snapshots for default configurations of guests testing software. Therefore I often make changes and need to roll back.
Read more >Contribution guide - cdk8s
An issue can either be a bug report or a feature-request. If you wish to ask a question or seek ... Our integration...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
FYI: I am hoping to work on this / write an RFC in the near future.
We have snapshot testing in a related linter I work on, ember-template-lint, which could be useful as prior art:
Thanks for working on this.
I’m afraid it won’t work for my case, as I understand, the
outputAssert
used to assertoutput
andmessages[index].suggestions[index].output
, but I need assertmessage
too.As you can see in this snapshot, there is a code frame pointing the report range, this is the inital propose adding this custom tester, because it’s hard to test the report range using the
start
/end
.How about pass all the
output
andmessages
(includingsuggestion.ouput
)?Also, @lydell need
assert
in each invalid scenario to usetoMatchInlineSnapshot
, but I don’t need that, so can we also support putassertOutput
on the root?