-
-
Notifications
You must be signed in to change notification settings - Fork 771
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
Can't stub the module (object) function in the latest update #2514
Comments
Found the issue. Previously we the object descriptor was pretty much left unchanged (apart from the Unfortunately, it introduced a regression for cases where the object descriptor was not from the prototype, but the object itself. If |
The sandboxes were fine, but I was unable to get them running locally as unit tests as they depended on window existing. If you want to test out the fix in #2515 and see that it fixes your issue, you can just have a look at the diff and copy it manually into the right section (the line it fails) in - methodDesc.configurable = true;
+
+ // you are not allowed to flip the configurable prop on an
+ // existing descriptor to anything but false (#2514)
+ if (!owned) {
+ methodDesc.configurable = true;
+ }
+ |
@fatso83 yes, the fix works well for our case, thank you! |
Out as Sinon 15.1.0 (minor due to also getting the new clock.jump() method) |
Describe the bug
After #2508 was merged and the new sinon v15.0.4 is published a lot of code in our project stopped working. We can an error when trying to stub the object function in a special case. The same approach work in v15.0.2
The example code that shows the problem based on attempt to stub ChaplinJS utils object.
To Reproduce
Open code sandbox based on v15.0.4 and see console log https://codesandbox.io/p/sandbox/sinon-module-stub-broken-15-0-4-9e1f4u
Console:
Expected behavior
Open code sandbox based on v15.0.2 and see console log https://codesandbox.io/p/sandbox/sinon-module-stub-working-15-0-2-tipumo
Console:
The text was updated successfully, but these errors were encountered: