function uploadHtml(buildId, snapshotId, htmlResource, missingResources,
                    callback) {
  if (missingResources.length > 0) {
    // We assume there is only one missing resource here and it is the root
    // resource. All other resources should be build resources.
    percyClient.uploadResource(buildId, htmlResource.content)
        .then(function() {
          callback();

          // After we're sure all build resources are uploaded, finalize the
          // snapshot.
          Promise.all(buildResourceUploadPromises).then(function() {
            logDebug('Snapshot id', snapshotId);
            percyClient.finalizeSnapshot(snapshotId);
          });
        });
  } else {
    // No missing resources, we can immediately finalize the snapshot after
    // build resources.
    Promise.all(buildResourceUploadPromises).then(function() {
      percyClient.finalizeSnapshot(snapshotId);
    });

    // No resources to upload, so resolve immediately.
    callback();
  }
}
/**
 * Uploads the html snapshot to percy if it doesn't already have it stored.
 * @param {number} buildId
 * @param {number} snapshotId
 * @param {PercyClient.Resource} htmlResource
 * @param {Array<{id: number}>} missingResources
 * @param {Function} callback
 *
 */
Uploads the html snapshot to percy if it doesn't already have it stored.
Uploads the html snapshot to percy if it doesn ' t already have it stored .
function uploadHtml(buildId, snapshotId, htmlResource, missingResources,
                    callback) {
  if (missingResources.length > 0) {
    percyClient.uploadResource(buildId, htmlResource.content)
        .then(function() {
          callback();
          Promise.all(buildResourceUploadPromises).then(function() {
            logDebug('Snapshot id', snapshotId);
            percyClient.finalizeSnapshot(snapshotId);
          });
        });
  } else {
    Promise.all(buildResourceUploadPromises).then(function() {
      percyClient.finalizeSnapshot(snapshotId);
    });
    callback();
  }
}
function uploadHtml ( buildId , snapshotId , htmlResource , missingResources , callback ) { if ( missingResources . length > 0 ) { percyClient . uploadResource ( buildId , htmlResource . content ) . then ( function ( ) { callback ( ) ; Promise . all ( buildResourceUploadPromises ) . then ( function ( ) { logDebug ( 'Snapshot id' , snapshotId ) ; percyClient . finalizeSnapshot ( snapshotId ) ; } ) ; } ) ; } else { Promise . all ( buildResourceUploadPromises ) . then ( function ( ) { percyClient . finalizeSnapshot ( snapshotId ) ; } ) ; callback ( ) ; } }
Uploads the html snapshot to percy if it doesn't already have it stored.
Uploads the html snapshot to percy if it doesn ' t already have it stored .
// We assume there is only one missing resource here and it is the root // resource. All other resources should be build resources. // After we're sure all build resources are uploaded, finalize the // snapshot. // No missing resources, we can immediately finalize the snapshot after // build resources. // No resources to upload, so resolve immediately.