Closed Droogans closed 4 years ago
I would like to be able to control where my snapshots end up during run time.
Here, I have a for loop that iterates over some items of interest at runtime, and generates DOM snapshots based on what it finds.
However, this creates one giant file and personally I'd rather be able to pass in the desired file name for each individual call of t.snapshot in my project.
I considered this. It's tricky though since it means multiple test files could be using the same snapshot file. Since we run test files concurrently this makes it hard to reliably update the snapshot file.
I'm open to this if we can figure out graceful solutions to those race conditions.
(On a side-note, if anyone here is able to figure out why my project's snapshotLocation isn't being honored, I'd be grateful. So far I've had no luck creating any solid reproduction case other than pointing to the entire project linked above)
It's because the documentation was wrong, Use snapshotDir
instead, see https://github.com/avajs/ava/pull/1581.
If ava keeps a cache, would it be possible to write to it and flag warnings/fail tests if a user attempts to write to the same file location twice?
We'd need to transmit the snapshot data to the main process and only write the file once all tests have run. But what happens if you run AVA with specific test files and update snapshots, thus removing the snapshots created by a different file?
Similarly there'd be collisions if tests in both files have the same title. All this gets pretty complicated!
Description
I would like to be able to control where my snapshots end up during run time.
Here, I have a for loop that iterates over some items of interest at runtime, and generates DOM snapshots based on what it finds.
However, this creates one giant file and personally I'd rather be able to pass in the desired file name for each individual call of
t.snapshot
in my project.(On a side-note, if anyone here is able to figure out why my project's
snapshotLocation
isn't being honored, I'd be grateful. So far I've had no luck creating any solid reproduction case other than pointing to the entire project linked above)