diff --git a/packages/sdk-utils/src/percy-enabled.js b/packages/sdk-utils/src/percy-enabled.js index 02218e003..5e015986a 100644 --- a/packages/sdk-utils/src/percy-enabled.js +++ b/packages/sdk-utils/src/percy-enabled.js @@ -22,11 +22,7 @@ export async function isPercyEnabled() { error = e; } - if (percy.enabled && percy.version.major !== 1) { - log.info('Unsupported Percy CLI version, disabling snapshots'); - log.debug(`Found version: ${percy.version}`); - percy.enabled = false; - } else if (!percy.enabled) { + if (!percy.enabled) { log.info('Percy is not running, disabling snapshots'); log.debug(error); } diff --git a/packages/sdk-utils/test/index.test.js b/packages/sdk-utils/test/index.test.js index e3dbf6a13..11ad23782 100644 --- a/packages/sdk-utils/test/index.test.js +++ b/packages/sdk-utils/test/index.test.js @@ -104,15 +104,20 @@ describe('SDK Utils', () => { ])); }); - it('disables snapshots when the API version is unsupported', async () => { - await helpers.test('version', '0.1.0'); - await expectAsync(isPercyEnabled()).toBeResolvedTo(false); + it('stays enabled against a next-major CLI', async () => { + await helpers.test('version', '2.0.0'); + await expectAsync(isPercyEnabled()).toBeResolvedTo(true); - expect(helpers.logger.stdout).toEqual(jasmine.arrayContaining([ - '[percy] Unsupported Percy CLI version, disabling snapshots' + expect(helpers.logger.stdout).not.toEqual(jasmine.arrayContaining([ + jasmine.stringMatching(/Unsupported Percy CLI version/) ])); }); + it('stays enabled against a 0.x CLI', async () => { + await helpers.test('version', '0.1.0'); + await expectAsync(isPercyEnabled()).toBeResolvedTo(true); + }); + it('returns false if the build fails during a snapshot', async () => { await helpers.test('error', '/percy/snapshot'); await helpers.test('build-failure');