cypress-documentation
                                
                                 cypress-documentation copied to clipboard
                                
                                    cypress-documentation copied to clipboard
                            
                            
                            
                        Run single spec example does not work
Subject
Guides
Description
I am trying to follow the guide on how to run a single spec file (great for use during development of that spec). However, the example provided does not work for me and I wonder if this is a regression with the recent upgrades.
The section on this page shows the following examples:
npm run cy:run --record --spec "cypress/e2e/my-spec.cy.js"
npx cypress run --record --spec "cypress/e2e/my-spec.cy.js"
However, only the latter works for me (with npx). When I run the command with the npm script it collects all my specs and runs them.
Current version:
- node 16.14
- npm 8.5
- cypress 10.3.0
Please update the guide or fix the issue. Not sure what is going on. Thanks.
 
                                    
                                    
                                    
                                
I just figured it out. You need to add -- after the script target like so,
npm run cy:run -- --record --spec "cypress/path/to/spec.cy.js"
An update would be great and may avoid some confusion from others. Thanks!
A pull request has been added for this here
This has been updated 🙏