Skip to content

Commit

Permalink
chore: ..
Browse files Browse the repository at this point in the history
  • Loading branch information
agoldis committed Sep 22, 2023
1 parent d502b12 commit ccbb852
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 22 deletions.
9 changes: 0 additions & 9 deletions packages/cypress-cloud/lib/__tests__/dataFlow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from "@jest/globals";
export const tests = {
config: {
videoUploadOnPasses: false,
videoUploadOnPasses: true,
},
tests: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from "@jest/globals";

export const tests = {
config: {
videoUploadOnPasses: false,
videoUploadOnPasses: true,
},
tests: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from "@jest/globals";

export const tests = {
config: {
videoUploadOnPasses: false,
videoUploadOnPasses: true,
},
tests: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from "@jest/globals";

export const tests = {
config: {
videoUploadOnPasses: false,
videoUploadOnPasses: true,
},
tests: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { expect } from "@jest/globals";

export const tests = {
config: {
videoUploadOnPasses: false,
videoUploadOnPasses: true,
},
tests: [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -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,
])
);
});
Expand Down Expand Up @@ -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",
Expand All @@ -104,7 +110,7 @@ describe("getBootstrapArgs", () => {
"--reporter-options",
JSON.stringify(reporterOptions),
"--env",
JSON.stringify(defaultEnv),
JSON.stringify(sortObjectKeys(defaultEnv)),
"--spec",
expect.any(String),
"--e2e",
Expand All @@ -129,7 +135,7 @@ describe("getBootstrapArgs", () => {
"--config",
JSON.stringify(config),
"--env",
JSON.stringify(defaultEnv),
JSON.stringify(sortObjectKeys(defaultEnv)),
"--spec",
expect.any(String),
"--e2e",
Expand Down
5 changes: 5 additions & 0 deletions packages/cypress-cloud/lib/bootstrap/serializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
Expand Down
10 changes: 10 additions & 0 deletions packages/cypress-cloud/lib/lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,13 @@ export const safe =
return ifFaled(e);
}
};

export const sortObjectKeys = <T extends Record<string, any>>(obj: T) => {
return Object.keys(obj)
.sort()
.reduce((acc, key) => {
// @ts-ignore
acc[key] = obj[key];
return acc;
}, {} as T);
};

0 comments on commit ccbb852

Please sign in to comment.