fix: actaully reset 'injectedKeys'
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
Codecov Report
Patch coverage: 100.00% and project coverage change: -0.01 :warning:
Comparison is base (
3b41aff) 95.99% compared to head (98cffd0) 95.99%.
:exclamation: 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%) |
:arrow_down: |
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%) |
:arrow_down: |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Any way of adding a regression test to show the bug?
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