From 9adca9a0a9b0920d5a063f91fb622d0930bd38d3 Mon Sep 17 00:00:00 2001 From: Rich Clingman Date: Thu, 19 Aug 2021 20:07:37 -0500 Subject: [PATCH] If snapshot does not exist, return cy.wrap('') to allow .then() chaining --- src/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/index.js b/src/index.js index 57923d43..1278f823 100644 --- a/src/index.js +++ b/src/index.js @@ -89,7 +89,8 @@ function registerCypressSnapshot () { .task('readFileMaybe', snapshotFileName) .then(function (contents) { if (!contents) { - return cy.writeFile(snapshotFileName, '', 'utf-8', { log: false }) + cy.writeFile(snapshotFileName, '', 'utf-8', { log: false }) + return cy.wrap('') } return contents