mirror of
https://github.com/datashard/snapshot.git
synced 2024-11-21 05:32:28 +00:00
chore: add ability to contain snapshots in a single snapshot folder
This commit is contained in:
parent
9351d344a7
commit
e561036926
2 changed files with 9 additions and 2 deletions
|
@ -5,6 +5,7 @@ module.exports = defineConfig({
|
||||||
snapshot: {
|
snapshot: {
|
||||||
// updateSnapshots: true,
|
// updateSnapshots: true,
|
||||||
useFolders: true,
|
useFolders: true,
|
||||||
|
// useSnapshotFolder: true
|
||||||
},
|
},
|
||||||
|
|
||||||
e2e: {
|
e2e: {
|
||||||
|
|
|
@ -108,11 +108,17 @@ module.exports = (value, stepName, options = { json: true }) => {
|
||||||
value = { data: value };
|
value = { data: value };
|
||||||
const serializer = pickSerializer(options.json, value);
|
const serializer = pickSerializer(options.json, value);
|
||||||
const serialized = serializer(value);
|
const serialized = serializer(value);
|
||||||
|
let useFolders;
|
||||||
|
if(Cypress.config('snapshot').useSnapshotFolder === undefined || Cypress.config('snapshot').useSnapshotFolder === true) {
|
||||||
|
useFolders = true
|
||||||
|
} else {
|
||||||
|
useFolders = false
|
||||||
|
}
|
||||||
options.asFolder = Cypress.config('snapshot').useFolders || false
|
options.asFolder = Cypress.config('snapshot').useFolders || false
|
||||||
|
|
||||||
set_snapshot({
|
set_snapshot({
|
||||||
snapshotName: `/${get_snapshot_name(options.asFolder, stepName)}`,
|
snapshotName: `/${useFolders ? "snapshots/" : ""}${get_snapshot_name(options.asFolder, stepName)}`,
|
||||||
serialized,
|
serialized,
|
||||||
value,
|
value,
|
||||||
});
|
});
|
||||||
};
|
};
|
Loading…
Reference in a new issue