From 4ce25ae1956a083f548e8dcdb5f075ca3062f059 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Wed, 16 Jun 2021 23:19:58 +0200 Subject: [PATCH] fix: rework tests to not output color snapshots --- .../__snapshots__/snapshotDiff.test.js.snap | 18 ------------------ .../toMatchDiffSnapshot.test.js.snap | 18 ------------------ __tests__/snapshotDiff.test.js | 3 ++- __tests__/toMatchDiffSnapshot.test.js | 14 ++++++-------- 4 files changed, 8 insertions(+), 45 deletions(-) diff --git a/__tests__/__snapshots__/snapshotDiff.test.js.snap b/__tests__/__snapshots__/snapshotDiff.test.js.snap index 26e2339..56df248 100644 --- a/__tests__/__snapshots__/snapshotDiff.test.js.snap +++ b/__tests__/__snapshots__/snapshotDiff.test.js.snap @@ -1,23 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`can colorize diff 1`] = ` -"Snapshot Diff: -- First value -+ Second value - -@@ -5,9 +5,10 @@ - some - some - some - some - not -+ so - very - long - script -" -`; - exports[`can expand diff 1`] = ` "Snapshot Diff: - First value diff --git a/__tests__/__snapshots__/toMatchDiffSnapshot.test.js.snap b/__tests__/__snapshots__/toMatchDiffSnapshot.test.js.snap index fd231af..d32e7f0 100644 --- a/__tests__/__snapshots__/toMatchDiffSnapshot.test.js.snap +++ b/__tests__/__snapshots__/toMatchDiffSnapshot.test.js.snap @@ -1,23 +1,5 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`proxies "colors" option(s) 1`] = ` -"Snapshot Diff: -- First value -+ Second value - -@@ -5,9 +5,10 @@ - some - some - some - some - not -+ so - very - long - script -" -`; - exports[`proxies "contextLines" option(s) 1`] = ` "Snapshot Diff: - First value diff --git a/__tests__/snapshotDiff.test.js b/__tests__/snapshotDiff.test.js index 2c9cc83..9347626 100644 --- a/__tests__/snapshotDiff.test.js +++ b/__tests__/snapshotDiff.test.js @@ -197,7 +197,8 @@ test('can expand diff', () => { }); test('can colorize diff', () => { - expect(snapshotDiff(a, b, { colors: true })).toMatchSnapshot(); + expect(snapshotDiff(a, b)).not.toMatch('[32m-'); + expect(snapshotDiff(a, b, { colors: true })).toMatch('[32m-'); }); test('can use contextLines on diff', () => { diff --git a/__tests__/toMatchDiffSnapshot.test.js b/__tests__/toMatchDiffSnapshot.test.js index 1dbdf70..751188a 100644 --- a/__tests__/toMatchDiffSnapshot.test.js +++ b/__tests__/toMatchDiffSnapshot.test.js @@ -39,14 +39,12 @@ test('works with default options', () => { expect(a).toMatchDiffSnapshot(b); }); -[{ expand: true }, { colors: true }, { contextLines: 0 }].forEach( - (options: any) => { - test(`proxies "${Object.keys(options).join(', ')}" option(s)`, () => { - // $FlowFixMe - expect(a).toMatchDiffSnapshot(b, options); - }); - } -); +[{ expand: true }, { contextLines: 0 }].forEach((options: any) => { + test(`proxies "${Object.keys(options).join(', ')}" option(s)`, () => { + // $FlowFixMe + expect(a).toMatchDiffSnapshot(b, options); + }); +}); test('works with custom name', () => { // $FlowFixMe