-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Description
Describe the bug
The getMockImplementation() method only returns permanent implementations, not implementations only added once. So the return value of getMockImplementation() can be different, than the implementation being called.
To me, it would make sense, that this method always returns the implementation, that will be called on the next call.
Reproduction
const fn = vi.fn();
fn.mockReturnValueOnce('foo');
const mockImpl = fn.getMockImplementation(); // This returns undefinedSystem Info
Binaries:
Node: 20.15.1
npm: 10.9.0
npmPackages:
vite: ^5.4.6 => 5.4.6
vitest: ^2.1.1 => 2.1.1Used Package Manager
npm
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
p3-minor-bugAn edge case that only affects very specific usage (priority)An edge case that only affects very specific usage (priority)
Type
Projects
Status
Approved