我正在尝试使用grunt-contrib-jasmine trough命令行“grunt jasmine”进行测试,但它未能发出警告:“PhantomJS无法加载您的页面。使用--force继续。”... < / p>
base.spec.js:
describe('Namespace',function(){
it('Provides the global *** object',function(){
expect(***).to.be.an('object');
expect(***).to.include.keys('App','Templates');
});
});
gruntfile.js包括:
jasmine : {
src : ['apps/<%=target%>/js/**/*.js'],
options : {
host : 'http://127.0.0.1:5000',
specs : 'tests/<%=target%>/**/*spec.js',
}
},
.
.
.
grunt.loadNpmTasks('grunt-contrib-jasmine');
无法理解有什么问题......
请帮助,提前致谢......
答案 0 :(得分:0)
在gruntfile.js中创建你的src:&#39; apps /&lt;%= target%&gt; / js / ** / FileName&#39;, (删除文件名后的.js)
在茉莉花之前添加: grunt.initConfig({ pkg:grunt.file.readJSON(&#39; package.json&#39;),
connect:{ 测试:{ 端口:8000, 基地:&#39;测试&#39; }
},
设置默认任务,以便它可以执行连接然后执行: grunt.registerTask(&#39;默认&#39;,[&#39;连接&#39;,&#39; jasmine&#39;]);
如果它还没有失败,那么尝试使用grunt jasmine --force来知道它失败的地方