mirror of
https://github.com/datashard/snapshot.git
synced 2024-11-24 14:52:28 +00:00
Better Formatting for JSON Files (#12)
This commit is contained in:
parent
897ad51548
commit
f9f95315fe
7 changed files with 25 additions and 8 deletions
|
@ -1 +1,8 @@
|
||||||
{"data":[1,2,3]}
|
{
|
||||||
|
"data": [
|
||||||
|
1,
|
||||||
|
2,
|
||||||
|
3,
|
||||||
|
4
|
||||||
|
]
|
||||||
|
}
|
|
@ -1 +1,3 @@
|
||||||
{"data":42}
|
{
|
||||||
|
"data": 42
|
||||||
|
}
|
|
@ -1 +1,4 @@
|
||||||
{"foo":"bar","Fizzy Drink":"Pop"}
|
{
|
||||||
|
"foo": "bar",
|
||||||
|
"Fizzy Drink": "Pop"
|
||||||
|
}
|
|
@ -1 +1,4 @@
|
||||||
{"foo":"bar","Fizzy Drink":"Soda"}
|
{
|
||||||
|
"foo": "bar",
|
||||||
|
"Fizzy Drink": "Soda"
|
||||||
|
}
|
|
@ -1 +1,3 @@
|
||||||
{"data":"foo-bar"}
|
{
|
||||||
|
"data": "foo-bar"
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"name": "@datashard/snapshot",
|
"name": "@datashard/snapshot",
|
||||||
"description": "Adds value / object / DOM element snapshot testing support to Cypress test runner",
|
"description": "Adds value / object / DOM element snapshot testing support to Cypress test runner",
|
||||||
"version": "2.2.1",
|
"version": "2.2.2",
|
||||||
"author": "Joshua <data@shard.wtf>, Gleb Bahmutov <gleb@cypress.io>",
|
"author": "Joshua <data@shard.wtf>, Gleb Bahmutov <gleb@cypress.io>",
|
||||||
"bugs": "https://github.com/datashard/snapshot/issues",
|
"bugs": "https://github.com/datashard/snapshot/issues",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
|
|
@ -16,7 +16,7 @@ const newStore = (name) => {
|
||||||
return initStore(name);
|
return initStore(name);
|
||||||
};
|
};
|
||||||
|
|
||||||
const store_snapshot = (store, props = { value, name, path, raiser }) => {
|
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 ||
|
||||||
|
@ -27,7 +27,7 @@ const store_snapshot = (store, props = { value, name, path, raiser }) => {
|
||||||
if (exist && !Cypress.env().SNAPSHOT_UPDATE) {
|
if (exist && !Cypress.env().SNAPSHOT_UPDATE) {
|
||||||
props.raiser({ value: props.value, expected: JSON.parse(exist) });
|
props.raiser({ value: props.value, expected: JSON.parse(exist) });
|
||||||
} else {
|
} else {
|
||||||
cy.writeFile(expectedPath, JSON.stringify(props.value));
|
cy.writeFile(expectedPath, JSON.stringify(props.value, null, 2));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue