Skip to content
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

fix: actaully reset 'injectedKeys' #2456

Merged
merged 3 commits into from Aug 9, 2023
Merged

fix: actaully reset 'injectedKeys' #2456

merged 3 commits into from Aug 9, 2023

Conversation

mroderick
Copy link
Member

Re-assigning the local variable injectedKeys would not change sandbox.injectedKeys, thus restoreContext doesn't fully restore the context.

See:

https://lgtm.com/projects/g/sinonjs/sinon/snapshot/9e09e7d79bac5808ca98fac4f7419a20be4fc43d/files/lib/sinon/sandbox.js?sort=name&dir=ASC&mode=heatmap#x9f770d565ef51b7d:1

@mroderick mroderick added the semver:patch changes will cause a new patch version label May 12, 2022
@codecov
Copy link

codecov bot commented May 12, 2022

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.01 ⚠️

Comparison is base (3b41aff) 95.99% compared to head (98cffd0) 95.99%.

❗ Current head 98cffd0 differs from pull request most recent head 804d691. Consider uploading reports for the commit 804d691 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2456      +/-   ##
==========================================
- Coverage   95.99%   95.99%   -0.01%     
==========================================
  Files          40       40              
  Lines        1898     1896       -2     
==========================================
- Hits         1822     1820       -2     
  Misses         76       76              
Flag Coverage Δ
unit 95.99% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
lib/sinon/sandbox.js 97.72% <100.00%> (-0.03%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@fatso83
Copy link
Contributor

fatso83 commented May 12, 2022

Any way of adding a regression test to show the bug?

@mroderick
Copy link
Member Author

Any way of adding a regression test to show the bug?

That's a fair question. We haven't detected it thus far with tests and users have also not reported it.
There might be something else that resets that property, so we've been hiding in the shadow of that for years.

I can look further

lib/sinon/sandbox.js Show resolved Hide resolved
lib/sinon/sandbox.js Outdated Show resolved Hide resolved
mroderick and others added 3 commits April 1, 2023 11:56
Re-assigning the local variable `injectedKeys` would not change `sandbox.injectedKeys`, thus `restoreContext` doesn't fully restore the context.

See:

https://lgtm.com/projects/g/sinonjs/sinon/snapshot/9e09e7d79bac5808ca98fac4f7419a20be4fc43d/files/lib/sinon/sandbox.js?sort=name&dir=ASC&mode=heatmap#x9f770d565ef51b7d:1
Co-authored-by: Phred Lane <fearphage@gmail.com>
@fatso83 fatso83 merged commit 305fb6c into main Aug 9, 2023
11 checks passed
@fatso83 fatso83 deleted the lgtm-fixes branch August 9, 2023 08:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver:patch changes will cause a new patch version
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants