Search code examples
javascriptnode.jstddjasminejasmine-node

failing test not showing in jasmine-node


I have the following basic test for a web service:

var request = require('http'),
    url     = 'http://localhost:1337/';

describe('webservice', function() {

  it('should respond to /ping', function(done) {
    request.get(url + 'ping', function(res) {
      expect(res.statusCode).toBe(200);
      res.on('data', function(body) {
        var json = JSON.parse(body);
        expect(json.message).toBe("Hi, I'm alive");
        expect(json.date).toBeDefined();
        done();
      });
    });

  });

});

which seems to work ok:

$ jasmine-node --verbose tests/ping/

webservice
    should respond to /ping

Finished in 0.032 seconds
1 test, 3 assertions, 0 failures

But if I make one test fail (change the expected json message, for example) I get the following error:

$ jasmine-node --verbose --coffee tests/ping/
StreamWrap: Aborting due to unwrap failure at ../src/stream_wrap.cc:125
Aborted (core dumped)

Any idea what could I be doing wrong?

(more over, any mistake I have in my js, the test just silently fails, with no clue on waht happened, the js errors just dissapears)

update: the error appears only if the failing test is inside the request.get callback...


Solution

  • Herman is right, I filed an issue at github's repo (https://github.com/mhevery/jasmine-node) and together with @tebriel we found out it was a problem with v0.10.0

    here's the ticket: https://github.com/mhevery/jasmine-node/issues/211

    it works ok upto version 0.9.9, the only failing version seems to be v0.10.0

    there's also a commit fixing it, so we expect it to be fixed by next release

    --

    edit: I can confirm that this issue has been solved with node v0.10.1