我有一个sails.js应用程序,我想用摩卡测试,在我的测试文件夹中,我有2个测试,但是当我运行摩卡时,只会执行一个测试。
Test1.js
var request = require('supertest');
describe.only('UserController', function() {
describe('#login()', function() {
it('should redirect to /mypage', function (done) {
done();
});
});
});
Test2.js
describe.only('UsersModel', function() {
describe('#find()', function() {
it('should check find function', function (done) {
done();
});
});
});
我使用以下命令运行测试:
./node_modules/.bin/mocha
输出
UserController
#login()
✓ should redirect to /mypage
1 passing (10ms)
请向我解释我的错误。
这是因为您正在使用进行独家测试describe.only()
。使用describe()
代替。
查看Mocha文档中的排他性测试
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句