Node.js · Middle · Question 55 of 75

How do you mock a function with the built-in test runner?

Explanation

node:test also has mock.method for object methods, mock.timers for fake timers and module mocking.

Further reading

Problem with a question

Node.js · Middle · question 55

Test yourself

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

Take this quiz