Bird
0
0

Why must custom plugin tasks always return a value or a promise?

hard📝 Conceptual Q10 of 15
Cypress - Plugins and Ecosystem
Why must custom plugin tasks always return a value or a promise?
ATo ensure Cypress waits for task completion before continuing tests
BBecause tasks run in the browser and need return values for UI updates
CTo prevent syntax errors in the plugin file
DBecause Cypress ignores tasks without return values silently
Step-by-Step Solution
Solution:
  1. Step 1: Understand Cypress task execution model

    Tasks run in Node process; Cypress waits for returned value or promise before continuing.
  2. Step 2: Eliminate incorrect options

    Tasks do not run in the browser. Syntax errors are unrelated to return values. Cypress does not ignore tasks silently; it fails if no return.
  3. Final Answer:

    To ensure Cypress waits for task completion before continuing tests -> Option A
  4. Quick Check:

    Return value/promise ensures Cypress waits [OK]
Quick Trick: Return value or promise so Cypress waits for task [OK]
Common Mistakes:
  • Thinking tasks run in browser
  • Assuming missing return causes silent ignore
  • Confusing syntax errors with missing return

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes