帆测试控制器没有完全执行

sails test controller not executing completely

我正在使用 sailsjs v0.11

testing 文档中所述,我已配置我的应用程序。

我的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 在模型中工作正常。

这是什么原因?

我已经按照评论中提到的@jedd.ahyoung更改了我的User.test.js,一切正常

describe('UsersModel', function() {

  describe('#find()', function() {
    it('should check find function', function (done) {
      User.find()
        .then(function(results) {
          done();
        })
        .catch(done);
    });
  });

});