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 7.1.14 to 7.1.15

7

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

@@ -23,3 +23,2 @@ "bugs": "https://github.com/bahmutov/snap-shot-core/issues",

"npm run stop-only",
"npm run secure",
"npm run license",

@@ -39,3 +38,2 @@ "npm run ban -- --all",

"license-checker": "npm run license",
"nsp": "npm run secure",
"git-issues": "npm run issues"

@@ -74,3 +72,2 @@ }

"pretest": "npm run lint",
"secure": "nsp check",
"size": "t=\"$(npm pack .)\"; wc -c \"${t}\"; tar tvf \"${t}\"; rm \"${t}\";",

@@ -101,3 +98,2 @@ "test": "npm run unit",

"mocha": "5.2.0",
"nsp": "3.2.1",
"pre-git": "3.17.1",

@@ -122,4 +118,5 @@ "semantic-release": "15.13.3",

"pluralize": "7.0.0",
"quote": "0.4.0",
"ramda": "0.26.1"
}
}

@@ -9,2 +9,3 @@ 'use strict'

const isCI = require('is-ci')
const quote = require('quote')

@@ -44,3 +45,3 @@ const snapshotIndex = utils.snapshotIndex

* @param {number} oneIndex
*/
*/
const formKey = (specName, oneIndex) => `${specName} ${oneIndex}`

@@ -161,2 +162,26 @@

function throwCannotSaveOnCI ({
value,
fileParameter,
exactSpecName,
specName,
index
}) {
const key = exactSpecName || formKey(specName, index)
throw new Error(
'Cannot store new snapshot value\n' +
'in ' +
quote(fileParameter) +
'\n' +
'for snapshot called ' +
quote(exactSpecName || specName) +
'\n' +
'test key ' +
quote(key) +
'\n' +
'when running on CI (opts.ci = 1)\n' +
'see https://github.com/bahmutov/snap-shot-core/issues/5'
)
}
function core (options) {

@@ -240,17 +265,25 @@ const what = options.what // value to store

console.log('new value to save: %j', value)
const key = formKey(specName, index)
throw new Error(
'Cannot store new snapshot value\n' +
'in ' +
fileParameter +
'\n' +
'for spec called "' +
specName +
'"\n' +
'test key "' +
key +
'"\n' +
'when running on CI (opts.ci = 1)\n' +
'see https://github.com/bahmutov/snap-shot-core/issues/5'
)
return throwCannotSaveOnCI({
value,
fileParameter,
exactSpecName,
specName,
index
})
// const key = exactSpecName || formKey(specName, index)
// throw new Error(
// 'Cannot store new snapshot value\n' +
// 'in ' +
// quote(fileParameter) +
// '\n' +
// 'for snapshot called ' +
// quote(exactSpecName || specName) +
// '\n' +
// 'test key ' +
// quote(key) +
// '\n' +
// 'when running on CI (opts.ci = 1)\n' +
// 'see https://github.com/bahmutov/snap-shot-core/issues/5'
// )
}

@@ -301,3 +334,4 @@

restore,
prune
prune,
throwCannotSaveOnCI
}
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