Skip to content

Cypress Component Testing in Nx monorepo: TS2339: Property mount does not exist on type cy & CyEventEmitte #33629

@tomalaforge

Description

@tomalaforge

Current Behavior

Since the upgrade of TS from 5.5 to 5.9, cypress files in a Nx monorepo don't recognize everything that is defined inside the cypress/support/component.ts in each library.
We have a TS2339: Property mount does not exist on type cy & CyEventEmitte for instance

Mount is defined

import { mount } from 'cypress/angular';

declare global {
  // eslint-disable-next-line @typescript-eslint/no-namespace
  namespace Cypress {
    // eslint-disable-next-line @typescript-eslint/no-unused-vars
    interface Chainable<Subject> {
      mount: typeof mount;
    }
  }
}

Cypress.Commands.add('mount', mount);

Expected Behavior

no TS errors

GitHub Repo

No response

Steps to Reproduce

1.have CCT in your project
2.migrate to typescript 5.9

Nx Report

Node           : 20.19.4
OS             : darwin-arm64
Native Target  : aarch64-macos
pnpm           : 10.22.0

nx (global)        : 18.0.1
nx                 : 22.0.1
@nx/js             : 22.0.1
@nx/jest           : 22.0.1
@nx/eslint         : 22.0.1
@nx/workspace      : 22.0.1
@nx/angular        : 22.0.1
@nx/cypress        : 22.0.1
@nx/devkit         : 22.0.1
@nx/eslint-plugin  : 22.0.1
@nx/nest           : 22.0.1
@nx/node           : 22.0.1
@nx/plugin         : 22.0.1
@nx/react          : 22.0.1
@nx/rspack         : 22.0.1
@nx/storybook      : 22.0.1
@nx/vite           : 22.0.1
@nx/web            : 22.0.1
@nx/webpack        : 22.0.1
typescript         : 5.9.3

Failure Logs

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

Metadata

Metadata

Assignees

Labels

priority: mediumMedium Priority (not high, not low priority)scope: angularIssues related to Angular support in Nxtype: bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions