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

sinon.fake() argument passes wrong type #1781

Closed
Shagamii opened this issue May 5, 2018 · 3 comments
Closed

sinon.fake() argument passes wrong type #1781

Shagamii opened this issue May 5, 2018 · 3 comments

Comments

@Shagamii
Copy link

Shagamii commented May 5, 2018

  • Sinon version : 5.0.3
  • Environment : node v8.9.3

What did you expect to happen?
Expect sinon.fake() argument to be a function or no argument.

What actually happens
sinon.fake() passes all type, because func are typos instead of f

How to reproduce
Before:

function fake(f) {
    if (typeof func !== "undefined" && typeof func !== "function") {
        throw new TypeError("Expected func argument to be a Function");
    }

    return wrapFunc(f);
}

After:

function fake(f) {
    if (typeof f !== "undefined" && typeof f !== "function") {
        throw new TypeError("Expected f argument to be a Function");
    }

    return wrapFunc(f);
}
@mroderick
Copy link
Member

Thank you for the error report and the PR 👍

Based on your PR, I created a pull request that also has a test for the failure, so we will catch it if there are regressions.

@mroderick
Copy link
Member

This has been fixed with sinon@5.0.4

@Shagamii
Copy link
Author

Shagamii commented May 6, 2018

Thanks!
Sorry to miss some🙏

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

No branches or pull requests

2 participants