Bird
0
0

Given this snippet in cypress/plugins/index.js:

medium📝 Predict Output Q4 of 15
Cypress - Plugins and Ecosystem
Given this snippet in cypress/plugins/index.js:
module.exports = (on, config) => {
  require('@cypress/code-coverage/task')(on, config);
  return config;
};
What will happen if you remove the line with require('@cypress/code-coverage/task')(on, config);?
ACode coverage data will not be collected during tests
BTests will fail to run due to syntax error
CCode coverage will be collected but reports won't generate
DPlugin will automatically enable coverage without this line
Step-by-Step Solution
Solution:
  1. Step 1: Understand the role of the task registration

    The line registers the code coverage task with Cypress to collect coverage data.
  2. Step 2: Consequence of removing the task registration

    Without this line, coverage data collection will not happen, so coverage info is missing.
  3. Final Answer:

    Code coverage data will not be collected during tests -> Option A
  4. Quick Check:

    Task registration missing = no coverage data [OK]
Quick Trick: Register coverage task in plugins for data collection [OK]
Common Mistakes:
  • Assuming tests fail without this line
  • Thinking reports generate without data
  • Believing plugin auto-enables coverage

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Cypress Quizzes