@percy/core 1.28.1-beta.0 → 1.28.1

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.
package/dist/config.js CHANGED
@@ -71,6 +71,9 @@ export const configSchema = {
71
71
  sync: {
72
72
  type: 'boolean'
73
73
  },
74
+ testCase: {
75
+ type: 'string'
76
+ },
74
77
  fullPage: {
75
78
  type: 'boolean',
76
79
  onlyAutomate: true
@@ -312,6 +315,9 @@ export const snapshotSchema = {
312
315
  sync: {
313
316
  $ref: '/config/snapshot#/properties/sync'
314
317
  },
318
+ testCase: {
319
+ $ref: '/config/snapshot#/properties/testCase'
320
+ },
315
321
  reshuffleInvalidTags: {
316
322
  $ref: '/config/snapshot#/properties/reshuffleInvalidTags'
317
323
  },
package/dist/discovery.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import logger from '@percy/logger';
2
2
  import Queue from './queue.js';
3
- import { normalizeURL, hostnameMatches, createResource, createRootResource, createPercyCSSResource, createLogResource, yieldAll } from './utils.js';
3
+ import { normalizeURL, hostnameMatches, createResource, createRootResource, createPercyCSSResource, createLogResource, yieldAll, snapshotLogName } from './utils.js';
4
4
 
5
5
  // Logs verbose debug logs detailing various snapshot options.
6
6
  function debugSnapshotOptions(snapshot) {
@@ -139,8 +139,8 @@ function processSnapshotResources({
139
139
 
140
140
  // include associated snapshot logs matched by meta information
141
141
  resources.push(createLogResource(logger.query(log => {
142
- var _log$meta$snapshot;
143
- return ((_log$meta$snapshot = log.meta.snapshot) === null || _log$meta$snapshot === void 0 ? void 0 : _log$meta$snapshot.name) === snapshot.meta.snapshot.name;
142
+ var _log$meta$snapshot, _log$meta$snapshot2;
143
+ return ((_log$meta$snapshot = log.meta.snapshot) === null || _log$meta$snapshot === void 0 ? void 0 : _log$meta$snapshot.testCase) === snapshot.meta.snapshot.testCase && ((_log$meta$snapshot2 = log.meta.snapshot) === null || _log$meta$snapshot2 === void 0 ? void 0 : _log$meta$snapshot2.name) === snapshot.meta.snapshot.name;
144
144
  })));
145
145
  return {
146
146
  ...snapshot,
@@ -296,11 +296,12 @@ export function createDiscoveryQueue(percy) {
296
296
  .handle('end', async () => {
297
297
  await percy.browser.close();
298
298
  })
299
- // snapshots are unique by name; when deferred also by widths
299
+ // snapshots are unique by name and testCase; when deferred also by widths
300
300
  .handle('find', ({
301
301
  name,
302
+ testCase,
302
303
  widths
303
- }, snapshot) => snapshot.name === name && (!percy.deferUploads || !widths || widths.join() === snapshot.widths.join()))
304
+ }, snapshot) => snapshot.testCase === testCase && snapshot.name === name && (!percy.deferUploads || !widths || widths.join() === snapshot.widths.join()))
304
305
  // initialize the resources for DOM snapshots
305
306
  .handle('push', snapshot => {
306
307
  let resources = parseDomResources(snapshot);
@@ -356,7 +357,7 @@ export function createDiscoveryQueue(percy) {
356
357
  }, error) => {
357
358
  if (error.name === 'AbortError' && queue.readyState < 3) {
358
359
  // only error about aborted snapshots when not closed
359
- percy.log.error('Received a duplicate snapshot, ' + `the previous snapshot was aborted: ${name}`, meta);
360
+ percy.log.error('Received a duplicate snapshot, ' + `the previous snapshot was aborted: ${snapshotLogName(name, meta)}`, meta);
360
361
  } else {
361
362
  // log all other encountered errors
362
363
  percy.log.error(`Encountered an error taking snapshot: ${name}`, meta);
package/dist/snapshot.js CHANGED
@@ -3,7 +3,7 @@ import PercyConfig from '@percy/config';
3
3
  import micromatch from 'micromatch';
4
4
  import { configSchema } from './config.js';
5
5
  import Queue from './queue.js';
6
- import { request, hostnameMatches, yieldTo } from './utils.js';
6
+ import { request, hostnameMatches, yieldTo, snapshotLogName } from './utils.js';
7
7
  import { JobData } from './wait-for-job.js';
8
8
 
9
9
  // Throw a better error message for missing or invalid urls
@@ -113,7 +113,8 @@ function getSnapshotOptions(options, {
113
113
  meta: {
114
114
  ...meta,
115
115
  snapshot: {
116
- name: options.name
116
+ name: options.name,
117
+ testCase: options.testCase
117
118
  }
118
119
  }
119
120
  }, config.snapshot, {
@@ -391,10 +392,11 @@ export function createSnapshotsQueue(percy) {
391
392
  });
392
393
  }
393
394
  })
394
- // snapshots are unique by name alone
395
+ // snapshots are unique by name and testCase both
395
396
  .handle('find', ({
396
- name
397
- }, snapshot) => snapshot.name === name)
397
+ name,
398
+ testCase
399
+ }, snapshot) => snapshot.testCase === testCase && snapshot.name === name)
398
400
  // when pushed, maybe flush old snapshots or possibly merge with existing snapshots
399
401
  .handle('push', (snapshot, existing) => {
400
402
  let {
@@ -403,8 +405,8 @@ export function createSnapshotsQueue(percy) {
403
405
  } = snapshot;
404
406
 
405
407
  // log immediately when not deferred or dry-running
406
- if (!percy.deferUploads) percy.log.info(`Snapshot taken: ${name}`, meta);
407
- if (percy.dryRun) percy.log.info(`Snapshot found: ${name}`, meta);
408
+ if (!percy.deferUploads) percy.log.info(`Snapshot taken: ${snapshotLogName(name, meta)}`, meta);
409
+ if (percy.dryRun) percy.log.info(`Snapshot found: ${snapshotLogName(name, meta)}`, meta);
408
410
 
409
411
  // immediately flush when uploads are delayed but not skipped
410
412
  if (percy.delayUploads && !percy.deferUploads) queue.flush();
package/dist/utils.js CHANGED
@@ -328,6 +328,13 @@ export function serializeFunction(fn) {
328
328
  }
329
329
  return fnbody;
330
330
  }
331
+ export function snapshotLogName(name, meta) {
332
+ var _meta$snapshot;
333
+ if (meta !== null && meta !== void 0 && (_meta$snapshot = meta.snapshot) !== null && _meta$snapshot !== void 0 && _meta$snapshot.testCase) {
334
+ return `testCase: ${meta.snapshot.testCase}, ${name}`;
335
+ }
336
+ return name;
337
+ }
331
338
 
332
339
  // DefaultMap, which returns a default value for an uninitialized key
333
340
  // Similar to defaultDict in python
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/core",
3
- "version": "1.28.1-beta.0",
3
+ "version": "1.28.1",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -9,7 +9,7 @@
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public",
12
- "tag": "beta"
12
+ "tag": "latest"
13
13
  },
14
14
  "engines": {
15
15
  "node": ">=14"
@@ -43,11 +43,11 @@
43
43
  "test:types": "tsd"
44
44
  },
45
45
  "dependencies": {
46
- "@percy/client": "1.28.1-beta.0",
47
- "@percy/config": "1.28.1-beta.0",
48
- "@percy/dom": "1.28.1-beta.0",
49
- "@percy/logger": "1.28.1-beta.0",
50
- "@percy/webdriver-utils": "1.28.1-beta.0",
46
+ "@percy/client": "1.28.1",
47
+ "@percy/config": "1.28.1",
48
+ "@percy/dom": "1.28.1",
49
+ "@percy/logger": "1.28.1",
50
+ "@percy/webdriver-utils": "1.28.1",
51
51
  "content-disposition": "^0.5.4",
52
52
  "cross-spawn": "^7.0.3",
53
53
  "extract-zip": "^2.0.1",
@@ -58,5 +58,5 @@
58
58
  "rimraf": "^3.0.2",
59
59
  "ws": "^8.0.0"
60
60
  },
61
- "gitHead": "648f81742ebf8c6f29ccdfdff77df124e4e1668d"
61
+ "gitHead": "f3b0fad3c511fe9eea44eef939195a9d0310216b"
62
62
  }