diff --git a/cypress.config.js b/cypress.config.js index 9301451..a006fa4 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -1,7 +1,7 @@ const { defineConfig } = require("cypress"); module.exports = defineConfig({ - fixturesFolder: "cypress/fixtures", + // fixturesFolder: "cypress/fixtures", snapshot: { // updateSnapshots: true, useFolders: true, diff --git a/src/snapshot.js b/src/snapshot.js index 41b369b..6790b0e 100644 --- a/src/snapshot.js +++ b/src/snapshot.js @@ -22,12 +22,9 @@ const parseTextToJSON = (text) => text.replace(/\| [✅➖➕⭕]/g, "").trim(). const store_snapshot = (props = { value, name, raiser }) => { if (Cypress.env().updateSnapshots || Cypress.config('snapshot').updateSnapshots) { cy.SNAPSHOT_prettyprint({ title: "INFO", type: "info", message: "Saving Snapshot" }) - cy.writeFile(`${Cypress.env().fixturesFolder}/${props.name}.json`, JSON.stringify(props.value, null, 2)) + cy.writeFile(path.join(Cypress.config().fixturesFolder,`${props.name}.json`), JSON.stringify(props.value, null, 2)) } else { - // TODO: Figure out how to replace the fixture folder name if people move it - // const fixtureName = props.name.replace(Cypress.env().fixturesFolder, "") - const fixtureName = props.name.replace("cypress/fixtures", "") - cy.fixture(fixtureName).then(content => props.raiser({ value: props.value, expected: content })) + cy.fixture(props.name).then(content => props.raiser({ value: props.value, expected: content })) } }; @@ -115,9 +112,7 @@ module.exports = (value, stepName, options = { json: true }) => { options.asFolder = Cypress.config('snapshot').useFolders || false set_snapshot({ - snapshotName: path.join( - options.snapshotPath || Cypress.config('snapshot').snapshotPath || 'cypress/fixtures/snapshots', - `/${get_snapshot_name(options.asFolder, stepName)}`), + snapshotName: `/${get_snapshot_name(options.asFolder, stepName)}`, serialized, value, });