@nx/cypress
Version:
32 lines (31 loc) • 1.97 kB
TypeScript
import { type Tree } from '@nx/devkit';
import type { ObjectLiteralExpression } from 'typescript';
import type { NxComponentTestingOptions, NxCypressE2EPresetOptions } from '../../plugins/cypress-preset';
export declare const CYPRESS_CONFIG_FILE_NAME_PATTERN = "cypress.config.{js,ts,mjs,cjs}";
export declare const JIT_COMPILE_DISABLE_COMMENT: string[];
export declare function addDefaultE2EConfig(cyConfigContents: string, options: NxCypressE2EPresetOptions, baseUrl: string): Promise<string>;
/**
* Adds the nxComponentTestingPreset to the cypress config file.
*
* Pass `presetImportPath` (e.g. `@nx/angular/plugins/component-testing`) to
* have the matching `import` (ESM) or `const { ... } = require(...)` (CJS)
* statement prepended automatically based on the detected module shape.
* Without it, the caller is responsible for prepending the import - but
* doing so unconditionally produces mixed-syntax files in CJS workspaces
* (an ESM `import` followed by a CJS `module.exports`), so prefer passing
* `presetImportPath`.
*
* Pass `cypressMajorVersion` to opt webpack setups out of `justInTimeCompile`
* on Cypress 14+, where it defaults to `true` and can intermittently run 0
* tests in CI. The opt-out is emitted as an explicit `justInTimeCompile: false`
* so it is visible and reversible.
**/
export declare function addDefaultCTConfig(cyConfigContents: string, options?: NxComponentTestingOptions, presetImportPath?: string, cypressMajorVersion?: number | null): Promise<string>;
/**
* Adds the mount command for Cypress
* Make sure after calling this the correct import statement is added
* to bring in the correct mount from cypress.
**/
export declare function addMountDefinition(cmpCommandFileContents: string): Promise<string>;
export declare function getProjectCypressConfigPath(tree: Tree, projectRoot: string): string;
export declare function resolveCypressConfigObject(cypressConfigContents: string): ObjectLiteralExpression | null;