From f68b2ba22c16f81024ac75a9d6378d82b5ffc081 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomasz=20T=C3=B3rz?= Date: Tue, 5 Nov 2024 15:45:59 +0100 Subject: [PATCH] Improve no snapshot found message --- .../earl/src/validators/snapshots/toMatchSnapshot.test.ts | 4 +++- packages/earl/src/validators/snapshots/toMatchSnapshot.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/earl/src/validators/snapshots/toMatchSnapshot.test.ts b/packages/earl/src/validators/snapshots/toMatchSnapshot.test.ts index a56a15cb..cf6b4b52 100644 --- a/packages/earl/src/validators/snapshots/toMatchSnapshot.test.ts +++ b/packages/earl/src/validators/snapshots/toMatchSnapshot.test.ts @@ -114,7 +114,9 @@ describe(toMatchSnapshot.name, () => { it('fails when a value is not present in the snapshot', () => { expect(() => { earl('baz').toMatchSnapshot(mochaContext('unknown')) - }).to.throw('No snapshot was found. Snapshots cannot be generated on CI.') + }).to.throw( + 'No snapshot was found. Snapshots cannot be generated on CI. Run tests locally to generate snapshots.', + ) }) it('cannot be set to update on ci', () => { diff --git a/packages/earl/src/validators/snapshots/toMatchSnapshot.ts b/packages/earl/src/validators/snapshots/toMatchSnapshot.ts index 6e7b6a37..a9acfa13 100644 --- a/packages/earl/src/validators/snapshots/toMatchSnapshot.ts +++ b/packages/earl/src/validators/snapshots/toMatchSnapshot.ts @@ -68,7 +68,7 @@ export function toMatchSnapshot(control: Control, context: TestContext) { } else if (snapshot.expected === undefined) { control.assert({ success: false, - reason: 'No snapshot was found. Snapshots cannot be generated on CI.', + reason: 'No snapshot was found. Snapshots cannot be generated on CI. Run tests locally to generate snapshots.', negatedReason: '', actual, expected: undefined,