Cypress · Junior · Question 53 of 75

What does cy.task() do?

Show the answer

Correct answer: Runs code in the Node process, e.g. to seed a database

Explanation

Tasks are registered in setupNodeEvents and can do things the browser can't, like file system or database access.

Further reading

Problem with a question

Cypress · Junior · question 53

Test yourself

Take the Cypress · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz