@percy/client 1.20.3 → 1.21.0

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/client.js +8 -3
  2. package/package.json +4 -4
package/dist/client.js CHANGED
@@ -362,8 +362,13 @@ export class PercyClient {
362
362
  validateId('snapshot', snapshotId);
363
363
  this.log.debug(`Creating comparision: ${tag.name}...`);
364
364
  for (let tile of tiles) {
365
- if (tile.sha || tile.content || !tile.filepath) continue;
366
- tile.content = await fs.promises.readFile(tile.filepath);
365
+ if (tile.sha) continue;
366
+ if (tile.content && typeof tile.content === 'string') {
367
+ // base64 encoded content coming from SDK
368
+ tile.content = Buffer.from(tile.content, 'base64');
369
+ } else if (tile.filepath) {
370
+ tile.content = await fs.promises.readFile(tile.filepath);
371
+ }
367
372
  }
368
373
  return this.post(`snapshots/${snapshotId}/comparisons`, {
369
374
  data: {
@@ -411,7 +416,7 @@ export class PercyClient {
411
416
  } = {}) {
412
417
  validateId('comparison', comparisonId);
413
418
  this.log.debug(`Uploading comparison tile: ${index + 1}/${total} (${comparisonId})...`);
414
- if (filepath) content = await fs.promises.readFile(filepath);
419
+ if (filepath && !content) content = await fs.promises.readFile(filepath);
415
420
  if (sha) {
416
421
  return await this.verify(comparisonId, sha);
417
422
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@percy/client",
3
- "version": "1.20.3",
3
+ "version": "1.21.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -31,8 +31,8 @@
31
31
  "test:coverage": "yarn test --coverage"
32
32
  },
33
33
  "dependencies": {
34
- "@percy/env": "1.20.3",
35
- "@percy/logger": "1.20.3"
34
+ "@percy/env": "1.21.0",
35
+ "@percy/logger": "1.21.0"
36
36
  },
37
- "gitHead": "520bd156af47080881b651e4819014cbacf76781"
37
+ "gitHead": "44c63a3214f1fbfb0b1adcb6fcfe284a9f54d0cb"
38
38
  }