nx
nx copied to clipboard
Cypress component testing "Property 'myCommand' does not exist on type 'cy & CyEventEmitter'"
Current Behavior
When using Cypress component testing generator, command types are not detected causing "Property 'myCommand' does not exist on type 'cy & CyEventEmitter'" error.
Expected Behavior
Command types defined in ${projectRoot}/cypress/support/**/*.ts should be detected.
Steps to Reproduce
nx g @nrwl/angular:cypress-component-configuration --project app- Add the following to
cypress/support/commands.ts:
import { mount } from 'cypress/angular';
declare global {
namespace Cypress {
interface Chainable<Subject> {
mount: typeof mount;
}
}
}
Cypress.Commands.add('mount', mount);
- Add test
example.cy.ts - Call
cy.mount()
Environment
Node : 18.3.0
OS : darwin x64
yarn : 3.2.3
nx : 14.7.8
@nrwl/angular : 14.7.8
@nrwl/cypress : 14.7.8
@nrwl/detox : Not Found
@nrwl/devkit : 14.7.8
@nrwl/eslint-plugin-nx : 14.7.8
@nrwl/expo : Not Found
@nrwl/express : Not Found
@nrwl/jest : 14.7.8
@nrwl/js : 14.7.8
@nrwl/linter : 14.7.8
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : 14.7.8
@nrwl/nx-cloud : Not Found
@nrwl/nx-plugin : Not Found
@nrwl/react : Not Found
@nrwl/react-native : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : 14.7.8
@nrwl/web : Not Found
@nrwl/workspace : 14.7.8
typescript : 4.7.4
---------------------------------------
Local workspace plugins:
---------------------------------------
Community plugins:
@jscutlery/cypress-angular: 0.9.22
@testing-library/angular: 11.0.4