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

Stack traces missing for >= 2.2.1, regression? #1736

Closed
j13z opened this issue Jun 9, 2015 · 3 comments
Closed

Stack traces missing for >= 2.2.1, regression? #1736

j13z opened this issue Jun 9, 2015 · 3 comments

Comments

@j13z
Copy link

j13z commented Jun 9, 2015

For some reason more recent versions of Mocha do not display stack traces anymore in some cases.

The code snippet below stops working with all versions after 2.2.1 – the diff output is there but the stack trace is missing (2.2.1 shows both). Seems to be a regression.

Commenting out the it call gives me a stack trace again, but in this case it’s just a raw Node stack trace, without any test runner output (… chai/lib/chai/assertion.js:107 throw new AssertionError(msg, { …).

// Test run with: `./node_modules/.bin/mocha dist/test/test.js`,  Node.js v0.12.4

// Works with mocha 2.2.1 (also tested with 2.0.0)
// Does not work with: 2.2.5, 2.2.4, 2.2.3

'use strict';

var chai = require('chai');       // v3.0.0
chai.config.includeStack = true;  // (makes no difference)
var expect = chai.expect;

describe('This test', function () {

    it('should work ', function () {    // <----

        expect(true).to.equal(false);
    });
});
@twada
Copy link

twada commented Jun 10, 2015

@j13z Mocha displays shorten stack traces since PR 1564 has landed (version 2.2.2).

You can use --full-trace option to display full stack traces.

@j13z
Copy link
Author

j13z commented Jun 10, 2015

@twada: Oh, I didn’t see the --full-trace option. That helps, thanks.

The problem I had was something different though, and seems to be caused by my node project’s directory structure and not Mocha itself. Sorry!

When I move my project root directly to ~/project and reinstall all node_modules I get the expected result with the last line:

at Context.<anonymous> (/source/test/test.js:52:17)

Before that, this last line got somehow lost … Guess node’s require algorithm sourced a “wrong” module somewhere down the directory tree.

Could you please close this issue? Sorry for the confusion.

@dasilvacontin
Copy link
Contributor

No worries @j13z. This might help other people who didn't notice the new option either. :)

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

3 participants