async function finalizeBuild(getDiffs = false) {
  logger.log('[percy] Finalizing build...');

  try {
    // These promises need to be processed sequentially, not concurrently.
    const {body: {data: percyBuildData}} = await percyBuildPromise;
    // We also need to wait until all snapshot resources have been uploaded.
    // We do NOT need to wait until the snapshot itself has been finalized, just
    // until resources are uploaded.
    await Promise.all(snapshotResourceUploadPromises);
    // Finalize the build.
    await percyClient.finalizeBuild(percyBuildData.id);
    // Avoid trying to add snapshots to an already-finalized build. This might
    // happen when running tests locally and the browser gets refreshed after
    // the end of a test run. Generally, this is not a problem because tests
    // only run in CI and only once.
    isPercyEnabled = false;

    // Attempt to make our logging come last, giving time for test output to finish.
    var url = percyBuildData.attributes['web-url'];
    process.nextTick(function() {
      logger.log('[percy] Visual diffs are now processing:', url);
    });

    if (getDiffs) {
      await getBuildPromise(percyBuildData.id);
    }

  } catch (err) {
    handlePercyFailure(err);
  }
}
/**
 * Finalizes the request to be sent to Percy api which includes all the assets,
 * snapshots, etc.
 * Return this in karma onComplete() phase after all test specs have been run.
 * @param {boolean} getDiffs Set to true to request the build results from the server
 * after the diffs are generated. This feature will slow down the build process. To use
 * this feature, please reach out to the Percy team to get a token with read access.
 * @return {Promise}
 */
Finalizes the request to be sent to Percy api which includes all the assets,
snapshots, etc.
Return this in karma onComplete() phase after all test specs have been run.
@param {boolean} getDiffs Set to true to request the build results from the server
after the diffs are generated. This feature will slow down the build process. To use
this feature, please reach out to the Percy team to get a token with read access.
@return {Promise}
Finalizes the request to be sent to Percy api which includes all the assets snapshots etc . Return this in karma onComplete () phase after all test specs have been run . @param { boolean } getDiffs Set to true to request the build results from the server after the diffs are generated . This feature will slow down the build process . To use this feature please reach out to the Percy team to get a token with read access . @return { Promise }
async function finalizeBuild(getDiffs = false) {
  logger.log('[percy] Finalizing build...');
  try {
    const {body: {data: percyBuildData}} = await percyBuildPromise;
    await Promise.all(snapshotResourceUploadPromises);
    await percyClient.finalizeBuild(percyBuildData.id);
    isPercyEnabled = false;
    var url = percyBuildData.attributes['web-url'];
    process.nextTick(function() {
      logger.log('[percy] Visual diffs are now processing:', url);
    });
    if (getDiffs) {
      await getBuildPromise(percyBuildData.id);
    }
  } catch (err) {
    handlePercyFailure(err);
  }
}
async function finalizeBuild ( getDiffs = false ) { logger . log ( '[percy] Finalizing build...' ) ; try { const { body : { data : percyBuildData } } = await percyBuildPromise ; await Promise . all ( snapshotResourceUploadPromises ) ; await percyClient . finalizeBuild ( percyBuildData . id ) ; isPercyEnabled = false ; var url = percyBuildData . attributes [ 'web-url' ] ; process . nextTick ( function ( ) { logger . log ( '[percy] Visual diffs are now processing:' , url ) ; } ) ; if ( getDiffs ) { await getBuildPromise ( percyBuildData . id ) ; } } catch ( err ) { handlePercyFailure ( err ) ; } }
Finalizes the request to be sent to Percy api which includes all the assets,
 snapshots, etc.
Finalizes the request to be sent to Percy api which includes all the assets snapshots etc .
// These promises need to be processed sequentially, not concurrently. // We also need to wait until all snapshot resources have been uploaded. // We do NOT need to wait until the snapshot itself has been finalized, just // until resources are uploaded. // Finalize the build. // Avoid trying to add snapshots to an already-finalized build. This might // happen when running tests locally and the browser gets refreshed after // the end of a test run. Generally, this is not a problem because tests // only run in CI and only once. // Attempt to make our logging come last, giving time for test output to finish.