-
-
Notifications
You must be signed in to change notification settings - Fork 203
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
Option to disable global-mocks on jest builder #696
Comments
You don't need a special option for this. The global mocks can be easily overwritten if you add your own setup file to |
I have my own setup file with And how global-mocks override global properties before my setup runs, I can not do anything to avoid it |
The setup files array is concatenated, you're right, but that only means that the setup files run in order one after another. Which means if you redefine window properties in your setup file they should get overwritten even if the default setup file defined them before. |
That's exactly what I want to do, but I want to avoid the redefinetion of window's properties. I don't want to patch |
Well if some of the patches are not necessary anymore we probably should change it in the builder. Let's discuss. |
Ok, here you have a list of patches that I think don't be necessary anymore:
Those are the patches I think could be removed, what do you think? |
The storage included in JsDom >= 11.12.0 works perfectly. The mock just broke the readonly property "length" (always undefined). |
Jest 24 (which is the minimal version to use with this builder) uses Thus:
Conclusions:
What do you think? |
Thanks for the extensive well-documented response @just-jeb!! 👏 I understand that mocks can't be removed yet, I'm ok with that. However, my main problem persists because I can't simply redefine the mock (I don't want to mock it, just leave it as it is, without mock), I need the original behavior of As my setup-file always runs For that reason,
Then, I could disable your |
As a workaround (if anyone want to be able of
I would prefer to have an option, but this works meanwhile 👍 |
Thanks @tonivj5 . Just FYI you're not forgotten, I have a proper solution in mind just need to find time to implement it. |
Thanks for the feedback 🚀 |
Just to add to this, I was running into some trouble using @testing-library/angular and its accessibility selectors. The getComputedStyle mock seems to to interfere with discoverability of accessible elements. |
Hey, @klinem thanks for the report and sorry for the late response. |
The new |
Describe the Bug
I'm having problems with the global mocks configured, I would like to disable them. Could be posible to provide an option in
angular.json
to disable it?Minimal Reproduction
I think it isn't needed
Expected Behavior
And option to disable the mocks applied
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
The text was updated successfully, but these errors were encountered: