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

should.be.calledOnce() crashes when an argument is module #17

Open
jandppw opened this issue Apr 3, 2020 · 0 comments
Open

should.be.calledOnce() crashes when an argument is module #17

jandppw opened this issue Apr 3, 2020 · 0 comments

Comments

@jandppw
Copy link

jandppw commented Apr 3, 2020

  it('cannot handle module as a parameter', function () {
    const x = {
      method: function (m) {
        return m.path
      }
    }

    const xSpy = sinon.spy(x, 'method')

    const result = x.method(module)
    xSpy.calledOnce.should.be.true() // works
    xSpy.should.be.calledOnce() // fails
  })

After a very deep dive through sinon/formatio#ascii.XXX, a toString fails:

TypeError: Cannot convert undefined or null to object
    at toString (<anonymous>)
    at ascii (node_modules/@sinonjs/formatio/lib/formatio.js:105:23)
    at Formatio.ascii.object (node_modules/@sinonjs/formatio/lib/formatio.js:201:19)
    at ascii (node_modules/@sinonjs/formatio/lib/formatio.js:123:25)
    at Formatio.ascii.array (node_modules/@sinonjs/formatio/lib/formatio.js:146:21)
    at ascii (node_modules/@sinonjs/formatio/lib/formatio.js:91:28)
    at Formatio.ascii.object (node_modules/@sinonjs/formatio/lib/formatio.js:201:19)
    at ascii (node_modules/@sinonjs/formatio/lib/formatio.js:123:25)
    at Formatio.ascii.array (node_modules/@sinonjs/formatio/lib/formatio.js:146:21)
    at ascii (node_modules/@sinonjs/formatio/lib/formatio.js:91:28)
    at Formatio.ascii.object (node_modules/@sinonjs/formatio/lib/formatio.js:201:19)
    at ascii (node_modules/@sinonjs/formatio/lib/formatio.js:123:25)
    at Formatio.ascii.array (node_modules/@sinonjs/formatio/lib/formatio.js:146:21)
    at ascii (node_modules/@sinonjs/formatio/lib/formatio.js:91:28)
    at Formatio.ascii.object (node_modules/@sinonjs/formatio/lib/formatio.js:201:19)
    at ascii (node_modules/@sinonjs/formatio/lib/formatio.js:123:25)
    at Formatio.ascii.array (node_modules/@sinonjs/formatio/lib/formatio.js:146:21)
    at ascii (node_modules/@sinonjs/formatio/lib/formatio.js:91:28)
    at Formatio.ascii.object (node_modules/@sinonjs/formatio/lib/formatio.js:201:19)
 …
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

1 participant