Skip to content

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

Description

@martincostello

Version

30.1.0

Steps to reproduce

  1. Clone martincostello/benchmarkdotnet-results-publisher@493a56c on Windows
  2. Run npm install
  3. Run npm test

Expected behavior

Tests pass.

Actual behavior

Tests fail:

 FAIL  tests/main.test.ts
  ● Test suite failed to run

    Outdated snapshot: No snapshot header found. Jest 19 introduced versioned snapshots to ensure all developers on a project are using the same version of Jest. Please update all snapshots during this upgrade of Jest.
    
    Warning: Before you upgrade snapshots, we recommend that you revert any local changes to tests or other code, to ensure that you do not store invalid state.

      at validateSnapshotHeader (node_modules/@jest/snapshot-utils/build/index.js:91:12)
      at getSnapshotData (node_modules/@jest/snapshot-utils/build/index.js:156:28)

Additional context

Likely caused by #15787.

Environment

Current runner version: '2.328.0'
Runner Image Provisioner
  Hosted Compute Agent
  Version: 20250812.370
  Commit: 4a2b2bf7520004e3e907c2150c8cabe342a3da32
  Build Date: 2025-08-12T16:08:14Z
Operating System
  Microsoft Windows Server 2022
  10.0.20348
  Datacenter
Runner Image
  Image: windows-2022
  Version: 20250817.1.0
  Included Software: https://github.com/actions/runner-images/blob/win22/20250817.1/images/windows/Windows2022-Readme.md
  Image Release: https://github.com/actions/runner-images/releases/tag/win22%2F20250817.1

Activity

  1. fredrikcarlbom commented on Aug 27, 2025

    @fredrikcarlbom

    It's very strange, those snapshot tests works on my windows machine. In our project, our snapshot tests works on our windows developer machines but not in our dockerized CI environment, also using jest 30.1.0.

  2. fredrikcarlbom commented on Aug 27, 2025

    @fredrikcarlbom

    I expect it to be related to line endings and the auto.crlf setting combined with this regex:
    const SNAPSHOT_HEADER_REGEXP = /^// Jest Snapshot v(.+), (.+)\n/;. Matching \n instead of $ is likely the problem...

  3. Mlocik97 commented on Aug 27, 2025

    @Mlocik97

    Hit exact same issue on Linux in CI. Now all PR pipelines are failing in our company.

  4. martincostello commented on Aug 27, 2025

    @martincostello
    ContributorAuthor

    Looking to do a PR to fix it now.

  5. martincostello commented on Aug 27, 2025

    @martincostello
    ContributorAuthor
  6. cpojer commented on Aug 27, 2025

    @cpojer
    Member

    Shipped 30.1.1 with the fix.

  7. hainenber commented on Aug 27, 2025

    @hainenber
    Contributor

    Hi, im the PR's author there. Apologies for causing mayhem in the CI realm! 🙇

    Lesson learnt: Always test with Windows 🪟

  8. hainenber commented on Aug 27, 2025

    @hainenber
    Contributor

    @Mlocik97 other folks are affected in their Windows-based CI except you. Might I know if 30.1.1 managed to fix your issue? If not, I can open another one for resolution

  9. Mlocik97 commented on Aug 28, 2025

    @Mlocik97

    @hainenber yes, we can still reproduce with 30.1.1 in Github pipeline with configuration:

    runs-on: ubuntu-latest
    steps:
        - uses: actions/setup-node@v4
          with:
            node-version: 22
            cache: npm
  10. cpojer commented on Aug 29, 2025

    @cpojer
    Member

    @hainenber could you investigate and send a PR with a fix?

  11. cpojer commented on Sep 1, 2025

    @cpojer
    Member

    Released 30.1.2 which should hopefully resolve this issue. Thanks @hainenber.

  12. Mlocik97 commented on Sep 1, 2025

    @Mlocik97

    Thank you, I confirm the issue is resolved now.

  13. github-actions commented on Oct 2, 2025

    @github-actions

    This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
    Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

  14. locked as resolved and limited conversation to collaborators on Oct 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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