I'm using Jasmine 2.3
installed via NPM and executed with Grunt.
'use strict';
module.exports = function(grunt) {
grunt.initConfig({
package: grunt.file.readJSON('package.json'),
exec: {
jasmine: 'node_modules/.bin/jasmine'
}
});
require('load-grunt-tasks')(grunt);
require('time-grunt')(grunt);
grunt.registerTask('default', 'exec:jasmine');
};
I exported an Express.js application object and using it in my specs along with SuperTest.
'use strict';
var supertest = require('supertest')
var application = require('../../../../../server');
describe('GET /api/users', function() {
it('should respond with json', function(done) {
supertest(application)
.get('/api/users')
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect(200, done);
});
});
When I run the spec I get no errors even though a 200
status code was expected and 404
was the result. Is the problem in Jasmine or SuperTest, or maybe I should be using SuperAgent.
I have no routes setup just a 404
error handler setup on the Express application object.
application.use(function(request, response, next) {
response
.status(404)
.send({
message: 'not found'
});
});