From 709766c325e7339d6e211883b38c15c9f1c3cbc3 Mon Sep 17 00:00:00 2001 From: Andrew Goldis Date: Mon, 18 Sep 2023 23:17:01 -0700 Subject: [PATCH] chore: fix warnings --- packages/cypress-cloud/lib/artifacts.ts | 22 +++++-------------- .../cypress-cloud/lib/results/captureHooks.ts | 10 +++------ 2 files changed, 9 insertions(+), 23 deletions(-) diff --git a/packages/cypress-cloud/lib/artifacts.ts b/packages/cypress-cloud/lib/artifacts.ts index 0c1e162..ca3dc47 100644 --- a/packages/cypress-cloud/lib/artifacts.ts +++ b/packages/cypress-cloud/lib/artifacts.ts @@ -2,7 +2,7 @@ import Debug from "debug"; import { ScreenshotArtifact, ScreenshotUploadInstruction } from "../types"; import { updateInstanceStdout } from "./api"; import { safe } from "./lang"; -import { format } from "./log"; +import { dim } from "./log"; import { ExecutionState } from "./state"; import { uploadImage, uploadJson, uploadVideo } from "./upload"; const debug = Debug("currents:artifacts"); @@ -24,8 +24,6 @@ export async function uploadArtifacts({ coverageFilePath, coverageUploadUrl, }: UploadArtifacts) { - // title("blue", "Uploading Results"); - debug("uploading artifacts: %o", { videoPath, videoUploadUrl, @@ -38,7 +36,6 @@ export async function uploadArtifacts({ const totalUploads = (videoPath ? 1 : 0) + screenshots.length + (coverageUploadUrl ? 1 : 0); if (totalUploads === 0) { - // info("Nothing to upload"); return; } @@ -49,7 +46,7 @@ export async function uploadArtifacts({ (e) => { debug("failed uploading video %s. Error: %o", videoPath, e); executionState.addWarning( - format("Failed uploading video %s. Error: %s", videoPath, e) + `Failed uploading video ${videoPath}.\n${dim(e)}` ); }, () => debug("success uploading", videoPath) @@ -69,7 +66,7 @@ export async function uploadArtifacts({ screenshotUploadUrls ); executionState.addWarning( - format("No upload URL for screenshot: %s", screenshot.path) + `No upload URL for screenshot ${screenshot.path}` ); return Promise.resolve(); } @@ -82,11 +79,7 @@ export async function uploadArtifacts({ e ); executionState.addWarning( - format( - "Failed uploading screenshot %s. Error: %s", - screenshot.path, - e - ) + `Failed uploading screenshot ${screenshot.path}.\n${dim(e)}` ); }, () => debug("success uploading", screenshot.path) @@ -104,12 +97,9 @@ export async function uploadArtifacts({ coverageFilePath, e ); + executionState.addWarning( - format( - "Failed uploading coverage file %s. Error: %s", - coverageFilePath, - e - ) + `Failed uploading coverage file ${coverageFilePath}.\n${dim(e)}` ); }, diff --git a/packages/cypress-cloud/lib/results/captureHooks.ts b/packages/cypress-cloud/lib/results/captureHooks.ts index 1c34355..4f49ee5 100644 --- a/packages/cypress-cloud/lib/results/captureHooks.ts +++ b/packages/cypress-cloud/lib/results/captureHooks.ts @@ -2,7 +2,7 @@ import Debug from "debug"; import { getCapturedOutput } from "../capture"; import { getCoverageFilePath } from "../coverage"; import { CypressTypes } from "../cypress.types"; -import { dim, format } from "../log"; +import { dim } from "../log"; import { createReportTaskSpec } from "../runner"; import { ConfigState, ExecutionState } from "../state"; import { SpecAfterResult } from "./specAfterResult"; @@ -91,13 +91,9 @@ export async function handleSpecAfter({ executionState.setSpecCoverage(spec.relative, path); } else { executionState.addWarning( - format( - `Error reading coverage file "%s". Coverage recording will be skipped.\n${dim( - `Error: %s` - )}`, - path, + `Error reading coverage file "${path}". Coverage recording will be skipped.\n${dim( error - ) + )}` ); } }