Gruntjs 在grunt中运行jasmine任务时,出现错误;“需要全局模式字符串”;
我正在尝试使用grunt contrib jasmine运行jasmine测试 下面是我的Grunfile.js代码Gruntjs 在grunt中运行jasmine任务时,出现错误;“需要全局模式字符串”;,gruntjs,jasmine,Gruntjs,Jasmine,我正在尝试使用grunt contrib jasmine运行jasmine测试 下面是我的Grunfile.js代码 module.exports = function(grunt) { grunt.initConfig({ jasmine : { // Your project's source files src : 'src/**/*.js', // Your Jasmine spec fil
module.exports = function(grunt) {
grunt.initConfig({
jasmine : {
// Your project's source files
src : 'src/**/*.js',
// Your Jasmine spec files
specs : 'specs/**/*spec.js',
// Your spec helper files
helpers : 'specs/helpers/*.js'
}
});
// Register tasks.
grunt.loadNpmTasks('grunt-contrib-jasmine');
// Default task.
grunt.registerTask('default', 'jasmine');
};
然后我试着从命令提示符下运行“GruntJasmine”命令。它给了我一个如下的错误
您描述的问题已在中报告。然后于2016年2月13日确定 截至本文撰写之时,is于2016年1月26日发布。因此,该修复程序没有进入最新版本,这是NPM在您进行安装时所做的 您可以绕过NPM存储库,直接到GitHub获取
grunt contrib jasmine
的预发布版本,从而绕过这个问题。通过将package.json
更改为:
"dependencies: {
"grunt-contrib-jasmine": "git://github.com/gruntjs/grunt-contrib-jasmine#1e78d891704fa13fe7c7abf4cabf43cefacafcaf"
}
(URL中的commit SHA恰好是最新的;如果您愿意,可以随意将其替换为更晚的。)
理想情况下,当
grunt contrib jasmine
发布v1.0.1(或更高版本)时,此解决方案将过时。不过今天,这就是我解决问题的方法。我也遇到了同样的问题。我还没有解决方案,但它似乎与: