Skip to content

Commit

Permalink
chore: ensure consistency by adding prettier config for IDE to pick up
Browse files Browse the repository at this point in the history
  • Loading branch information
quantizor committed Dec 6, 2024
1 parent aedfc04 commit e93aa7b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 21 deletions.
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"singleQuote": false
}
10 changes: 5 additions & 5 deletions packages/cypress-cloud/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/// <reference types="cypress" />
import 'source-map-support/register.js';
import "source-map-support/register.js";

import { run as internalRun } from './lib/run';
export type { CurrentsConfig } from './lib/config/config';
import { CurrentsRunAPI } from './types';
export type { CurrentsRunAPI } from './types';
import { run as internalRun } from "./lib/run";
export type { CurrentsConfig } from "./lib/config/config";
import { CurrentsRunAPI } from "./types";
export type { CurrentsRunAPI } from "./types";
/**
* Run Cypress tests with a cloud service of your choice and return the results
*
Expand Down
35 changes: 19 additions & 16 deletions packages/cypress-cloud/lib/config/config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Debug from 'debug';
import Debug from "debug";

import { P, match } from 'ts-pattern';
import { DetectedBrowser, ValidatedCurrentsParameters } from '../../types';
import { bootCypress } from '../bootstrap';
import { info, warn } from '../log';
import { getConfigFilePath } from './path';
import { P, match } from "ts-pattern";
import { DetectedBrowser, ValidatedCurrentsParameters } from "../../types";
import { bootCypress } from "../bootstrap";
import { info, warn } from "../log";
import { getConfigFilePath } from "./path";

const debug = Debug('currents:config');
const debug = Debug("currents:config");

export type E2EConfig = {
batchSize: number;
Expand Down Expand Up @@ -45,13 +45,13 @@ const defaultConfig: CurrentsConfig = {
component: {
batchSize: 5,
},
cloudServiceUrl: 'https://cy.currents.dev',
cloudServiceUrl: "https://cy.currents.dev",
networkHeaders: undefined,
};

export async function getCurrentsConfig(
projectRoot?: string,
explicitConfigFilePath?: string
explicitConfigFilePath?: string,
): Promise<CurrentsConfig> {
if (_config) {
return _config;
Expand All @@ -76,7 +76,10 @@ export async function getCurrentsConfig(
}
}

warn('Failed to load config file, falling back to the default config. Attempted locations: %s', configFilePath);
warn(
"Failed to load config file, falling back to the default config. Attempted locations: %s",
configFilePath,
);
_config = defaultConfig;
return _config;
}
Expand All @@ -86,14 +89,14 @@ async function loadConfigFile(filepath: string) {
debug("loading currents config file from '%s'", filepath);
return await import(filepath);
} catch (e) {
debug('failed loading config file from: %s', e);
debug("failed loading config file from: %s", e);
return null;
}
}

export type MergedConfig = Awaited<ReturnType<typeof getMergedConfig>>;
export async function getMergedConfig(params: ValidatedCurrentsParameters) {
debug('resolving cypress config');
debug("resolving cypress config");
const cypressResolvedConfig:
| (Cypress.ResolvedConfigOptions & {
projectRoot: string;
Expand All @@ -102,12 +105,12 @@ export async function getMergedConfig(params: ValidatedCurrentsParameters) {
})
| undefined = await bootCypress(params);

debug('cypress resolvedConfig: %O', cypressResolvedConfig);
debug("cypress resolvedConfig: %O", cypressResolvedConfig);

// @ts-ignore
const rawE2EPattern = cypressResolvedConfig.rawJson?.e2e?.specPattern;
let additionalIgnorePattern: string[] = [];
if (params.testingType === 'component' && rawE2EPattern) {
if (params.testingType === "component" && rawE2EPattern) {
// @ts-ignore
additionalIgnorePattern = rawE2EPattern;
}
Expand All @@ -117,14 +120,14 @@ export async function getMergedConfig(params: ValidatedCurrentsParameters) {
const result = {
projectRoot: cypressResolvedConfig?.projectRoot || process.cwd(),
projectId: params.projectId,
specPattern: cypressResolvedConfig?.specPattern || '**/*.*',
specPattern: cypressResolvedConfig?.specPattern || "**/*.*",
excludeSpecPattern:
// @ts-ignore
cypressResolvedConfig?.resolved.excludeSpecPattern.value ?? [],
additionalIgnorePattern,
resolved: cypressResolvedConfig,
experimentalCoverageRecording: params.experimentalCoverageRecording,
};
debug('merged config: %O', result);
debug("merged config: %O", result);
return result;
}

0 comments on commit e93aa7b

Please sign in to comment.