From 8f6e32c07252bf346b39ecad1543d21ef07dc365 Mon Sep 17 00:00:00 2001 From: Joshua Date: Sun, 28 May 2023 13:55:39 +0200 Subject: [PATCH] provide better formatting for JSON in files --- src/utils/snapshots/snapshot.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/snapshots/snapshot.js b/src/utils/snapshots/snapshot.js index dd0c9c3..fdba4cd 100644 --- a/src/utils/snapshots/snapshot.js +++ b/src/utils/snapshots/snapshot.js @@ -16,7 +16,7 @@ const newStore = (name) => { return initStore(name); }; -const store_snapshot = (store, props = { value, name, path, raiser }) => { +const store_snapshot = (store, props = { value, name, path, raiser}) => { const expectedPath = path.join( props.path || Cypress.config("snapshot").snapshotPath || @@ -27,7 +27,7 @@ const store_snapshot = (store, props = { value, name, path, raiser }) => { if (exist && !Cypress.env().SNAPSHOT_UPDATE) { props.raiser({ value: props.value, expected: JSON.parse(exist) }); } else { - cy.writeFile(expectedPath, JSON.stringify(props.value)); + cy.writeFile(expectedPath, JSON.stringify(props.value, null, 2)); } }); };