Skip to content

feat: Show non-printable control characters to diff output #15696

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 25, 2025

Conversation

notoriousmango
Copy link
Contributor

Summary

resolve #15506
Added escape functionality to jest-diff that converts non-printable control characters into visible escaped sequences in string diffs:

ASCII control characters (0x00-0x1F, 0x7F) → \x00, \x01, etc.
C1 control characters (0x80-0x9F) → \x80, \x81, etc.
Common control chars get readable names: \b, \f, \v

Test plan

unit test

Copy link

netlify bot commented Jun 23, 2025

Deploy Preview for jestjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit f0b523c
🔍 Latest deploy log https://app.netlify.com/projects/jestjs/deploys/68594ca99752c50008a8d2f0
😎 Deploy Preview https://deploy-preview-15696--jestjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

pkg-pr-new bot commented Jun 23, 2025

Open in StackBlitz

babel-jest

npm i https://pkg.pr.new/babel-jest@15696

babel-plugin-jest-hoist

npm i https://pkg.pr.new/babel-plugin-jest-hoist@15696

babel-preset-jest

npm i https://pkg.pr.new/babel-preset-jest@15696

create-jest

npm i https://pkg.pr.new/create-jest@15696

@jest/diff-sequences

npm i https://pkg.pr.new/@jest/diff-sequences@15696

expect

npm i https://pkg.pr.new/expect@15696

@jest/expect-utils

npm i https://pkg.pr.new/@jest/expect-utils@15696

jest

npm i https://pkg.pr.new/jest@15696

jest-changed-files

npm i https://pkg.pr.new/jest-changed-files@15696

jest-circus

npm i https://pkg.pr.new/jest-circus@15696

jest-cli

npm i https://pkg.pr.new/jest-cli@15696

jest-config

npm i https://pkg.pr.new/jest-config@15696

@jest/console

npm i https://pkg.pr.new/@jest/console@15696

@jest/core

npm i https://pkg.pr.new/@jest/core@15696

@jest/create-cache-key-function

npm i https://pkg.pr.new/@jest/create-cache-key-function@15696

jest-diff

npm i https://pkg.pr.new/jest-diff@15696

jest-docblock

npm i https://pkg.pr.new/jest-docblock@15696

jest-each

npm i https://pkg.pr.new/jest-each@15696

@jest/environment

npm i https://pkg.pr.new/@jest/environment@15696

jest-environment-jsdom

npm i https://pkg.pr.new/jest-environment-jsdom@15696

@jest/environment-jsdom-abstract

npm i https://pkg.pr.new/@jest/environment-jsdom-abstract@15696

jest-environment-node

npm i https://pkg.pr.new/jest-environment-node@15696

@jest/expect

npm i https://pkg.pr.new/@jest/expect@15696

@jest/fake-timers

npm i https://pkg.pr.new/@jest/fake-timers@15696

@jest/get-type

npm i https://pkg.pr.new/@jest/get-type@15696

@jest/globals

npm i https://pkg.pr.new/@jest/globals@15696

jest-haste-map

npm i https://pkg.pr.new/jest-haste-map@15696

jest-jasmine2

npm i https://pkg.pr.new/jest-jasmine2@15696

jest-leak-detector

npm i https://pkg.pr.new/jest-leak-detector@15696

jest-matcher-utils

npm i https://pkg.pr.new/jest-matcher-utils@15696

jest-message-util

npm i https://pkg.pr.new/jest-message-util@15696

jest-mock

npm i https://pkg.pr.new/jest-mock@15696

@jest/pattern

npm i https://pkg.pr.new/@jest/pattern@15696

jest-phabricator

npm i https://pkg.pr.new/jest-phabricator@15696

jest-regex-util

npm i https://pkg.pr.new/jest-regex-util@15696

@jest/reporters

npm i https://pkg.pr.new/@jest/reporters@15696

jest-resolve

npm i https://pkg.pr.new/jest-resolve@15696

jest-resolve-dependencies

npm i https://pkg.pr.new/jest-resolve-dependencies@15696

jest-runner

npm i https://pkg.pr.new/jest-runner@15696

jest-runtime

npm i https://pkg.pr.new/jest-runtime@15696

@jest/schemas

npm i https://pkg.pr.new/@jest/schemas@15696

jest-snapshot

npm i https://pkg.pr.new/jest-snapshot@15696

@jest/snapshot-utils

npm i https://pkg.pr.new/@jest/snapshot-utils@15696

@jest/source-map

npm i https://pkg.pr.new/@jest/source-map@15696

@jest/test-result

npm i https://pkg.pr.new/@jest/test-result@15696

@jest/test-sequencer

npm i https://pkg.pr.new/@jest/test-sequencer@15696

@jest/transform

npm i https://pkg.pr.new/@jest/transform@15696

@jest/types

npm i https://pkg.pr.new/@jest/types@15696

jest-util

npm i https://pkg.pr.new/jest-util@15696

jest-validate

npm i https://pkg.pr.new/jest-validate@15696

jest-watcher

npm i https://pkg.pr.new/jest-watcher@15696

jest-worker

npm i https://pkg.pr.new/jest-worker@15696

pretty-format

npm i https://pkg.pr.new/pretty-format@15696

commit: f0b523c

Copy link
Member

@cpojer cpojer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix!

@cpojer cpojer merged commit 2c2586d into jestjs:main Jun 25, 2025
76 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature]: Include non-printable control characters such as \x01 in the console "Expected:" and "Received:" outputs.
2 participants