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

snap-shot-core

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snap-shot-core - npm Package Compare versions

Comparing version 1.6.1 to 1.7.0

2

package.json
{
"name": "snap-shot-core",
"description": "Save / load named snapshots, useful for tests",
"version": "1.6.1",
"version": "1.7.0",
"author": "Gleb Bahmutov <gleb.bahmutov@gmail.com>",

@@ -6,0 +6,0 @@ "bugs": "https://github.com/bahmutov/snap-shot-core/issues",

@@ -141,2 +141,25 @@ # snap-shot-core

## Testing in watch mode
In case you execute your tests in watch mode and you notice the snapshots are always new-created for the same set of tests, then you need to restore the counters per file.
tape example:
```js
//foo.test.js
const test = require('tape');
const snapShot = require('snap-shot-core')
test.onFinish(snapShot.restore)
test('one test', function (t) {
t.plan(1)
snapShot({
what: 1,
file: __filename,
specName: 'one test'
})
})
```
### Small print

@@ -143,0 +166,0 @@

@@ -28,3 +28,3 @@ 'use strict'

// keeps track how many "snapshot" calls were there per test
const snapshotsPerTest = {}
var snapshotsPerTest = {}

@@ -34,2 +34,6 @@ const formKey = (specName, oneIndex) =>

function restore () {
snapshotsPerTest = {}
}
function findStoredValue ({file, specName, index = 1, ext, opts = {}}) {

@@ -174,2 +178,4 @@ la(is.unemptyString(file), 'missing file to find spec for', file)

snapShotCore.restore = restore
module.exports = snapShotCore
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