differencify icon indicating copy to clipboard operation
differencify copied to clipboard

Differencify appends indexes to a unique generated snapshots' names.

Open mariyan-dimitrov opened this issue 6 years ago • 3 comments

Hey @NimaSoroush , I'm using differencify for a year now and now I'm looking to extend the library even more My issue is that I don't want to append incrementing indexes to uniquely generated names for the snapshots. My whole idea is to rerun a single test from an array of tests ( which were generated a few days back), but the thing is that Differencify doesn't take the already generated snapshot as a base one, but generates a new one. Could you please advice how can I remove the default indexing of the snapshots' naming?

mariyan-dimitrov avatar Sep 04 '19 14:09 mariyan-dimitrov

Hi @mariyan-dimitrov : If I understood your use case well, you want to override the existing prefix in differencify and instead providing your own test names which you can use it against an array of test. If that is the case, you can provide testName as an option. https://github.com/NimaSoroush/differencify#testoptions

Forexample: https://github.com/NimaSoroush/differencify/blob/master/API.md#simple-unchained

Hope this helps

NimaSoroush avatar Sep 06 '19 10:09 NimaSoroush

Hi @NimaSoroush, I don't think you understood me correctly. My current case is that I'm trying to run 5 tests at the same time. Meanwhile I'm providing unique testName for each of these test (ex. "unique_test_name_1", "unique_test_name_2", ... ), but then again, the differencify appends another index to these names like: -> "unique_test_name_1 1.snap", "unique_test_name_2 2.snap"... -> "unique_test_name_1 1.differencify.snap", "unique_test_name_2 2.differencify.snap" ... -> "unique_test_name_1 1.current.snap" , "unique_test_name_2 2.current.snap" ... I want to remove the second index ( unique_test_name_1 1.current.snap ) which is coming from Differencify. Is there any way to do that without renaming the file after it's created by the library?

mariyan-dimitrov avatar Sep 17 '19 08:09 mariyan-dimitrov

Hey @mariyan-dimitrov , Thanks for clarifying the issue. I misunderstood it initially. The short answer is that, it is not possible to remove the test name postfix with the current implementation. But it is fairly easy to implement that. Feel free to raise a PR for it

NimaSoroush avatar Sep 24 '19 20:09 NimaSoroush