Bird
0
0

What is wrong with this plugin code?

medium📝 Debug Q7 of 15
Cypress - Plugins and Ecosystem
What is wrong with this plugin code?
module.exports = (on, config) => {
  on('before:browser:launch', (browser = {}, launchOptions) => {
    launchOptions.args.push('--disable-gpu')
  })
}
AUsing default parameter for browser is not allowed
BThe event name 'before:browser:launch' is invalid
ClaunchOptions.args is not an array
DThe event handler does not return launchOptions
Step-by-Step Solution
Solution:
  1. Step 1: Understand event handler requirements

    before:browser:launch handlers must return modified launchOptions object.
  2. Step 2: Check code behavior

    Code modifies launchOptions.args but does not return launchOptions, so changes are ignored.
  3. Final Answer:

    The event handler does not return launchOptions -> Option D
  4. Quick Check:

    Return launchOptions after modification [OK]
Quick Trick: Return modified launchOptions in before:browser:launch [OK]
Common Mistakes:
  • Forgetting to return launchOptions
  • Assuming event name is wrong
  • Misunderstanding launchOptions structure

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes