-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Labels
priority: highHigh Priority (important issues which affect many people severely)High Priority (important issues which affect many people severely)scope: testing toolsIssues related to Cypress / Jest / Playwright / Vitest support in NxIssues related to Cypress / Jest / Playwright / Vitest support in Nxtype: bug
Description
Current Behavior
After adding a Cypress configuration to a library, using documentation instructions, Typescript errors are raised when running typecheck target.
Expected Behavior
Running typecheck target should pass.
GitHub Repo
https://github.com/productboardlabs/nx-cypress-typecheck-bug
Steps to Reproduce
pnpm dlx create-nx-workspace@latest- Select React stack.
- Framework None
- No React Router
- Vite for bundler
- Vitest for tests
- Test runner: Cypress
- CSS for default styles
- Eslint: yes
- Prettier: yes
- No coding agent
- No CI provider
- No remote cache
pnpm add @nx/cypresspnpm nx g @nx/js:library libs/feature- Select
vitebundler,eslintandvitest pnpm nx g @nx/cypress:configuration, select@nx-cypress-typecheck-bug/feature, useviteas bundler,eslint,@nx-cypress-typecheck-bug/feature:servetarget, port3000pnpm nx sync- Run
pnpm nx typecheck feature
You will see errors
Nx Report
Node : 22.15.0
OS : darwin-arm64
Native Target : aarch64-macos
pnpm : 10.17.1
nx : 21.6.2
@nx/js : 21.6.2
@nx/eslint : 21.6.2
@nx/workspace : 21.6.2
@nx/cypress : 21.6.2
@nx/devkit : 21.6.2
@nx/eslint-plugin : 21.6.2
@nx/module-federation : 21.6.2
@nx/react : 21.6.2
@nx/rollup : 21.6.2
@nx/vite : 21.6.2
@nx/web : 21.6.2
typescript : 5.9.3
---------------------------------------
Registered Plugins:
@nx/js/typescript
@nx/eslint/plugin
@nx/vite/plugin
@nx/cypress/plugin
---------------------------------------
Cache Usage: 0.00 B / 46.04 GBFailure Logs
cypress/e2e/app.cy.ts:8:8 - error TS2551: Property 'login' does not exist on type 'cy & CyEventEmitter'. Did you mean 'log'?
8 cy.login('[email protected]', 'myPassword');
~~~~~
../node_modules/.pnpm/[email protected]/node_modules/cypress/types/cypress.d.ts:1567:5
1567 log(message: string, ...args: any[]): Chainable<null>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
'log' is declared here.
cypress/support/commands.ts:13:9 - error TS2669: Augmentations for the global scope can only be directly nested in external modules or ambient module declarations.
13 declare global {
~~~~~~
cypress/support/commands.ts:24:22 - error TS2345: Argument of type '"login"' is not assignable to parameter of type 'keyof Chainable<any>'.
24 Cypress.Commands.add('login', (email, password) => {Package Manager Version
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
No response
Metadata
Metadata
Assignees
Labels
priority: highHigh Priority (important issues which affect many people severely)High Priority (important issues which affect many people severely)scope: testing toolsIssues related to Cypress / Jest / Playwright / Vitest support in NxIssues related to Cypress / Jest / Playwright / Vitest support in Nxtype: bug