-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
fix(snapshot-utils): Handle Windows line endings #15800
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
Conversation
Handle Windows line endings when checking snapshot headers. Fixes jestjs#15799.
✅ Deploy Preview for jestjs ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Update CHANGELOG and fix unbalanced backtick.
babel-jest
babel-plugin-jest-hoist
babel-preset-jest
create-jest
@jest/diff-sequences
expect
@jest/expect-utils
jest
jest-changed-files
jest-circus
jest-cli
jest-config
@jest/console
@jest/core
@jest/create-cache-key-function
jest-diff
jest-docblock
jest-each
@jest/environment
jest-environment-jsdom
@jest/environment-jsdom-abstract
jest-environment-node
@jest/expect
@jest/fake-timers
@jest/get-type
@jest/globals
jest-haste-map
jest-jasmine2
jest-leak-detector
jest-matcher-utils
jest-message-util
jest-mock
@jest/pattern
jest-phabricator
jest-regex-util
@jest/reporters
jest-resolve
jest-resolve-dependencies
jest-runner
jest-runtime
@jest/schemas
jest-snapshot
@jest/snapshot-utils
@jest/source-map
@jest/test-result
@jest/test-sequencer
@jest/transform
@jest/types
jest-util
jest-validate
jest-watcher
jest-worker
pretty-format
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes an issue with Jest snapshot utilities where Windows line endings (CRLF) were not being properly handled when validating snapshot headers. The fix ensures that both Unix (\n) and Windows (\r\n) line endings are correctly recognized.
- Updates the snapshot header regular expression to handle optional carriage returns
- Adds comprehensive test coverage for both Linux and Windows line endings
- Updates changelog to document the fix
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
packages/jest-snapshot-utils/src/utils.ts | Modified regex to handle Windows CRLF line endings |
packages/jest-snapshot-utils/src/tests/utils.test.ts | Enhanced test coverage with parameterized tests for both line ending types |
CHANGELOG.md | Added changelog entry and fixed formatting inconsistency |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Run prettier on changed files.
Looks like the test failures are related to native ESM on Node.js v24 and are unrelated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Will release 30.1.1 quickly with this fix.
Fixes #15799.
Summary
Handle Windows line endings when checking snapshot headers after changes made in #15787.
Test plan
Updated unit tests.