Skip to content

Commit 2737e08

Browse files
authored
fix(snapshot-utils): snapshot header regexp to work with newline across OSes (#15803)
1 parent e8e7e8e commit 2737e08

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## main
22

3+
### Fixes
4+
5+
- `[jest-snapshot-utils]` Correct snapshot header regexp to work with newline across OSes ([#15803](https://github.com/jestjs/jest/pull/15803))
6+
37
## 30.1.1
48

59
### Fixes

packages/jest-snapshot-utils/src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import type {Config} from '@jest/types';
1313
import type {SnapshotData} from './types';
1414

1515
export const SNAPSHOT_VERSION = '1';
16-
const SNAPSHOT_HEADER_REGEXP = /^\/\/ Jest Snapshot v(.+), (.+)\r?\n/;
16+
const SNAPSHOT_HEADER_REGEXP = /^\/\/ Jest Snapshot v(.+), (.+)$/m;
1717
export const SNAPSHOT_GUIDE_LINK = 'https://jestjs.io/docs/snapshot-testing';
1818
export const SNAPSHOT_VERSION_WARNING = chalk.yellow(
1919
`${chalk.bold('Warning')}: Before you upgrade snapshots, ` +

0 commit comments

Comments
 (0)