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

Locate approvals files in subfolder #24

Open
ThHareau opened this issue Feb 20, 2025 · 3 comments
Open

Locate approvals files in subfolder #24

ThHareau opened this issue Feb 20, 2025 · 3 comments
Assignees

Comments

@ThHareau
Copy link

Is your feature request related to a problem? Please describe.
approvals files are located next to the test file. When the number of tests grows, the directory will become bigger and bigger.

Describe the solution you'd like
Ideally, it would be possible to give in the namer options a boolean which would move the files inside a sub folder, for example _approvals. This way, we could directly distinguish test files from approval files.

Describe alternatives you've considered

Additional context
For example, jest snapshot testing uses the subfolder __snapshot__.

@yelmuratoff
Copy link
Collaborator

Hi!
It's good to see you. If I'm not mistaken, Namer should solve your problem.
But when I raised your issue, I realized that I should pay attention to the documentation issue and indicate this possibility there.
Please try to check here:
https://github.com/approvals/ApprovalTests.Dart/tree/main/test
All files are located in the approved_files folder.
As an example:
Approvals.verify -> options -> namer

// Leave null if you want to use the default path.
namer:  Namer(
                options: FileNamerOptions(
                  folderPath: 'test/approved_files',
                  testName: 'test name',
                  fileName: 'approval_test',
                  description: description,
                ),
              ),

If it helped you, then please unsubscribe here about it.

@yelmuratoff yelmuratoff self-assigned this Feb 20, 2025
@ThHareau
Copy link
Author

I think this is not exactly what I'm looking for. What I'm looking for is a simple way to globally move the generated files inside a subfolder, so that next tests are simple to create.

I was thinking of a global factory which would provide the Namer, thus my proposition of having a new option in Namer like : Namer(useSubfolder: true).

FileNamerOptions looks very good for specific cases, but for general cases I don't think it is ideal.

Don't worry about the documentation 😉 , I tend to look at the source code directly when I'm looking for an answer and I missed the FileNamerOptions actually

@yelmuratoff
Copy link
Collaborator

I think this is not exactly what I'm looking for. What I'm looking for is a simple way to globally move the generated files inside a subfolder, so that next tests are simple to create.

I was thinking of a global factory which would provide the Namer, thus my proposition of having a new option in Namer like : Namer(useSubfolder: true).

FileNamerOptions looks very good for specific cases, but for general cases I don't think it is ideal.

Don't worry about the documentation 😉 , I tend to look at the source code directly when I'm looking for an answer and I missed the FileNamerOptions actually

Okay, I get you. I'll try to come up with something over the weekend and solve it)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants