fix: support mocked constructors in Vitest v4#33
Conversation
|
Thanks for the contribution @sirlancelot! Looks like there's a typescript check failing, mind taking a look? Also, could you please add a test to validate the behavior? Feel free to bump Vitest to v4 in dev dependencies to do so (on the off chance this causes other things to blow up feel free to ping me) |
|
Little update: I messed around with this a little and getting the typing correct is non-trivial! |
|
I adjusted the signature and added a test. Hopefully it passes the checks. Thanks for this library! |
|
I didn't want to update Vitest within this project because it would require updating all the unit tests' |
function signature to support Vitest v4# Conflicts: # src/stubs.ts
|
Thanks for the fix! This has been released in v0.9.0
Thankfully, this was not necessary. It is only necessary to use a
It took some TypeScript gymnastics (see #34), but even with this change |
See: https://vitest.dev/guide/migration.html#spyon-and-fn-support-constructors