regressify 1.2.13 → 1.2.15

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.
@@ -174,10 +174,10 @@ module.exports = async (context) => {
174
174
  }
175
175
  }
176
176
 
177
- if (!!action.persit) {
178
- console.log(logPrefix + 'persit:', action.persit);
177
+ if (!!action.persist) {
178
+ console.log(logPrefix + 'persist:', action.persist);
179
179
  const states = await browserContext.storageState();
180
- setStorageState(action.persit, states);
180
+ setStorageState(action.persist, states);
181
181
  }
182
182
  }
183
183
  };
@@ -1,6 +1,7 @@
1
1
  const fs = require('fs');
2
2
  const path = require('path');
3
3
  const YAML = require('js-yaml');
4
+ const chalkImport = import('chalk').then((m) => m.default);
4
5
 
5
6
  function getStorageState(stateName) {
6
7
  const statePath = path.join(process.cwd(), 'states', `${stateName}.yaml`);
@@ -11,12 +12,17 @@ function getStorageState(stateName) {
11
12
  }
12
13
 
13
14
  module.exports = async (page, scenario, viewport, isReference, browserContext) => {
15
+ const chalk = await chalkImport;
14
16
  const logPrefix = chalk.yellow(`[${scenario.index} of ${scenario.total}] `);
15
17
  await require('./loadCookies')(browserContext, scenario);
16
18
 
17
19
  if (scenario.restore) {
18
- console.log(logPrefix + 'restore:', scenario.restore);
19
- const states = getStorageState(scenario.restore);
20
- await browserContext.storageState(states);
20
+ const stateNames = typeof scenario.restore === 'string' ? [scenario.restore] : scenario.restore;
21
+
22
+ for (const stateName of stateNames) {
23
+ console.log(logPrefix + 'restore:', stateName);
24
+ const states = getStorageState(stateName);
25
+ await browserContext.storageState(states);
26
+ }
21
27
  }
22
28
  };
@@ -1,5 +1,4 @@
1
1
  const fs = require('fs');
2
- const path = require('path');
3
2
  const chalkImport = import('chalk').then((m) => m.default);
4
3
 
5
4
  /**
package/bun.lockb CHANGED
Binary file
@@ -77,7 +77,17 @@
77
77
  "type": "number"
78
78
  },
79
79
  "restore": {
80
- "type": "string"
80
+ "oneOf": [
81
+ {
82
+ "type": "string"
83
+ },
84
+ {
85
+ "type": "array",
86
+ "items": {
87
+ "type": "string"
88
+ }
89
+ }
90
+ ]
81
91
  },
82
92
  "ignoreSslErrors": {
83
93
  "type": "boolean"
@@ -189,7 +199,7 @@
189
199
  "$ref": "#/definitions/InputFileAction"
190
200
  },
191
201
  {
192
- "$ref": "#/definitions/PersitAction"
202
+ "$ref": "#/definitions/persistAction"
193
203
  },
194
204
  {
195
205
  "$ref": "#/definitions/PressAction"
@@ -637,11 +647,11 @@
637
647
  "wait"
638
648
  ]
639
649
  },
640
- "PersitAction": {
650
+ "persistAction": {
641
651
  "type": "object",
642
652
  "additionalProperties": false,
643
653
  "properties": {
644
- "persit": {
654
+ "persist": {
645
655
  "type": "string"
646
656
  },
647
657
  "frame": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "regressify",
3
- "version": "1.2.13",
3
+ "version": "1.2.15",
4
4
  "description": "Visual regression tests support",
5
5
  "main": "src/index.ts",
6
6
  "type": "module",