From d96de4fe633d83c3479a3ec0b11eaccfa2634fa4 Mon Sep 17 00:00:00 2001 From: Miguel Langarano Date: Mon, 25 Sep 2023 22:07:29 -0500 Subject: [PATCH] fix: fixed cypress 12 compatibility tests --- CHANGELOG.md | 7 ++----- packages/cypress-cloud/lib/git.ts | 2 +- .../lib/results/specAfterResult.ts | 19 ++++++++++++------- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f470b22..b24fed9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,8 @@ - - # [2.0.0-beta.1](https://github.com/currents-dev/cypress-cloud/compare/v2.0.0-beta.0...v2.0.0-beta.1) (2023-09-22) - ### Bug Fixes -* debugging fixes ([d502b12](https://github.com/currents-dev/cypress-cloud/commit/d502b121b4a5bb85921fa26b6b04a12274be3b19)) +- debugging fixes ([d502b12](https://github.com/currents-dev/cypress-cloud/commit/d502b121b4a5bb85921fa26b6b04a12274be3b19)) # [2.0.0-beta.0](https://github.com/currents-dev/cypress-cloud/compare/v1.10.0-beta.1...v2.0.0-beta.0) (2023-09-19) @@ -339,4 +336,4 @@ - implement generic http client with retries ([a9711bd](https://github.com/currents-dev/cypress-cloud/commit/a9711bde1fbb2cd37dbc8979593159d183bfa866)) - improve setup steps ([9bf16fe](https://github.com/currents-dev/cypress-cloud/commit/9bf16fe5f3773db4aa2f169515303ea6d0973da6)) - separate stdout per spec file ([a9d01c3](https://github.com/currents-dev/cypress-cloud/commit/a9d01c349cbfe140a568a452b0e7163e6d27f2db)) -- setup github actions ([d439f56](https://github.com/currents-dev/cypress-cloud/commit/d439f5660698177087fcc2e7a61c64ea263816f6)) \ No newline at end of file +- setup github actions ([d439f56](https://github.com/currents-dev/cypress-cloud/commit/d439f5660698177087fcc2e7a61c64ea263816f6)) diff --git a/packages/cypress-cloud/lib/git.ts b/packages/cypress-cloud/lib/git.ts index 7fed105..3865fee 100644 --- a/packages/cypress-cloud/lib/git.ts +++ b/packages/cypress-cloud/lib/git.ts @@ -6,7 +6,7 @@ export const getGitInfo = async (projectRoot: string) => { const commitInfo = await git.commitInfo(projectRoot); return getCommitDefaults({ branch: commitInfo.branch, - remoteOrigin: commitInfo.remote ?? 'null', + remoteOrigin: commitInfo.remote ?? "null", authorEmail: commitInfo.email, authorName: commitInfo.author, message: commitInfo.message, diff --git a/packages/cypress-cloud/lib/results/specAfterResult.ts b/packages/cypress-cloud/lib/results/specAfterResult.ts index ad16868..3aa4b2c 100644 --- a/packages/cypress-cloud/lib/results/specAfterResult.ts +++ b/packages/cypress-cloud/lib/results/specAfterResult.ts @@ -114,11 +114,11 @@ export class SpecAfterResult { timings: "timings" in cypressAttempt ? cypressAttempt.timings : null, wallClockStartedAt: "wallClockStartedAt" in cypressAttempt - ? (cypressAttempt.wallClockStartedAt ?? new Date().toISOString()) + ? cypressAttempt.wallClockStartedAt ?? new Date().toISOString() : new Date().toISOString(), startedAt: "startedAt" in cypressAttempt - ? (cypressAttempt.startedAt ?? new Date().toISOString()) + ? cypressAttempt.startedAt ?? new Date().toISOString() : new Date().toISOString(), wallClockDuration: duration ? duration : 0, failedFromHookId: @@ -127,7 +127,7 @@ export class SpecAfterResult { : null, videoTimestamp: "videoTimestamp" in cypressAttempt - ? (cypressAttempt.videoTimestamp ?? 0) + ? cypressAttempt.videoTimestamp ?? 0 : 0, }; } @@ -154,9 +154,9 @@ export class SpecAfterResult { "videoTimestamp" in cypressAttempt ? cypressAttempt.videoTimestamp : SpecAfterResult.getAttemptVideoTimestamp( - parseISO(mochaAttempt.wallClockStartedAt).getTime(), - specStartedAt.getTime() - ), + parseISO(mochaAttempt.wallClockStartedAt).getTime(), + specStartedAt.getTime() + ), }; } @@ -201,7 +201,12 @@ export class SpecAfterResult { spec: CypressTypes.EventPayload.SpecAfter.Spec ): Standard.SpecAfter.Spec { return { - name: parseFloat(_cypressVersion!) >= 13 ? spec.name : ("baseName" in spec ? spec.baseName : ""), + name: + parseFloat(_cypressVersion!) >= 13 + ? spec.name + : "baseName" in spec + ? spec.baseName + : "", relative: spec.relative, absolute: spec.absolute, fileExtension: spec.fileExtension,