航行testing控制器没有完全执行
我正在使用sailsjs v0.11
正如testing文档中提到的,我已经configuration了我的应用程序。
我的UserController.test.js
var request = require('supertest'); console.log('log 1'); describe('UserController', function() { console.log('log 2'); describe('index', function() { console.log('log 3'); it('should return success', function(done) { console.log('log 4'); request(sails.hooks.http.app) .get('/user') .expect(200, done); }); }); });
我的User.test.js
describe.only('UsersModel', function() { describe('#find()', function() { it('should check find function', function (done) { User.find() .then(function(results) { done(); }) .catch(done); }); }); });
如果我执行PORT=9999 mocha test/bootstrap.test.js test/unit/**/*.test.js
我只能看到
log1 log2 log3
在我的控制台。 console.log(log3)
之后的代码没有被执行。 但是在模型中我的User.test.js工作正常。
这是什么原因?
我改变了我的User.test.js
@ jedd.ahyoung在评论中提到,一切工作正常
describe('UsersModel', function() { describe('#find()', function() { it('should check find function', function (done) { User.find() .then(function(results) { done(); }) .catch(done); }); }); });