mirror of
https://github.com/datashard/snapshot.git
synced 2024-11-24 23:02:28 +00:00
Compare commits
6 commits
9351d344a7
...
a953a3c9e6
Author | SHA1 | Date | |
---|---|---|---|
|
a953a3c9e6 | ||
|
76ed0ebf45 | ||
|
390053f9c6 | ||
|
e561036926 | ||
|
0256d8c359 | ||
|
7816594c08 |
12 changed files with 10 additions and 3 deletions
|
@ -5,6 +5,7 @@ module.exports = defineConfig({
|
||||||
snapshot: {
|
snapshot: {
|
||||||
// updateSnapshots: true,
|
// updateSnapshots: true,
|
||||||
useFolders: true,
|
useFolders: true,
|
||||||
|
// useSnapshotFolder: true
|
||||||
},
|
},
|
||||||
|
|
||||||
e2e: {
|
e2e: {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@datashard/snapshot",
|
"name": "@datashard/snapshot",
|
||||||
"description": "Adds JSON Snapshot testing support to Cypress",
|
"description": "Adds JSON Snapshot testing support to Cypress",
|
||||||
"version": "3.0.0-beta",
|
"version": "3.0.0-beta.1",
|
||||||
"author": "Joshua <data@shard.wtf>",
|
"author": "Joshua <data@shard.wtf>",
|
||||||
"bugs": "https://github.com/datashard/snapshot/issues",
|
"bugs": "https://github.com/datashard/snapshot/issues",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
|
@ -108,10 +108,16 @@ module.exports = (value, stepName, options = { json: true }) => {
|
||||||
value = { data: value };
|
value = { data: value };
|
||||||
const serializer = pickSerializer(options.json, value);
|
const serializer = pickSerializer(options.json, value);
|
||||||
const serialized = serializer(value);
|
const serialized = serializer(value);
|
||||||
|
let useFolders;
|
||||||
|
if(Cypress.config('snapshot').useSnapshotFolder === undefined || Cypress.config('snapshot').useSnapshotFolder === true) {
|
||||||
|
useFolders = true
|
||||||
|
} else {
|
||||||
|
useFolders = false
|
||||||
|
}
|
||||||
options.asFolder = Cypress.config('snapshot').useFolders || false
|
options.asFolder = Cypress.config('snapshot').useFolders || false
|
||||||
|
|
||||||
set_snapshot({
|
set_snapshot({
|
||||||
snapshotName: `/${get_snapshot_name(options.asFolder, stepName)}`,
|
snapshotName: `/${useFolders ? "snapshots/" : ""}${get_snapshot_name(options.asFolder, stepName)}`,
|
||||||
serialized,
|
serialized,
|
||||||
value,
|
value,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue