-
Notifications
You must be signed in to change notification settings - Fork 3.4k
docs(cli): add comprehensive test documentation and examples #32908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
docs(cli): add comprehensive test documentation and examples #32908
Conversation
- Document createfs() helper with TypeScript types and examples - Add cli/test/README.md with comprehensive testing guide - Provide Given/When/Then examples and debugging tips - Remove TODO comment about documentation needs This addresses the TODO in cli/test/lib/tasks/verify.spec.ts about badly needed documentation.
|
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Default-Value Triggers Unintended Symlink Creation
The condition if (customDir) will always be true because customDir is set to a default value earlier in the function (line 958). This causes the symlink at /custom/Contents/MacOS/Cypress to be created for all tests, even when no custom directory was provided. The condition should check if a custom directory was originally provided by the caller, not just if the variable is truthy. This could be fixed by checking the original parameter value or using a different condition like checking if customDir doesn't equal the default value.
cli/test/lib/tasks/verify.spec.ts#L995-L1001
| ### Prerequisites | ||
|
|
||
| Ensure you have Node.js and Yarn installed: | ||
| - Node.js: ^20.1.0 || ^22.0.0 || >=24.0.0 | ||
| - Yarn: Latest stable |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is incorrect. See https://github.com/cypress-io/cypress/blob/develop/CONTRIBUTING.md#requirements for Node.js and Yarn.
yarn set version stablewill install the wrong version: Yarn Modern v4.x
Yarn v1 Classic is needed.
| cd cli && yarn test-debug | ||
|
|
||
| # Run specific test by pattern | ||
| cd cli && yarn test --grep "should verify successfully" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This fails:
$ yarn test --grep "should verify successfully"
yarn run v1.22.22
$ yarn test-unit --grep 'should verify successfully'
$ vitest run --grep 'should verify successfully'
file:///home/mike/github/cypress-io/cypress/node_modules/vitest/dist/chunks/cac.Cb-PYCCB.js:404
throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
^
CACError: Unknown option `--grep`
MikeMcC399
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I only commented on a couple of issues without reviewing the whole PR.
The CLA is not signed.
This addresses the TODO in cli/test/lib/tasks/verify.spec.ts about badly needed documentation.
Additional details
Steps to test
How has the user experience changed?
PR Tasks
cypress-documentation?type definitions?Note
Adds a comprehensive CLI test suite README and documents/types the
createfs()helper inlib/tasks/verify.spec.ts.cli/test/README.md: Overview of test structure, commands, mocking strategies, common patterns (Given/When/Then), debugging, coverage, and contribution checklist.cli/test/lib/tasks/verify.spec.ts:CreateFileSystemOptionsTypeScript interface and type the function.Written by Cursor Bugbot for commit db8845b. This will update automatically on new commits. Configure here.