question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The assertion error for 'incude(object, propName)' is cryptic when 'propName' is a string

See original GitHub issue

When you make a mistake and use assert.include instead of assert.property to assert that an object has a specific property (e.g. assert.include({ foo: 'bar' }, 'foo');), the error message is very unclear:

> chai.assert.include({ foo: 'bar' }, 'foo')

AssertionError: object tested must be an array, a map, an object, a set, a string, or a weakset, but object given

Can we do something to indicate clearly that this combination of arguments (an object + a string) is not possible for assert.include?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
rpgeeganagecommented, Jun 26, 2019

@lucasfcosta , @AndreyBelym , Thanks. I’ll look into this.

2reactions
rpgeeganagecommented, Jun 25, 2019

@AndreyBelym , if you prefer, I can look into this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Junit Assertion Error - Getting error even though Expected ...
Well the return type is ArrayList<ArrayList<String>> and I am returning the same type from a method as well. I have added a code,...
Read more >
AssertionError (Java Platform SE 7 )
Constructs an AssertionError with its detail message derived from the specified object, which is converted to a string as defined in section 15.18....
Read more >
Assertions
Cypress bundles the popular Chai assertion library, as well as helpful extensions for Sinon and jQuery, bringing you dozens of powerful assertions for....
Read more >
Asserting Expectations
In the previous chapters on tracing and interactive debugging, we have seen how ... line 3, in my_own_assert raise AssertionError AssertionError (expected) ...
Read more >
Python | Assertion Error
If the condition is True, the control simply moves to the next line of code. In case if it is False the program...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found