您需要編輯或可能創建一個名爲.jshintrc文件,你就會有這樣的事情:
{
"curly": false,
"eqeqeq": false,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"boss": true,
"eqnull": true,
"browser": true,
"es5":true,
"smarttabs": true,
"expr":true,
"globals": {
"angular": true,
"console": true,
"expect" : true,
"inject" : true,
"describe" : true,
"beforeEach" : true,
"it" : true,
"xit" : true,
"xdescribe": true
}
}
通知下全局的XIT和xdescribe。
在你gruntfile去jshint任務,並將此
jshint: {
options: {
jshintrc: '.jshintrc'
}
}
開'Gruntfile.js'在年底找到'grunt.registerTask( '默認',[ '更新:jshint', 「測試', 'build' ]);'當你需要測試使用'grunt test'時,'移除'test'行。 –
改變你的建議之後,它會一直失敗,但無論如何,我不想禁用'jshint'。 –
我遇到同樣的問題。即使在'.jshintrc'文件中添加'xdescribe'和'xit',它仍然會引發錯誤。我的項目也是一個'角生成器'的應用程序。 – jedmao