Skip to content

[Bug]: CR ("\r") in the test name breaks snapshot testing #15203

@latin-1

Description

@latin-1

Version

29.7.0 and 30.0.0-alpha.5

Steps to reproduce

Expected behavior

It should work without errors.

Actual behavior

    expect(received).toMatchSnapshot()

     1`pshot name: `

    New snapshot was not written. The update flag must be explicitly passed to write a new snapshot.

    This is likely because this test is run in a continuous integration (CI) environment in which snapshots are not written by default.

    Received: 1

      1 | test("\r", () => {
    > 2 |   expect(1).toMatchSnapshot()
        |             ^
      3 | });
      4 |

      at Object.toMatchSnapshot (a.spec.js:2:13)

Additional context

No response

Environment

  System:
    OS: Linux 6.9 Arch Linux
    CPU: (16) x64 AMD Ryzen 7 6800U with Radeon Graphics
  Binaries:
    Node: 22.5.1 - ~/.proto/shims/node
    Yarn: 4.3.1 - ~/.proto/shims/yarn
    npm: 10.8.2 - ~/.proto/shims/npm
    pnpm: 9.5.0 - ~/.proto/shims/pnpm
    bun: 1.1.20 - ~/.proto/shims/bun
  npmPackages:
    jest: 29.7.0 => 29.7.0 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions