-
Notifications
You must be signed in to change notification settings - Fork 59
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
Deep mocking results in a TypeScript error + extreme compilation slowness #97
Comments
seeing the same on 2.0.6->2.0.7 (node 16.16, TS 4.7.4) |
Got the same problem too, for my case it was resolved by downgrading to
|
I agree I have found the same problem in my repository, using 2.0.4 is fine but 2.0.7 makes typescript compilation from 13 seconds to 630 seconds for me. |
happens to me with versions 2.0.7, 2.0.6, 2.0.4 - any ideas for another fix? |
same here System:
Binaries:
|
I am also experiencing this issue, although I am using the regular You can see in the
On version 2.0.6 it only takes a short time on this step, but on 2.0.7 it gets stuck. EnvironmentUbuntu 20.04.2 LTS on Windows 10 WSL |
Observed this issue attempting to upgrade from 2.0.6 to 2.0.7 (along with painfully long compilation times).
Environment Mac 12.4 (Ubuntu 20.04) |
I'll try and get a fix for this, without breaking the functionality that added to the slowness. |
I've pushed a fix as version mockDeep({ funcPropSupport: true });
or
mockDeep({ funcPropSupport: true }, mockImplementation); but expect the same performance issue / penalty if you need to use this. It would be good to get some feedback on this 🙏🏽 . Once there's enough feedback that this issue is fixed, I'll push a |
Fixed in 3.0.0 |
This PR contains the following updates: | Package | Type | Update | Change | |---|---|---|---| | [jest-mock-extended](https://github.com/marchaos/jest-mock-extended) | devDependencies | major | [`^2.0.4` -> `^3.0.0`](https://renovatebot.com/diffs/npm/jest-mock-extended/2.0.4/3.0.4) | --- ### Release Notes <details> <summary>marchaos/jest-mock-extended</summary> ### [`v3.0.4`](https://github.com/marchaos/jest-mock-extended/releases/tag/3.0.4) [Compare Source](marchaos/jest-mock-extended@3.0.3...3.0.4) - Updated jest dependencies - Updated typescript peerDependencies to allow for typescript 5.\* ### [`v3.0.3`](marchaos/jest-mock-extended@3.0.2...3.0.3) [Compare Source](marchaos/jest-mock-extended@3.0.2...3.0.3) ### [`v3.0.2`](https://github.com/marchaos/jest-mock-extended/releases/tag/3.0.2) [Compare Source](marchaos/jest-mock-extended@3.0.1...3.0.2) Added marchaos/jest-mock-extended#110 ### [`v3.0.1`](https://github.com/marchaos/jest-mock-extended/releases/tag/3.0.1) [Compare Source](marchaos/jest-mock-extended@3.0.0...3.0.1) Allow overriding calledWithFn - see marchaos/jest-mock-extended#96 ### [`v3.0.0`](https://github.com/marchaos/jest-mock-extended/releases/tag/3.0.0) [Compare Source](marchaos/jest-mock-extended@3602a65...3.0.0) - Fixed performance issue for marchaos/jest-mock-extended#97. This required a small API change, hence the major version bump. Deep mocking functions with properties is still possible using ```typescript mockDeep({ funcPropSupport: true }); ``` however this comes with a recursive performance cost. We hope to address this in the future. ### [`v2.0.9`](marchaos/jest-mock-extended@c6fdf33...3602a65) [Compare Source](marchaos/jest-mock-extended@c6fdf33...3602a65) ### [`v2.0.8`](marchaos/jest-mock-extended@2.0.7...c6fdf33) [Compare Source](marchaos/jest-mock-extended@2.0.7...c6fdf33) ### [`v2.0.7`](https://github.com/marchaos/jest-mock-extended/releases/tag/2.0.7) [Compare Source](marchaos/jest-mock-extended@2.0.6...2.0.7) ### Fixes - Fix DeepMockProxy type error for objects which are functions and have fields at the same time - marchaos/jest-mock-extended#95 ### [`v2.0.6`](https://github.com/marchaos/jest-mock-extended/releases/tag/2.0.6) [Compare Source](marchaos/jest-mock-extended@2.0.5...2.0.6) Support for Jest 28 ### [`v2.0.5`](https://github.com/marchaos/jest-mock-extended/releases/tag/2.0.5) [Compare Source](marchaos/jest-mock-extended@2.0.4...2.0.5) Fixes: - Explicitly Show DeepMockProxy<T> In Readme Example - marchaos/jest-mock-extended#86 - Fix ESM support by avoiding export default as syntax - marchaos/jest-mock-extended#83 - Fix TypeError thrown in mockReset/mockClear - marchaos/jest-mock-extended#81 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC43NC4yIiwidXBkYXRlZEluVmVyIjoiMzQuNzQuMiJ9--> Co-authored-by: Renovate Bot <renovate@vylpes.com> Reviewed-on: https://gitea.vylpes.xyz/RabbitLabs/Droplet/pulls/109 Reviewed-by: Vylpes <ethan@vylpes.com> Co-authored-by: RenovateBot <renovate@vylpes.com> Co-committed-by: RenovateBot <renovate@vylpes.com>
Upgrading to
v2.0.7
(see original PR) fromv2.0.6
seems to have brought in something fishy when usingmockDeep
. On a fresh install, TypeScript compilation is now ridiculously slow.yarn tsc --noEmit
TypeScript
v4.7.4
, Nodev16.14.2
, jestv28.1.3
, ts-jest28.0.7
, running on an M1 Pro chipReproducible example:
Not only is this excruciatingly slow (but only the first time), it also complains with a type error:
The text was updated successfully, but these errors were encountered: