mirror of
https://github.com/datashard/snapshot.git
synced 2024-12-22 09:57:34 +00:00
Merge branch 'master' of datashard:/datashard/snapshot
This commit is contained in:
commit
0256d8c359
2 changed files with 5 additions and 15 deletions
|
@ -45,7 +45,6 @@
|
||||||
"@wildpeaks/snapshot-dom": "1.6.0",
|
"@wildpeaks/snapshot-dom": "1.6.0",
|
||||||
"check-more-types": "2.24.0",
|
"check-more-types": "2.24.0",
|
||||||
"js-beautify": "1.13.13",
|
"js-beautify": "1.13.13",
|
||||||
"lazy-ass": "1.6.0",
|
"lazy-ass": "1.6.0"
|
||||||
"snap-shot-store": "1.2.3"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
const serializeDomElement = require("../serializers/serializeDomElement");
|
const serializeDomElement = require("../serializers/serializeDomElement");
|
||||||
const serializeToHTML = require("../serializers/serializeToHTML");
|
const serializeToHTML = require("../serializers/serializeToHTML");
|
||||||
const compareValues = require("./compareValues");
|
const compareValues = require("./compareValues");
|
||||||
const { initStore } = require("snap-shot-store");
|
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const identity = (x) => x;
|
const identity = (x) => x;
|
||||||
|
|
||||||
|
@ -12,11 +11,7 @@ const pickSerializer = (asJson, value) => {
|
||||||
return identity;
|
return identity;
|
||||||
};
|
};
|
||||||
|
|
||||||
const newStore = (name) => {
|
const store_snapshot = (props = { value, name, path, raiser }) => {
|
||||||
return initStore(name);
|
|
||||||
};
|
|
||||||
|
|
||||||
const store_snapshot = (store, props = { value, name, path, raiser }) => {
|
|
||||||
const expectedPath = path.join(
|
const expectedPath = path.join(
|
||||||
props.path ||
|
props.path ||
|
||||||
Cypress.config("snapshot").snapshotPath ||
|
Cypress.config("snapshot").snapshotPath ||
|
||||||
|
@ -33,11 +28,8 @@ const store_snapshot = (store, props = { value, name, path, raiser }) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const set_snapshot = (
|
const set_snapshot = (
|
||||||
store,
|
|
||||||
{ snapshotName, snapshotPath, serialized, value }
|
{ snapshotName, snapshotPath, serialized, value }
|
||||||
) => {
|
) => {
|
||||||
if (!store) return;
|
|
||||||
|
|
||||||
let devToolsLog = { $el: serialized };
|
let devToolsLog = { $el: serialized };
|
||||||
|
|
||||||
if (Cypress.dom.isJquery(value)) {
|
if (Cypress.dom.isJquery(value)) {
|
||||||
|
@ -81,7 +73,7 @@ const set_snapshot = (
|
||||||
};
|
};
|
||||||
Cypress.log(options);
|
Cypress.log(options);
|
||||||
|
|
||||||
store_snapshot(store, {
|
store_snapshot({
|
||||||
value,
|
value,
|
||||||
name: snapshotName,
|
name: snapshotName,
|
||||||
path: snapshotPath,
|
path: snapshotPath,
|
||||||
|
@ -106,9 +98,8 @@ module.exports = (value, step, options) => {
|
||||||
|
|
||||||
const serializer = pickSerializer(options.json, value);
|
const serializer = pickSerializer(options.json, value);
|
||||||
const serialized = serializer(value);
|
const serialized = serializer(value);
|
||||||
const store = newStore(serialized || {});
|
|
||||||
|
set_snapshot({
|
||||||
set_snapshot(store, {
|
|
||||||
snapshotName: get_snapshot_name(
|
snapshotName: get_snapshot_name(
|
||||||
Cypress.currentTest,
|
Cypress.currentTest,
|
||||||
options.snapshotName || step
|
options.snapshotName || step
|
||||||
|
|
Loading…
Reference in a new issue