【发布时间】:2015-10-08 04:11:39
【问题描述】:
我正在尝试将自定义任务添加到sails js 应用程序。根据文档,我按以下方式创建文件。 任务/注册/test.js
module.exports = function (grunt) {
grunt.registerTask('test', ['mochaTest']);
};
tasks/config/mochaTest.js
module.exports = function(grunt) {
grunt.config.set('mochaTest', {
test: {
options: {
reporter: 'spec',
captureFile: 'results.txt', // Optionally capture the reporter output to a file
quiet: false, // Optionally suppress output to standard out (defaults to false)
clearRequireCache: false // Optionally clear the require cache before running tests (defaults to false)
},
src: [
'test/bootstrap.test.js',
'test/unit/**/*.js'
]
}
});
grunt.loadNpmTasks('grunt-mocha-test');
};
我在 test/unit 文件夹中编写了测试用例。我可以使用 grunt mochaTest 命令运行这些测试。但是使用 'sails lift --test' 命令不会运行测试用例。相反,它只是运行sails 应用程序。我还尝试了以下命令。 () NODE_ENV=测试帆升力 它也不运行测试用例。它只是运行sails 应用程序。 (http://sailsjs.org/documentation/concepts/assets/task-automation) 我在这里错过了什么?
【问题讨论】: