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

.define method #2539

Merged
merged 10 commits into from
Sep 11, 2023
Merged

Conversation

gukoff
Copy link
Contributor

@gukoff gukoff commented Aug 11, 2023

Purpose (TL;DR) - mandatory

Add the .define(obj, property, value) method to the sandbox to allow temporarily define properties on the objects (i.e. until the sandbox is restored).

Fixes #2195

How to verify - mandatory

Run the tests

Checklist for author

  • npm run lint passes
  • References to standard library functions are cached.

Otherwise a failed test may not restore it.
@gukoff gukoff force-pushed the feature/2195/sandbox-define-property branch from 6352335 to 9e1e7a2 Compare August 11, 2023 17:58
Copy link
Contributor

@fatso83 fatso83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a great start! I'll leave this for next week, as I am off to a train to the mountains. Thanks!

lib/sinon/sandbox.js Show resolved Hide resolved
lib/sinon/sandbox.js Show resolved Hide resolved
@gukoff gukoff marked this pull request as ready for review August 14, 2023 14:12
@gukoff gukoff requested a review from fatso83 August 15, 2023 13:02
Copy link
Contributor

@fatso83 fatso83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems pretty ready for inclusion. Just added some comments. You are free to object.

lib/sinon/sandbox.js Show resolved Hide resolved
lib/sinon/sandbox.js Outdated Show resolved Hide resolved
lib/sinon/sandbox.js Outdated Show resolved Hide resolved
@gukoff gukoff requested a review from fatso83 September 7, 2023 08:25
@codecov
Copy link

codecov bot commented Sep 8, 2023

Codecov Report

Patch coverage: 85.71% and project coverage change: +0.21% 🎉

Comparison is base (fe799e7) 95.73% compared to head (ac18f5f) 95.95%.
Report is 2 commits behind head on main.

❗ Current head ac18f5f differs from pull request most recent head d8d7d15. Consider uploading reports for the commit d8d7d15 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2539      +/-   ##
==========================================
+ Coverage   95.73%   95.95%   +0.21%     
==========================================
  Files          40       40              
  Lines        1901     1904       +3     
==========================================
+ Hits         1820     1827       +7     
+ Misses         81       77       -4     
Flag Coverage Δ
unit 95.95% <85.71%> (+0.21%) ⬆️

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

Files Changed Coverage Δ
lib/sinon/util/core/default-config.js 100.00% <ø> (ø)
lib/sinon/sandbox.js 97.34% <85.71%> (+1.82%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fatso83
Copy link
Contributor

fatso83 commented Sep 8, 2023

[warn] Code style issues found in 2 files. Forgot to run Prettier?

Could you just address this and I'll merge 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Conditional support for replacing props not defined by the object
2 participants