bahmutov / snap-shot-it

Smarter snapshot utility for Mocha and BDD test runners + data-driven testing!
157 stars 18 forks source link

Feature Request: Choose filename for snapshots file #405

Open rkoval opened 5 years ago

rkoval commented 5 years ago

Hello!

First off, I'd like to say that this project is excellent. I'm really excited to add the power of jest snapshots using a mocha runner.

The feature I'm wanting seems like trivial enough, but please advise if not. I'm basically just wanting an argument to pass to snapshot that allows for a manual filename/location to specify to save snapshots.

The reasoning for this is because we use webpack for our tests, so the entrypoint for all (we have thousands) of them is a single tests.js file outputted by webpack outputs as a single transpiled artifact. I tried using useRelativePath in my package.json, but that also doesn't seem to give the functionality I'm requiring.

And... that's it. Please let me know what your thoughts are!

rohit-gohri commented 5 years ago

Another slightly different usecase for this would be splitting current snapshot files into multiple ones. I have a a single test runner file that imports test configs from different files and runs them from a single file so all their snapshots gets saved together even though they are unrelated. An option to specify save file would be great.

My team developed a feature similar to this for our internal use, to append a suffix to the test file, didn't think that would be helpful to others. That can be easily modified to take full name as input. I'll try to get a PR opened after separating that code.

rohit-gohri commented 5 years ago

@bahmutov #435 was opened by my colleague @sethiyark for this. What is your opinion on this and the possible solution?