Incomplete test summary in cygwin #704

Closed
seriousManual opened this Issue Jan 8, 2013 · 5 comments

Comments

Projects
None yet
3 participants

When tests are running in an cygwin environment the test summary is incomplete.

Sampletest:

var expect = require('chai').expect;

describe('testsuite', function () {
    describe('thing', function () {
        it('should be true', function () {
            expect(true).to.be.false;
        });
    });
});

when running mocha myTest.js --reporter spec in the normal windows console this is what i get:
(everythings fine, just imagine the color)

D:\dev\mochateststuff>mocha myTest.js --reporter spec


  testsuite
    thing
      1) should be true


  ? 1 of 1 test failed:

  1) testsuite thing should be true:
     expected true to be false

running in cygwin:
(the summary is missing, also no colors)

mer@alanis /cygdrive/d/mochateststuff
$ mocha myTest.js --reporter spec


  testsuite
    thing
  ✖ 1 of 1 test failed:

I did a little digging through the code and it appears that the end event of the runner isnt fired.
from the spec runner:

runner.on('end', self.epilogue.bind(self));
Contributor

tj commented Jan 8, 2013

im no help with windows unfortunately :( if you discover anything that looks suspicious let me know

I checked which events get actually fired when the reporter runs:

    var _emit = runner.emit;
    runner.emit = function() {
        fs.appendFileSync(path.join(process.cwd(), 'dbg'), arguments[0] + '\n', 'utf8');

        _emit.apply(runner, arguments);
    };

as it turns out either way the events get fired correctly:

newListener
newListener
newListener
newListener
newListener
newListener
newListener
newListener
newListener
newListener
newListener
newListener
newListener
start
suite
suite
suite
test
fail
test end
suite end
suite end
suite end
end

It looks like it is an issue with the cursor moving thing that is done (like cursor.CR();) and that the cygwin console doesnt get along with it.

Thus this might be some cygwin configuration issue that turns up in any application that uses these console directives and is not mocha specific.

A bit late to the party, but if it can be useful... I have a (dirty) workaround for this one: use the Console2 terminal emulator (http://sourceforge.net/projects/console/) which basically runs cmd.exe in an invisible window and draws the output itself.

It works well when running mocha...

hi, thanks for your comment! I'm actually using Console2 but was not aware of the fact I can simply run the bash.exe inside of Console2. I tried it and it works mostly fine, I've got some issues with the PATH, somehow make does not run properly.
Do you have that issue too?

Try starting bash.exe as a login, interactive shell. In the Console settings, set the Shell property to something like:
c:\cygwin\bin\bash.exe --login -i
This should make bash behave exactly as in the default cygwin terminal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment