Skip to content

Commit

Permalink
fix: rework tests to not output color snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
thymikee committed Jun 16, 2021
1 parent 2771332 commit 4ce25ae
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 45 deletions.
18 changes: 0 additions & 18 deletions __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
Expand Down
18 changes: 0 additions & 18 deletions __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
Expand Down
3 changes: 2 additions & 1 deletion __tests__/snapshotDiff.test.js
Expand Up @@ -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', () => {
Expand Down
14 changes: 6 additions & 8 deletions __tests__/toMatchDiffSnapshot.test.js
Expand Up @@ -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
Expand Down

0 comments on commit 4ce25ae

Please sign in to comment.