如何在Cloud9中运行grunt jasmine任务

时间:2013-01-18 14:08:53

标签: jasmine gruntjs cloud9-ide

我有一个简单的案例,我需要运行grunt jasmine测试。 运行后

grunt jasmine

我收到错误回复:

Running "jasmine" task                                                                                                                                                                               
Testing jasmine specs via phantom                                                                                                                                                                    

events.js:66                                                                                                                                                                                         
        throw arguments[1]; // Unhandled 'error' event                                                                                                                                               
                       ^                                                                                                                                                                             
Error: listen EACCES                                                                                                                                                                                 
    at errnoException (net.js:769:11)                                                                                                                                                                
    at Server._listen2 (net.js:892:19)                                                                                                                                                               
    at listen (net.js:936:10)                                                                                                                                                                        
    at Server.listen (net.js:985:5)                                                                                                                                                                  
    at Function.app.listen (/var/lib/stickshift/f1dad82f1ce14cd0bbaaa971c75eeedc/app-root/data/380712/node_modules/grunt-jasmine-runner/node_modules/connect/lib/proto.js:229:24)                    
    at Object.exports.start (/var/lib/stickshift/f1dad82f1ce14cd0bbaaa971c75eeedc/app-root/data/380712/node_modules/grunt-jasmine-runner/tasks/lib/server.js:17:17)                                  
    at startServer (/var/lib/stickshift/f1dad82f1ce14cd0bbaaa971c75eeedc/app-root/data/380712/node_modules/grunt-jasmine-runner/tasks/jasmine.js:141:17)                                             
    at Function.task.phantomRunner (/var/lib/stickshift/f1dad82f1ce14cd0bbaaa971c75eeedc/app-root/data/380712/node_modules/grunt-jasmine-runner/tasks/jasmine.js:109:16)                             
    at Object.<anonymous> (/var/lib/stickshift/f1dad82f1ce14cd0bbaaa971c75eeedc/app-root/data/380712/node_modules/grunt-jasmine-runner/tasks/jasmine.js:50:10)                                       
    at Object.task.registerTask.thisTask.fn (/var/lib/stickshift/f1dad82f1ce14cd0bbaaa971c75eeedc/app-root/data/380712/node_modules/grunt/lib/grunt/task.js:58:16)  

Cloud9给我的提示是

 Cloud9  Error: you may be using the wrong PORT & HOST for your server app                                                                                                                           
         Node: use 'process.env.PORT' as the port and 'process.env.IP' as the host in your app scripts 

所以我的问题是 如何配置PORT&amp;主持人?

2 个答案:

答案 0 :(得分:1)

关于grunt-jasmine-runner的当前文档具有误导性(indetnation):

事实证明我必须将服务器配置为对象文字:

//...
'jasmine' : {
  server:{
    port:process.env.PORT
  }
//...

答案 1 :(得分:0)

您需要在config.rb中添加端口和主机的值:

jasmine_port=ENV['PORT']
jasmine_host=ENV['IP']