diff --git a/packages/cypress-cloud/lib/__tests__/dataFlow.test.ts b/packages/cypress-cloud/lib/__tests__/dataFlow.test.ts index 6fc8ee5..6b68f22 100644 --- a/packages/cypress-cloud/lib/__tests__/dataFlow.test.ts +++ b/packages/cypress-cloud/lib/__tests__/dataFlow.test.ts @@ -30,15 +30,6 @@ const specs = [ "retries.spec.js", ] as const; -// const specs = [ -// "crash.spec.js", -// "passing.spec.js", -// "failed.spec.js", -// "pending.spec.js", -// "skipped.spec.js", -// "retries.spec.js", -// ]; - // /fixtures/12.17.4/fails.spec.js/12.17.4_fails.spec.js_specAfter function getFixtureBase(cypressVersion: string, spec: string) { return path.resolve(__dirname, `./fixtures/${cypressVersion}/${spec}`); diff --git a/packages/cypress-cloud/lib/__tests__/fixtures/api/crash.spec.js/payload.ts b/packages/cypress-cloud/lib/__tests__/fixtures/api/crash.spec.js/payload.ts index 1ae7147..5bf074f 100644 --- a/packages/cypress-cloud/lib/__tests__/fixtures/api/crash.spec.js/payload.ts +++ b/packages/cypress-cloud/lib/__tests__/fixtures/api/crash.spec.js/payload.ts @@ -1,7 +1,7 @@ import { expect } from "@jest/globals"; export const tests = { config: { - videoUploadOnPasses: false, + videoUploadOnPasses: true, }, tests: [{ body: "redacted", title: ["Unknown"], clientId: "r0" }], hooks: null, diff --git a/packages/cypress-cloud/lib/__tests__/fixtures/api/failed.spec.js/payload.ts b/packages/cypress-cloud/lib/__tests__/fixtures/api/failed.spec.js/payload.ts index 3b46907..55ebefe 100644 --- a/packages/cypress-cloud/lib/__tests__/fixtures/api/failed.spec.js/payload.ts +++ b/packages/cypress-cloud/lib/__tests__/fixtures/api/failed.spec.js/payload.ts @@ -1,7 +1,7 @@ import { expect } from "@jest/globals"; export const tests = { config: { - videoUploadOnPasses: false, + videoUploadOnPasses: true, }, tests: [ { diff --git a/packages/cypress-cloud/lib/__tests__/fixtures/api/passed.spec.js/payload.ts b/packages/cypress-cloud/lib/__tests__/fixtures/api/passed.spec.js/payload.ts index 9da236f..88f2dcf 100644 --- a/packages/cypress-cloud/lib/__tests__/fixtures/api/passed.spec.js/payload.ts +++ b/packages/cypress-cloud/lib/__tests__/fixtures/api/passed.spec.js/payload.ts @@ -2,7 +2,7 @@ import { expect } from "@jest/globals"; export const tests = { config: { - videoUploadOnPasses: false, + videoUploadOnPasses: true, }, tests: [ { diff --git a/packages/cypress-cloud/lib/__tests__/fixtures/api/pending.spec.js/payload.ts b/packages/cypress-cloud/lib/__tests__/fixtures/api/pending.spec.js/payload.ts index 4abc953..0287b74 100644 --- a/packages/cypress-cloud/lib/__tests__/fixtures/api/pending.spec.js/payload.ts +++ b/packages/cypress-cloud/lib/__tests__/fixtures/api/pending.spec.js/payload.ts @@ -2,7 +2,7 @@ import { expect } from "@jest/globals"; export const tests = { config: { - videoUploadOnPasses: false, + videoUploadOnPasses: true, }, tests: [ { diff --git a/packages/cypress-cloud/lib/__tests__/fixtures/api/retries.spec.js/payload.ts b/packages/cypress-cloud/lib/__tests__/fixtures/api/retries.spec.js/payload.ts index 4eae0c3..7f10dba 100644 --- a/packages/cypress-cloud/lib/__tests__/fixtures/api/retries.spec.js/payload.ts +++ b/packages/cypress-cloud/lib/__tests__/fixtures/api/retries.spec.js/payload.ts @@ -2,7 +2,7 @@ import { expect } from "@jest/globals"; export const tests = { config: { - videoUploadOnPasses: false, + videoUploadOnPasses: true, }, tests: [ { diff --git a/packages/cypress-cloud/lib/__tests__/fixtures/api/skipped.spec.js/payload.ts b/packages/cypress-cloud/lib/__tests__/fixtures/api/skipped.spec.js/payload.ts index 9f699f3..e1e380f 100644 --- a/packages/cypress-cloud/lib/__tests__/fixtures/api/skipped.spec.js/payload.ts +++ b/packages/cypress-cloud/lib/__tests__/fixtures/api/skipped.spec.js/payload.ts @@ -2,7 +2,7 @@ import { expect } from "@jest/globals"; export const tests = { config: { - videoUploadOnPasses: false, + videoUploadOnPasses: true, }, tests: [ { diff --git a/packages/cypress-cloud/lib/bootstrap/__tests__/getBootstrapParams.spec.ts b/packages/cypress-cloud/lib/bootstrap/__tests__/getBootstrapParams.spec.ts index 830be0d..9776bd3 100644 --- a/packages/cypress-cloud/lib/bootstrap/__tests__/getBootstrapParams.spec.ts +++ b/packages/cypress-cloud/lib/bootstrap/__tests__/getBootstrapParams.spec.ts @@ -1,9 +1,11 @@ import { expect } from "@jest/globals"; +import { sortObjectKeys } from "../../lang"; import { getBootstrapArgs } from "../serializer"; const defaultEnv = { currents_temp_file: "tempFilePath", currents_debug_enabled: false, + currents_marker: true, }; const defaultArgs = { @@ -29,10 +31,12 @@ describe("getBootstrapArgs", () => { expect(result).toEqual( expect.arrayContaining([ "--env", - JSON.stringify(defaultEnv), + JSON.stringify(sortObjectKeys(defaultEnv)), "--spec", expect.any(String), "--e2e", + "--record", + false, ]) ); }); @@ -76,10 +80,12 @@ describe("getBootstrapArgs", () => { expect(result).toEqual( expect.arrayContaining([ "--env", - JSON.stringify({ - ...env, - ...defaultEnv, - }), + JSON.stringify( + sortObjectKeys({ + ...env, + ...defaultEnv, + }) + ), "--spec", expect.any(String), "--e2e", @@ -104,7 +110,7 @@ describe("getBootstrapArgs", () => { "--reporter-options", JSON.stringify(reporterOptions), "--env", - JSON.stringify(defaultEnv), + JSON.stringify(sortObjectKeys(defaultEnv)), "--spec", expect.any(String), "--e2e", @@ -129,7 +135,7 @@ describe("getBootstrapArgs", () => { "--config", JSON.stringify(config), "--env", - JSON.stringify(defaultEnv), + JSON.stringify(sortObjectKeys(defaultEnv)), "--spec", expect.any(String), "--e2e", diff --git a/packages/cypress-cloud/lib/bootstrap/serializer.ts b/packages/cypress-cloud/lib/bootstrap/serializer.ts index bca8b0d..bd921d7 100644 --- a/packages/cypress-cloud/lib/bootstrap/serializer.ts +++ b/packages/cypress-cloud/lib/bootstrap/serializer.ts @@ -6,6 +6,7 @@ import Debug from "debug"; import _ from "lodash"; import { getCypressRunAPIParams } from "../config"; import { shouldEnablePluginDebug } from "../debug"; +import { sortObjectKeys } from "../lang"; import { getRandomString } from "../nano"; const debug = Debug("currents:boot"); @@ -30,6 +31,10 @@ export function getBootstrapArgs({ .tap((opts) => { debug("cypress bootstrap params: %o", opts); }) + .thru((opts) => ({ + ...opts, + env: sortObjectKeys(opts.env ?? {}), + })) .thru(serializeOptions) .tap((opts) => { debug("cypress bootstrap serialized params: %o", opts); diff --git a/packages/cypress-cloud/lib/cypress/__tests__/runSpecFile.spec.ts b/packages/cypress-cloud/lib/cypress/__tests__/runSpecFile.spec.ts index 0419393..da1e8ba 100644 --- a/packages/cypress-cloud/lib/cypress/__tests__/runSpecFile.spec.ts +++ b/packages/cypress-cloud/lib/cypress/__tests__/runSpecFile.spec.ts @@ -51,6 +51,8 @@ describe("runSpecFile", () => { expect(run).toHaveBeenCalledWith( expect.objectContaining({ env: { + currents_marker: true, + currents_debug_enabled: false, currents_ws: expect.any(Number), foo: "bar", }, diff --git a/packages/cypress-cloud/lib/lang.ts b/packages/cypress-cloud/lib/lang.ts index d8bf09f..2a20d2b 100644 --- a/packages/cypress-cloud/lib/lang.ts +++ b/packages/cypress-cloud/lib/lang.ts @@ -20,3 +20,13 @@ export const safe = return ifFaled(e); } }; + +export const sortObjectKeys = >(obj: T) => { + return Object.keys(obj) + .sort() + .reduce((acc, key) => { + // @ts-ignore + acc[key] = obj[key]; + return acc; + }, {} as T); +};