Skip to content

Commit

Permalink
feat(pretty-format)!: remove ConvertAnsi plugin in favour of `jest-…
Browse files Browse the repository at this point in the history
…serializer-ansi-escapes` (#13040)
  • Loading branch information
mrazauskas authored Jul 20, 2022
1 parent f96bc2a commit 2842eb6
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 140 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

- `[jest-config]` [**BREAKING**] Make `snapshotFormat` default to `escapeString: false` and `printBasicPrototype: false` ([#13036](https://github.com/facebook/jest/pull/13036))
- `[jest-environment-jsdom]` [**BREAKING**] Upgrade to `jsdom@20` ([#13037](https://github.com/facebook/jest/pull/13037))
- `[pretty-format]` [**BREAKING**] Remove `ConvertAnsi` plugin in favour of `jest-serializer-ansi-escapes` ([#13040](https://github.com/facebook/jest/pull/13040))

### Fixes

Expand Down
4 changes: 4 additions & 0 deletions docs/UpgradingToJest29.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,7 @@ If you want to keep the old behavior, you can set the `snapshotFormat` property
## JSDOM upgrade

`jest-environment-jsdom` has upgraded `jsdom` from v19 to v20. Due to issues with `@types/jsdom`, if you extend this environment, you might run into type errors. See https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/60999#discussioncomment-3158685.

## `pretty-format`

`ConvertAnsi` plugin is removed in favour of [`jest-serializer-ansi-escapes`](https://github.com/mrazauskas/jest-serializer-ansi-escapes).
4 changes: 1 addition & 3 deletions packages/pretty-format/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,11 @@
"types": "./build/index.d.ts",
"default": "./build/index.js"
},
"./package.json": "./package.json",
"./ConvertAnsi": "./build/plugins/ConvertAnsi.js"
"./package.json": "./package.json"
},
"author": "James Kyle <[email protected]>",
"dependencies": {
"@jest/schemas": "^29.0.0-alpha.0",
"ansi-regex": "^5.0.1",
"ansi-styles": "^5.0.0",
"react-is": "^18.0.0"
},
Expand Down
58 changes: 0 additions & 58 deletions packages/pretty-format/src/__tests__/ConvertAnsi.test.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/pretty-format/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
printObjectProperties,
} from './collections';
import AsymmetricMatcher from './plugins/AsymmetricMatcher';
import ConvertAnsi from './plugins/ConvertAnsi';
import DOMCollection from './plugins/DOMCollection';
import DOMElement from './plugins/DOMElement';
import Immutable from './plugins/Immutable';
Expand Down Expand Up @@ -536,7 +535,6 @@ export function format(val: unknown, options?: OptionsReceived): string {

export const plugins = {
AsymmetricMatcher,
ConvertAnsi,
DOMCollection,
DOMElement,
Immutable,
Expand Down
73 changes: 0 additions & 73 deletions packages/pretty-format/src/plugins/ConvertAnsi.ts

This file was deleted.

3 changes: 0 additions & 3 deletions scripts/buildUtils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ export function getPackages() {
...(pkg.name === 'expect'
? {'./build/matchers': './build/matchers.js'}
: {}),
...(pkg.name === 'pretty-format'
? {'./ConvertAnsi': './build/plugins/ConvertAnsi.js'}
: {}),
},
`Package "${pkg.name}" does not export correct files`,
);
Expand Down
1 change: 0 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17945,7 +17945,6 @@ __metadata:
"@types/react": ^17.0.3
"@types/react-is": ^17.0.0
"@types/react-test-renderer": 17.0.2
ansi-regex: ^5.0.1
ansi-styles: ^5.0.0
expect: ^29.0.0-alpha.0
immutable: ^4.0.0
Expand Down

0 comments on commit 2842eb6

Please sign in to comment.