0
0
Cypresstesting~10 mins

Code coverage plugin in Cypress - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the Cypress code coverage plugin.

Cypress
import '[1]';
Drag options to blanks, or click blank then click option'
A@cypress/code-coverage/support
Bcypress/code-coverage/plugin
C@cypress/code-coverage/plugin
Dcypress/code-coverage/support
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'plugin' instead of 'support' in the import path.
Omitting the '@' symbol in the package name.
2fill in blank
medium

Complete the code to require the code coverage plugin in the Cypress plugins file.

Cypress
module.exports = (on, config) => { on('task', require('[1]')(on, config)); return config; };
Drag options to blanks, or click blank then click option'
Acypress/code-coverage/support
B@cypress/code-coverage/plugin
C@cypress/code-coverage/support
Dcypress/code-coverage/plugin
Attempts:
3 left
💡 Hint
Common Mistakes
Using the support path instead of the plugin path.
Forgetting to return the config object.
3fill in blank
hard

Fix the error in the code to correctly enable code coverage in Cypress plugins.

Cypress
const codeCoverageTask = require('[1]'); module.exports = (on, config) => { codeCoverageTask(on, config); return config; };
Drag options to blanks, or click blank then click option'
Acypress/code-coverage/plugin
B@cypress/code-coverage/support
C@cypress/code-coverage/plugin
Dcypress/code-coverage/support
Attempts:
3 left
💡 Hint
Common Mistakes
Requiring the support module instead of the plugin module.
Omitting the '@' symbol in the package name.
4fill in blank
hard

Fill both blanks to configure Cypress to collect coverage and save reports.

Cypress
module.exports = (on, config) => { on('[1]', require('@cypress/code-coverage/plugin')(on, config)); return [2]; };
Drag options to blanks, or click blank then click option'
Atask
Bconfig
Csettings
Dconfiguration
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong event names like 'settings' or 'configuration'.
Returning a wrong variable instead of config.
5fill in blank
hard

Fill all three blanks to add code coverage support import and configure plugin in Cypress.

Cypress
import '[1]';

module.exports = (on, [2]) => {
  on('[3]', require('@cypress/code-coverage/plugin')(on, [2]));
  return [2];
};
Drag options to blanks, or click blank then click option'
A@cypress/code-coverage/support
Bconfig
Ctask
Dsettings
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'settings' instead of 'task' for the event.
Not returning the config object after plugin setup.