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.

to.be.true and to.be.false do not indicate line number when failing

See original GitHub issue

The following code:

describe('Test feature', function() {
  it('should raise line number', function() {
    expect(true).to.be.false;
  });
});

Yields the failure:

Chrome 42.0.2311 (Mac OS X 10.10.3) Test feature should raise line number FAILED
        AssertionError: expected true to be false

This can be difficult to debug where your failure is in a test suite if no line number or file is given.

However, if you run the following code:

describe('Test feature', function() {
  it('should raise line number', function() {
    expect(true).to.equal(false);
  });
});

The line number is reported:

Chrome 42.0.2311 (Mac OS X 10.10.3) Test feature should raise line number FAILED
        AssertionError: expected true to be false
            at Context.<anonymous> (/test.js:3:27)

Version Information

mocha@2.1.0
karma@0.12.31 
karma-chai@0.1.0 
karma-mocha@0.1.10 

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
keithamuscommented, May 3, 2015

Hey @vtsatskin thanks for the issue.

Can you try setting chai.config.includeStack = true; and seeing if that fixes the problem?

Thanks

0reactions
meebercommented, Jun 9, 2016

The newer version of assertion-error was released. Closing!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Grice's Cooperative Principle - Ling 131 - Topic 12 (session A)
Do not say what you believe to be false. It may seem at first sight that it would be simpler for this maxim...
Read more >
Grice's Conversational Maxims: Definition & Examples |
When following this maxim during communication, you should: Only say things you believe to be true. Not say things that you cannot back...
Read more >
Grice's Maxims
The maxim of quality, where one tries to be truthful, and does not give information that is false or that is not supported...
Read more >
Lying as a Violation of Grice's First Maxim of Quality - jstor
According to the traditional philosophical definition, you lie if and only if you assert what you believe to be false with the intent...
Read more >
Practices of Science: False Positives and False Negatives
A false positive is a “false alarm.” A false negative is saying something is false when it is actually true (also called a...
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