Skip to content

Conversation

martincostello
Copy link
Contributor

Fixes #15799.

Summary

Handle Windows line endings when checking snapshot headers after changes made in #15787.

Test plan

Updated unit tests.

Handle Windows line endings when checking snapshot headers.

Fixes jestjs#15799.
Copy link

linux-foundation-easycla bot commented Aug 27, 2025

CLA Signed

The committers listed above are authorized under a signed CLA.

Copy link

netlify bot commented Aug 27, 2025

Deploy Preview for jestjs ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit dca739f
🔍 Latest deploy log https://app.netlify.com/projects/jestjs/deploys/68af0461b71c890008d9c475
😎 Deploy Preview https://deploy-preview-15800--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.

Update CHANGELOG and fix unbalanced backtick.
@martincostello martincostello marked this pull request as ready for review August 27, 2025 13:06
@Copilot Copilot AI review requested due to automatic review settings August 27, 2025 13:06
Copy link

pkg-pr-new bot commented Aug 27, 2025

Open in StackBlitz

babel-jest

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

babel-plugin-jest-hoist

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

babel-preset-jest

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

create-jest

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

@jest/diff-sequences

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

expect

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

@jest/expect-utils

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

jest

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

jest-changed-files

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

jest-circus

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

jest-cli

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

jest-config

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

@jest/console

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

@jest/core

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

@jest/create-cache-key-function

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

jest-diff

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

jest-docblock

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

jest-each

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

@jest/environment

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

jest-environment-jsdom

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

@jest/environment-jsdom-abstract

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

jest-environment-node

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

@jest/expect

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

@jest/fake-timers

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

@jest/get-type

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

@jest/globals

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

jest-haste-map

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

jest-jasmine2

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

jest-leak-detector

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

jest-matcher-utils

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

jest-message-util

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

jest-mock

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

@jest/pattern

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

jest-phabricator

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

jest-regex-util

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

@jest/reporters

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

jest-resolve

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

jest-resolve-dependencies

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

jest-runner

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

jest-runtime

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

@jest/schemas

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

jest-snapshot

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

@jest/snapshot-utils

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

@jest/source-map

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

@jest/test-result

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

@jest/test-sequencer

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

@jest/transform

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

@jest/types

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

jest-util

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

jest-validate

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

jest-watcher

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

jest-worker

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

pretty-format

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

commit: dca739f

Copy link

@Copilot Copilot AI left a 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.
@martincostello
Copy link
Contributor Author

Looks like the test failures are related to native ESM on Node.js v24 and are unrelated.

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.

Thanks! Will release 30.1.1 quickly with this fix.

@cpojer cpojer merged commit b36d6ed into jestjs:main Aug 27, 2025
71 of 74 checks passed
@martincostello martincostello deleted the gh-15799 branch August 27, 2025 13:40
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.

[Bug]: "Outdated snapshot: No snapshot header found." error on Windows with Jest v30.1.0
2 participants