@percy/core 1.0.4 → 1.0.7

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.
Files changed (2) hide show
  1. package/dist/snapshot.js +4 -18
  2. package/package.json +6 -6
package/dist/snapshot.js CHANGED
@@ -120,24 +120,10 @@ export async function gatherSnapshots(percy, options) {
120
120
  // other invalid options which are also scrubbed from the returned migrated options.
121
121
 
122
122
  export function validateSnapshotOptions(options) {
123
- let schema; // decide which schema to validate against
124
-
125
- if ('domSnapshot' in options) {
126
- schema = '/snapshot/dom';
127
- } else if ('url' in options) {
128
- schema = '/snapshot';
129
- } else if ('sitemap' in options) {
130
- schema = '/snapshot/sitemap';
131
- } else if ('serve' in options) {
132
- schema = '/snapshot/server';
133
- } else if ('snapshots' in options) {
134
- schema = '/snapshot/list';
135
- } else {
136
- schema = '/snapshot';
137
- }
138
-
123
+ // decide which schema to validate against
124
+ let schema = ['domSnapshot', 'dom-snapshot', 'dom_snapshot'].some(k => k in options) && '/snapshot/dom' || 'url' in options && '/snapshot' || 'sitemap' in options && '/snapshot/sitemap' || 'serve' in options && '/snapshot/server' || 'snapshots' in options && '/snapshot/list' || '/snapshot';
139
125
  let {
140
- // migrate and remove certain properties from validating
126
+ // normalize, migrate, and remove certain properties from validating
141
127
  clientInfo,
142
128
  environmentInfo,
143
129
  snapshots,
@@ -151,7 +137,7 @@ export function validateSnapshotOptions(options) {
151
137
  for (let snap of snaps) validURL(typeof snap === 'string' ? snap : snap.url, baseUrl); // add back snapshots before validating and scrubbing; function snapshots are validated later
152
138
 
153
139
 
154
- if (snapshots) migrated.snapshots = typeof snapshots === 'function' ? [] : snapshots;
140
+ if (snapshots) migrated.snapshots = typeof snapshots === 'function' ? [] : snapshots;else if (!isSnapshot && options.snapshots) migrated.snapshots = [];
155
141
  let errors = PercyConfig.validate(migrated, schema);
156
142
 
157
143
  if (errors) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/core",
3
- "version": "1.0.4",
3
+ "version": "1.0.7",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -39,10 +39,10 @@
39
39
  "test:types": "tsd"
40
40
  },
41
41
  "dependencies": {
42
- "@percy/client": "1.0.4",
43
- "@percy/config": "1.0.4",
44
- "@percy/dom": "1.0.4",
45
- "@percy/logger": "1.0.4",
42
+ "@percy/client": "1.0.7",
43
+ "@percy/config": "1.0.7",
44
+ "@percy/dom": "1.0.7",
45
+ "@percy/logger": "1.0.7",
46
46
  "content-disposition": "^0.5.4",
47
47
  "cross-spawn": "^7.0.3",
48
48
  "extract-zip": "^2.0.1",
@@ -53,5 +53,5 @@
53
53
  "rimraf": "^3.0.2",
54
54
  "ws": "^8.0.0"
55
55
  },
56
- "gitHead": "db5b67f953f01c9a6d13b7a5a1d701ab983215cc"
56
+ "gitHead": "efd495c0343b8b82d3e6c236e858cdf2cb5e437d"
57
57
  }