Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jest-file-snapshot

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jest-file-snapshot - npm Package Compare versions

Comparing version 0.6.0 to 0.7.0

16

index.js

@@ -6,3 +6,3 @@ /* istanbul ignore file */

const chalk = require('chalk');
const diff = require('jest-diff').default;
const { diff } = require('jest-diff');
const mkdirp = require('mkdirp');

@@ -28,2 +28,3 @@ const filenamify = require('filenamify');

* diff?: import('jest-diff').DiffOptions,
* diffMethod?: (a: string, b: string, options: import('jest-diff').DiffOptions) => string,
* fileExtension?: string,

@@ -44,5 +45,9 @@ * }} options

'__file_snapshots__',
`${filenamify(this.currentTestName, {
replacement: '-',
}).replace(/\s/g, '-')}-${this.assertionCalls}`
`${filenamify(
this.currentTestName,
{
replacement: '-',
},
{ maxLength: Infinity }
).replace(/\s/g, '-')}-${this.assertionCalls}`
) + fileExtension

@@ -118,6 +123,7 @@ : filepath;

const diffMethod = options.diffMethod || diff;
const difference =
Buffer.isBuffer(content) || Buffer.isBuffer(output)
? ''
: `\n\n${diff(output, content, options.diff)}`;
: `\n\n${diffMethod(output, content, options.diff)}`;

@@ -124,0 +130,0 @@ return {

{
"name": "jest-file-snapshot",
"version": "0.6.0",
"version": "0.7.0",
"description": "Jest matcher to write snapshots to a separate file instead of the default snapshot file used by Jest",

@@ -5,0 +5,0 @@ "keywords": [

@@ -47,2 +47,3 @@ # jest-file-snapshot

- `diff`: options for [`jest-diff`](https://github.com/facebook/jest/tree/master/packages/jest-diff)
- `fileExtension`: optional file extension to use for the snapshot file.

@@ -49,0 +50,0 @@ You should also [exclude the output files from Jest's watcher](https://jestjs.io/docs/en/configuration#watchpathignorepatterns-arraystring) so that updating the snapshot doesn't re-run the tests again.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc