You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

@jest/snapshot-utils

Package Overview
Dependencies
Maintainers
5
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jest/snapshot-utils - npm Package Compare versions

Comparing version
30.1.0
to
30.1.1
+1
-1
build/index.js

@@ -82,3 +82,3 @@ /*!

const SNAPSHOT_VERSION = exports.SNAPSHOT_VERSION = '1';
const SNAPSHOT_HEADER_REGEXP = /^\/\/ Jest Snapshot v(.+), (.+)\n/;
const SNAPSHOT_HEADER_REGEXP = /^\/\/ Jest Snapshot v(.+), (.+)\r?\n/;
const SNAPSHOT_GUIDE_LINK = exports.SNAPSHOT_GUIDE_LINK = 'https://jestjs.io/docs/snapshot-testing';

@@ -85,0 +85,0 @@ const SNAPSHOT_VERSION_WARNING = exports.SNAPSHOT_VERSION_WARNING = _chalk.default.yellow(`${_chalk.default.bold('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.');

{
"name": "@jest/snapshot-utils",
"version": "30.1.0",
"version": "30.1.1",
"repository": {

@@ -37,3 +37,3 @@ "type": "git",

},
"gitHead": "4d5f41d0885c1d9630c81b4fd47f74ab0615e18f"
"gitHead": "d347c0f3f87f976a1dbd9761d503e45f5ced2a7e"
}

@@ -138,24 +138,30 @@ /**

test('getSnapshotData() throws for newer snapshot version', () => {
const filename = path.join(__dirname, 'old-snapshot.snap');
jest
.mocked(fs.readFileSync)
.mockReturnValue(
`// Jest Snapshot v2, ${SNAPSHOT_GUIDE_LINK}\n\n` +
'exports[`myKey`] = `<div>\n</div>`;\n',
test.each([
['Linux', '\n'],
['Windows', '\r\n'],
])(
'getSnapshotData() throws for newer snapshot version with %s line endings',
(_: string, fileEol: string) => {
const filename = path.join(__dirname, 'old-snapshot.snap');
jest
.mocked(fs.readFileSync)
.mockReturnValue(
`// Jest Snapshot v2, ${SNAPSHOT_GUIDE_LINK}${fileEol}${fileEol}` +
`exports[\`myKey\`] = \`<div>${fileEol}</div>\`;${fileEol}`,
);
const update = 'none';
expect(() => getSnapshotData(filename, update)).toThrow(
`${chalk.red(
`${chalk.red.bold('Outdated Jest version')}: The version of this ` +
'snapshot file indicates that this project is meant to be used ' +
'with a newer version of Jest. ' +
'The snapshot file version ensures that all developers on a project ' +
'are using the same version of Jest. ' +
'Please update your version of Jest and re-run the tests.',
)}\n\nExpected: v${SNAPSHOT_VERSION}\nReceived: v2`,
);
const update = 'none';
},
);
expect(() => getSnapshotData(filename, update)).toThrow(
`${chalk.red(
`${chalk.red.bold('Outdated Jest version')}: The version of this ` +
'snapshot file indicates that this project is meant to be used ' +
'with a newer version of Jest. ' +
'The snapshot file version ensures that all developers on a project ' +
'are using the same version of Jest. ' +
'Please update your version of Jest and re-run the tests.',
)}\n\nExpected: v${SNAPSHOT_VERSION}\nReceived: v2`,
);
});
test('getSnapshotData() throws for deprecated snapshot guide link', () => {

@@ -174,3 +180,5 @@ const deprecatedGuideLink = 'https://goo.gl/fbAQLP';

`${chalk.red(
`${chalk.red.bold('Outdated guide link')}: The snapshot guide link is outdated.` +
`${chalk.red.bold(
'Outdated guide link',
)}: The snapshot guide link is outdated.` +
'Please update all snapshots while upgrading of Jest',

@@ -177,0 +185,0 @@ )}\n\nExpected: ${SNAPSHOT_GUIDE_LINK}\n` +

@@ -16,3 +16,3 @@ /**

export const SNAPSHOT_VERSION = '1';
const SNAPSHOT_HEADER_REGEXP = /^\/\/ Jest Snapshot v(.+), (.+)\n/;
const SNAPSHOT_HEADER_REGEXP = /^\/\/ Jest Snapshot v(.+), (.+)\r?\n/;
export const SNAPSHOT_GUIDE_LINK = 'https://jestjs.io/docs/snapshot-testing';

@@ -81,3 +81,5 @@ export const SNAPSHOT_VERSION_WARNING = chalk.yellow(

chalk.red(
`${chalk.red.bold('Outdated guide link')}: The snapshot guide link is outdated.` +
`${chalk.red.bold(
'Outdated guide link',
)}: The snapshot guide link is outdated.` +
'Please update all snapshots while upgrading of Jest',

@@ -84,0 +86,0 @@ ) +