6
運行摩卡時隱藏我需要看到一個堆棧跟蹤時,測試失敗,但是當咕嚕運行摩卡測試套件的東西是隱藏它。當我運行測試自己(mocha --recursive
)我得到一個堆棧跟蹤:堆棧跟蹤從咕嚕任務
site/server/server.js:10
server.use(express.static(path.join(__dirname('../client'))));
^
TypeError: string is not a function
at ...
但有了這個Gruntfile:
'use strict';
var should = require('should');
module.exports = function(grunt) {
grunt.initConfig({
cafemocha: {
test: {
src: 'server/test/**/test-*.js',
options: {/*
ui: 'bdd',
growl: true,
coverage: true,
reporter: 'spec'
*/}
}
},
watch: {
files: [
'server/**/*.js',
'Gruntfile.js',
'package.json'
],
tasks: [ 'test' ]
},
complexity: {
generic: {
src: [
'server/**/*.js',
'Gruntfile.js'
],
options: {
cyclomatic: 2,
halstead: 9,
maintainability: 80
}
}
}
});
grunt.loadNpmTasks('grunt-notify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-cafe-mocha');
grunt.loadNpmTasks('grunt-complexity');
grunt.registerTask('default', [ 'cafemocha' ]);
grunt.registerTask('test', [ 'cafemocha', 'complexity' ]);
};
我得到的是一個錯誤的總結:
$ grunt test
Running "cafemocha:test" (cafemocha) task
Warning: string is not a function Use --force to continue.
Aborted due to warnings.