From cef261f9a9c1303b945359b4d237b484cfe29bc9 Mon Sep 17 00:00:00 2001 From: rishigupta1599 Date: Mon, 19 Feb 2024 19:33:56 +0530 Subject: [PATCH] Reverting back --- packages/core/src/snapshot.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/core/src/snapshot.js b/packages/core/src/snapshot.js index d7cde52f0..48f0b45b1 100644 --- a/packages/core/src/snapshot.js +++ b/packages/core/src/snapshot.js @@ -362,9 +362,10 @@ export function createSnapshotsQueue(percy) { .handle('task', async function*({ resources, ...snapshot }) { let { name, meta } = snapshot; - const errorMessage = percy.client.screenshotFlow === 'automate' ? 'automate' : 'App Percy'; - if (percy.client.buildType !== percy.client.screenshotFlow) { - throw new Error(`Cannot run ${errorMessage} screenshots in ${percy.client.buildType} project. Please use ${errorMessage} project token`); + if (percy.client.screenshotFlow === 'automate' && percy.client.buildType !== 'automate') { + throw new Error(`Cannot run automate screenshots in ${percy.client.buildType} project. Please use automate project token`); + } else if (percy.client.screenshotFlow === 'app' && percy.client.buildType !== 'app') { + throw new Error(`Cannot run App Percy screenshots in ${percy.client.buildType} project. Please use App Percy project token`); } // yield to evaluated snapshot resources snapshot.resources = typeof resources === 'function'