snap-shot-core
Advanced tools
Comparing version 7.1.14 to 7.1.15
{ | ||
"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 | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
35590
14
756
12
+ Addedquote@0.4.0
+ Addedquote@0.4.0(transitive)