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

Check call count type #2410

Merged
merged 5 commits into from Jan 20, 2022
Merged

Commits on Nov 3, 2021

  1. Strip stack frames in this.message

    This saves us from having to do it every time, and makes things much
    nicer. Also use a little bit more specific regex, to avoid issues with
    messages that happen to contain the word "at"
    
    Also, fix typo that inverted the meaning of a comment :)
    cincodenada committed Nov 3, 2021
    Configuration menu
    Copy the full SHA
    7e70503 View commit details
    Browse the repository at this point in the history
  2. Check type of callCount argument and error accordingly

    This is to fixes sinonjs#2408, which could result in error messages like
    "expected spy to be called 10 times but was called 10 times".
    
    Now we will instead say "expected '10' to be a number, but was of type
    string", which is much clearer!
    cincodenada committed Nov 3, 2021
    Configuration menu
    Copy the full SHA
    42ac44f View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    98a1804 View commit details
    Browse the repository at this point in the history

Commits on Jan 19, 2022

  1. Re-fix the comment about appending stack frames

    The previous "fix" was wrong, I misunderstood this code and the comment.
    What's actually happening here is that we want to add a frame of context
    to `callStr`, but the first two stack frames will be within Sinon code
    and thus probably not helpful to the end-user.
    
    So, we skip the first two stack frames, and append the third stack
    frame, which should contain a meaningful location to the end-user.
    cincodenada committed Jan 19, 2022
    Configuration menu
    Copy the full SHA
    078f3a8 View commit details
    Browse the repository at this point in the history

Commits on Jan 20, 2022

  1. Add test for adding stack traces to error message

    This ensures that if at some point we end up with another Sinon layer in
    the stack at some point, we'll catch it and hopefully adjust accordingly
    
    For reference, as of this commit, the Sinon portion of the stack is:
    lib/sinon/proxy-invoke.js:65:15
    lib/sinon/proxy.js:265:26
    
    Also convert a neighboring test to async while we're at it
    cincodenada committed Jan 20, 2022
    Configuration menu
    Copy the full SHA
    cda8c85 View commit details
    Browse the repository at this point in the history