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 stubbing function objects #1968

Merged
merged 1 commit into from Jan 19, 2019
Merged

Fix stubbing function objects #1968

merged 1 commit into from Jan 19, 2019

Conversation

mantoni
Copy link
Member

@mantoni mantoni commented Jan 10, 2019

Purpose (TL;DR) - mandatory

Currently sinon.stub(function () {}) throws TypeError: Attempted to wrap undefined property undefined as function. Sinon should either throw a meaningful error explaining why a function is not a valid argument, or treat functions like any other object. I can't think of a reason why we shouldn't support this.

Fixes #1967

How to verify - mandatory

  1. Check out this branch
  2. npm install
  3. npm t

Checklist for author

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

@mantoni mantoni added Bug semver:patch changes will cause a new patch version labels Jan 10, 2019
@coveralls
Copy link

Pull Request Test Coverage Report for Build 2783

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.004%) to 94.526%

Files with Coverage Reduction New Missed Lines %
sinon/stub.js 1 96.55%
Totals Coverage Status
Change from base Build 2780: 0.004%
Covered Lines: 1664
Relevant Lines: 1730

💛 - Coveralls

@mantoni
Copy link
Member Author

mantoni commented Jan 10, 2019

I don't know what's wrong with the CircleCI build and won't have time to look into it. Everything works fine on Travis.

@mantoni mantoni merged commit 62f4e26 into master Jan 19, 2019
@mantoni mantoni deleted the fix-stub-function-object branch January 19, 2019 13:57
@mantoni
Copy link
Member Author

mantoni commented Jan 19, 2019

Released in v7.2.3.

franck-romano pushed a commit to franck-romano/sinon that referenced this pull request Oct 1, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 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