Skip to content
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

fluent API for snapshotting only specific subsets of a snapshot #482

Open
nedtwigg opened this issue Oct 18, 2024 · 0 comments
Open

fluent API for snapshotting only specific subsets of a snapshot #482

nedtwigg opened this issue Oct 18, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@nedtwigg
Copy link
Member

nedtwigg commented Oct 18, 2024

It would be nice to be able to truncate a snapshot to only certain specific lines. Something like:

expectSelfie(blah).lines(1).toBe_TODO() // first line
expectSelfie(blah).lines(2).toBe_TODO() // first two lines
expectSelfie(blah).lines(-2).toBe_TODO() // last two lines
expectSelfie(blah).lines(-1).toBe_TODO() // last one line

var snapshot = expectSelfie(blah)
snapshot.lines(2).toBe_TODO()  // first two lines
snapshot.lines(-2).toBe_TODO() // last two lines

I have also sometimes wanted to match a certain regex, like maybe

expectSelfie(blah).withinRegex("(?m)^.*$\n?^.*$").toBe_TODO()

So far, each time that I have wanted this, I have found a better way to solve this by filtering before the snapshot gets taken...

@nedtwigg nedtwigg added the enhancement New feature or request label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant