Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: fallback to original mockImplementation if no match #17

Merged
merged 1 commit into from
Nov 4, 2024

Conversation

mcous
Copy link
Owner

@mcous mcous commented Nov 4, 2024

Overview

As discussed in #15 (comment), this PR makes a slight adjustment to the mockImplementation added by vitest-when. Rather than returning undefined in the case of a miss, it will use whatever mockImplementation already existed on the spy prior to when usage.

This will keep the default undefined return in normal usage, but allow for the configuration of unconditional default implementations, which may be helpful in specific cases.

Closes #15

Change log

@mcous mcous changed the title feat: fallback to original mockImplementation if no match feat: fallback to original mockImplementation if no match Nov 4, 2024
@mcous mcous merged commit 5cd3283 into main Nov 4, 2024
22 checks passed
@mcous mcous deleted the feat/fallback branch November 4, 2024 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow use with mocks created by spyOn
1 participant