Bird
0
0

Why should you avoid leaving .only in your Cypress test code before committing?

hard📝 Conceptual Q10 of 15
Cypress - Writing Tests
Why should you avoid leaving .only in your Cypress test code before committing?
ABecause it causes syntax errors in Cypress.
BBecause it makes all tests run twice, slowing down CI.
CBecause it disables all tests in the project.
DBecause it causes only that test or suite to run, skipping others unintentionally.
Step-by-Step Solution
Solution:
  1. Step 1: Understand the effect of .only on test runs

    .only focuses Cypress to run only the marked test or suite, skipping all others.
  2. Step 2: Consider impact on CI and team

    If left accidentally, other tests won't run, causing incomplete test coverage and possible bugs.
  3. Final Answer:

    Because it causes only that test or suite to run, skipping others unintentionally. -> Option D
  4. Quick Check:

    Never commit .only; it skips other tests [OK]
Quick Trick: Remove .only before commit to run all tests [OK]
Common Mistakes:
  • Thinking .only runs all tests
  • Believing .only causes errors
  • Ignoring skipped tests impact

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes