Jasmine test failure

I have a simple test to where the callback for the POST request test is being called. From the server log it can be seen that the request is being made, but it seems to stop there.

I am pretty new to working/testing with node so there is a good chance I am missing something simple.

UPDATE: I have added the original coffeescript

UPDATE: Running the original coffeescript works if the file is run directly jasmine-node foo/bar/users.spec.coffee --coffee, but fails when running all the coffee files jasmine-node foo/bar --coffee. I converted the .coffee files to .js (and kept in all the returns) and saw the exact same issue (the callback is run if I run the file individually, but fails when I run them all)

# original coffeescript
assert  = require 'assert'
request = require 'request'

describe 'User API', ->

  describe 'Signup', ->

    url = 'http://localhost:3000/users'
    params = null

    beforeEach (done) ->
      params =
        url: url
        form:
          firstName:  'John'
          lastName:   'Smith'
          email:      'john@example.com'
          password:   'foobar'
          role:       'member'
      done()

    it 'returns a 200 OK on valid user signup', ->
      request.post params, (err, resp, body) ->
        console.log "***************"
        console.log "in the callback"
        console.log "***************"
        assert.equal resp.statusCode, '200'
        done()


// the converted js
var assert, request;

assert = require('assert');

request = require('request');

describe('User API', function() {
  return describe('Signup', function() {
    var params, url;
    url = 'http://localhost:3000/users';
    params = null;
    beforeEach(function(done) {
      params = {
        url: url,
        form: {
          firstName: 'John',
          lastName: 'Smith',
          email: 'john@example.com',
          password: 'foobar',
          role: 'member'
        }
      };
      return done();
    });
    return it('returns a 200 OK on valid user signup', function() {
      return request.post(params, function(err, resp, body) {
        console.log("***************");
        console.log("in the callback");
        console.log("***************");
        assert.equal(resp.statusCode, '200');
        return done();
      });
    });
  });
});

You have two return statements in there. Your function returns after the first one is executed, so the code after it won't run.

You can get rid of them:

var request = require('request');

describe('User API', function() {
    describe('Signup', function() {
        var url = 'http://localhost:3000/users';
        var params = null;

        beforeEach(function() {
            params = {
                url: url,
                form: {
                    firstName: 'John',
                    lastName: 'Smith',
                    email: 'john@example.com',
                    password: 'foobar',
                    role: 'member'
                }
            };
        });

        it('returns a 200 OK on valid user signup', function() {
            return request.post(params, function(err, resp, body) {
                expect(resp.statusCode).toEqual(200);
            });
        });
    });
});

I was missing the done parameter being passed into the test.

# bad
it 'returns a 200 OK on valid user signup', ->

# good
it 'returns a 200 OK on valid user signup', (done) ->