From 7e447bea4a64852cd2d2ba504bdc4de3645d2cc6 Mon Sep 17 00:00:00 2001 From: Sonishi Izuka Date: Fri, 22 Jul 2022 12:47:50 +0900 Subject: [PATCH] test(@sounisi5011/jest-binary-data-matchers): migrate from `pretty-format` to `jest-serializer-ansi-escapes` The `ConvertAnsi` plugin has been removed from `pretty-format` by [#13040]. The replacement is [`jest-serializer-ansi-escapes`]. [#13040]: https://github.com/facebook/jest/pull/13040 [`jest-serializer-ansi-escapes`]: https://github.com/mrazauskas/jest-serializer-ansi-escapes --- packages/jest-matchers/binary-data/package.json | 2 +- packages/jest-matchers/binary-data/tests/index.ts | 5 ++--- .../jest-matchers/binary-data/tests/invalid-value.ts | 5 ++--- pnpm-lock.yaml | 9 +++++++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/jest-matchers/binary-data/package.json b/packages/jest-matchers/binary-data/package.json index dbc4da851..671d1cd9b 100644 --- a/packages/jest-matchers/binary-data/package.json +++ b/packages/jest-matchers/binary-data/package.json @@ -65,7 +65,7 @@ "@types/node": "12.20.55", "cross-env": "7.0.3", "jest": "28.1.2", - "pretty-format": "28.1.1", + "jest-serializer-ansi-escapes": "2.0.1", "typescript": "4.7.4" }, "peerDependencies": { diff --git a/packages/jest-matchers/binary-data/tests/index.ts b/packages/jest-matchers/binary-data/tests/index.ts index 19daa5171..c8e4ab02c 100644 --- a/packages/jest-matchers/binary-data/tests/index.ts +++ b/packages/jest-matchers/binary-data/tests/index.ts @@ -1,11 +1,10 @@ import '../src'; -// import ConvertAnsiPlugin from 'pretty-format/ConvertAnsi'; -import { plugins as prettyFormatPlugins } from 'pretty-format'; +import ansiEscapesSerializer from 'jest-serializer-ansi-escapes'; import { getBytesDataList, toIntAndBigintCases, unshiftInspect } from './helpers'; -expect.addSnapshotSerializer(prettyFormatPlugins.ConvertAnsi); +expect.addSnapshotSerializer(ansiEscapesSerializer); { const byteSizeList: number[] = [0, 1, 2 ** 10, 2 ** 20, 2 ** 30, 2 ** 40, 2 ** 50]; diff --git a/packages/jest-matchers/binary-data/tests/invalid-value.ts b/packages/jest-matchers/binary-data/tests/invalid-value.ts index 00c066a32..067d0bbb5 100644 --- a/packages/jest-matchers/binary-data/tests/invalid-value.ts +++ b/packages/jest-matchers/binary-data/tests/invalid-value.ts @@ -1,11 +1,10 @@ import '../src'; -// import ConvertAnsiPlugin from 'pretty-format/ConvertAnsi'; -import { plugins as prettyFormatPlugins } from 'pretty-format'; +import ansiEscapesSerializer from 'jest-serializer-ansi-escapes'; import * as matcherList from '../src/matchers'; -expect.addSnapshotSerializer(prettyFormatPlugins.ConvertAnsi); +expect.addSnapshotSerializer(ansiEscapesSerializer); const invalidValueList = [ undefined, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b1d061482..0f7d3e7c9 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -322,7 +322,7 @@ importers: cross-env: 7.0.3 jest: 28.1.2 jest-diff: ^28.0.0 - pretty-format: 28.1.1 + jest-serializer-ansi-escapes: 2.0.1 typescript: 4.7.4 dependencies: '@sounisi5011/ts-type-util-is-readonly-array': link:../../ts-type-utils/is-readonly-array @@ -335,7 +335,7 @@ importers: '@types/node': 12.20.55 cross-env: 7.0.3 jest: 28.1.2_@types+node@12.20.55 - pretty-format: 28.1.1 + jest-serializer-ansi-escapes: 2.0.1 typescript: 4.7.4 packages/stream-transform-from: @@ -5333,6 +5333,11 @@ packages: - supports-color dev: true + /jest-serializer-ansi-escapes/2.0.1: + resolution: {integrity: sha512-+BuVKZQutcejSuODTleG/CV+8OVONZSOSrtrQRG8isTLu367JVKK+/yaG2jGs5O6MPBZ88WNy5jg8hqhd/p6pw==} + engines: {node: '>=14'} + dev: true + /jest-snapshot/28.1.2: resolution: {integrity: sha512-wzrieFttZYfLvrCVRJxX+jwML2YTArOUqFpCoSVy1QUapx+LlV9uLbV/mMEhYj4t7aMeE9aSQFHSvV/oNoDAMA==} engines: {node: ^12.13.0 || ^14.15.0 || ^16.10.0 || >=17.0.0}