Bird
0
0

Which of the following is the correct syntax to run Cypress tests specifying a particular spec file?

easy📝 Syntax Q3 of 15
Cypress - CI/CD and Reporting
Which of the following is the correct syntax to run Cypress tests specifying a particular spec file?
Acypress run --spec=cypress/e2e/test.cy.js
Bcypress run -spec "cypress/e2e/test.cy.js"
Ccypress run --spec "cypress/e2e/test.cy.js"
Dcypress run --spec cypress/e2e/test.cy.js
Step-by-Step Solution
Solution:
  1. Step 1: Understand correct flag usage for spec files

    The correct flag is --spec followed by the file path in quotes.
  2. Step 2: Analyze options

    cypress run --spec "cypress/e2e/test.cy.js" uses correct syntax with quotes. cypress run -spec "cypress/e2e/test.cy.js" uses a single dash which is invalid. cypress run --spec=cypress/e2e/test.cy.js uses equals without quotes which is not recommended. cypress run --spec cypress/e2e/test.cy.js misses quotes which can cause issues with spaces.
  3. Final Answer:

    cypress run --spec "cypress/e2e/test.cy.js" -> Option C
  4. Quick Check:

    Correct spec flag syntax = --spec "file" [OK]
Quick Trick: Use double dash --spec with quoted path [OK]
Common Mistakes:
  • Using single dash -spec
  • Omitting quotes around file path
  • Using equals sign without quotes

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes