Affected URL(s)
https://nodejs.org/en/learn/test-runner/mocking
Description of the problem
The example given "Modules + units" uses a call to mock.fn() without any parameters, causing " barMock.mockImplementationOnce" to fail later on.
I am not sure if the example is only for demonstration purposes but I tried to run it :)
const barMock = mock.fn();
Later on it calls:
barMock.mockImplementationOnce(function bar_mock() {
/* … */
});
Since the barMock function did not receive a function parameter above, the call to barMock.mockImplementationOnce fails.
Affected URL(s)
https://nodejs.org/en/learn/test-runner/mocking
Description of the problem
The example given "Modules + units" uses a call to mock.fn() without any parameters, causing " barMock.mockImplementationOnce" to fail later on.
I am not sure if the example is only for demonstration purposes but I tried to run it :)
const barMock = mock.fn();Later on it calls:
Since the barMock function did not receive a function parameter above, the call to barMock.mockImplementationOnce fails.