-
-
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
sinon.stub().resolves(...) returns undefined when used with createStubInstance #2073
Comments
Not sure what could cause this in the changelog ... If you could run a |
|
I can verify that it was broken in 7.4.0 as well |
Also related to this, due to So the following Typescript import no longer works (it worked in 7.3.2): import { createStubInstance } from "sinon";
...
const thing = createStubInstance(X); which results in This could be resolved by replacing Line 58 in 671330c
|
PR sinonjs#2022 redirected sinon.createStubInstance() to use the Sandbox implementation thereof. This introduced a breaking change due to the sandbox implementation not supporting property overrides. Instead of duplicating the original behaviour from stub.js into sandbox.js, call through to the stub.js implementation then add all the stubs to the sandbox collection as usual. Copy the missing tests from stub-test.js
PR sinonjs#2022 redirected sinon.createStubInstance() to use the Sandbox implementation thereof. This introduced a breaking change due to the sandbox implementation not supporting property overrides. Instead of duplicating the original behaviour from stub.js into sandbox.js, call through to the stub.js implementation then add all the stubs to the sandbox collection as usual. Copy the missing tests from stub-test.js and add issue tests.
This issue, and some others, has revealed to me that, while we have great unit test coverage, some integration tests for the API is missing. We should have a little test suite that just tests for and executes a base test for all of the exposed API methods. Then stuff like this wouldn't happen nilly-willy. |
PS. Great work on digging into this guys! |
PR #2022 redirected sinon.createStubInstance() to use the Sandbox implementation thereof. This introduced a breaking change due to the sandbox implementation not supporting property overrides. Instead of duplicating the original behaviour from stub.js into sandbox.js, call through to the stub.js implementation then add all the stubs to the sandbox collection as usual. Copy the missing tests from stub-test.js and add issue tests.
This has been fixed with #2073 and released as |
PR sinonjs#2022 redirected sinon.createStubInstance() to use the Sandbox implementation thereof. This introduced a breaking change due to the sandbox implementation not supporting property overrides. Instead of duplicating the original behaviour from stub.js into sandbox.js, call through to the stub.js implementation then add all the stubs to the sandbox collection as usual. Copy the missing tests from stub-test.js and add issue tests.
Describe the bug
This was working in 7.3.2, but broke in 7.4.1.
Basically, when calling
sinon.stub().resolves(...)
as part of the second argument ofsinon.createStubInstance()
, I getundefined
. It works as a standalone, however.To Reproduce
Steps to reproduce the behavior:
Run the following test:
Expected behavior
I would expect the
console.log(thing.test())
to output2
Screenshots
N/A
Context (please complete the following information):
Additional context
N/A
The text was updated successfully, but these errors were encountered: