regressify 1.2.7 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
+ const YAML = require('js-yaml');
3
4
  const chalkImport = import('chalk').then((m) => m.default);
4
5
 
5
6
  module.exports = async (context) => {
@@ -182,11 +183,12 @@ module.exports = async (context) => {
182
183
  };
183
184
 
184
185
  function setStorageState(stateName, states) {
185
- const statePath = path.join(process.cwd(), 'states', `storage-states--${stateName}.json`);
186
+ const statePath = path.join(process.cwd(), 'states', `${stateName}.yaml`);
186
187
  const parentDir = path.dirname(statePath);
187
188
  if (!fs.existsSync(parentDir)) {
188
189
  fs.mkdirSync(parentDir, { recursive: true });
189
190
  }
190
191
 
191
- fs.writeFileSync(statePath, JSON.stringify(states, null, 2));
192
+ const yaml = YAML.dump(states, { lineWidth: -1, noCompatMode: true });
193
+ fs.writeFileSync(yaml, JSON.stringify(states, null, 2));
192
194
  }
@@ -1,11 +1,12 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
+ const YAML = require('js-yaml');
3
4
 
4
5
  function getStorageState(stateName) {
5
- const statePath = path.join(process.cwd(), 'states', `storage-states--${stateName}.json`);
6
+ const statePath = path.join(process.cwd(), 'states', `${stateName}.yaml`);
6
7
  if (fs.existsSync(statePath)) {
7
- const json = fs.readFileSync(statePath, 'utf8');
8
- return JSON.parse(json);
8
+ const yaml = fs.readFileSync(statePath, 'utf8');
9
+ return YAML.load(json);
9
10
  }
10
11
  }
11
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "regressify",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "description": "Visual regression tests support",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",