PhantomJS在运行测试套件时崩溃

时间:2016-04-20 15:31:24

标签: javascript ruby-on-rails jasmine phantomjs

我有一个rails项目,其中设置了许多Javascript测试以通过rake spec:javascript与Jasmine一起运行,但是当我尝试执行该套件时,我收到以下消息:

Running `"/usr/local/bin/phantomjs" "" "/Users/location/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jasmine-rails-0.12.3/lib/jasmine_rails/../assets/javascripts/jasmine-runner.js" "file:///Users/location/app_name/tmp/jasmine/runner.html?spec="`

Running: file:///Users/location/app_name/tmp/jasmine/runner.html?spec=

PhantomJS has crashed. Please read the bug reporting guide at
<http://phantomjs.org/bug-reporting.html> and file a bug report.

rake aborted!

Error executing command: "/usr/local/bin/phantomjs" "" "/Users/location/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/jasmine-rails-0.12.3/lib/jasmine_rails/../assets/javascripts/jasmine-runner.js" "file:///Users/location/app_name/tmp/jasmine/runner.html?spec="

我试过谷歌搜索 - 这个问题在TravisCI和本地发生。值得注意的是,如果没有先将be rake spec:javascript添加到命令中,我将无法执行RAILS_ENV=test命令。

所以我的问题是这样的:有没有人见过这个或者知道为什么PhantomJS在套件执行时会一直崩溃?

这些是我正在使用的相关宝石的版本:

jasmine       - 2.4.0
jasmine-rails - 0.12.4
jasmine-core  - 2.4.1
guard-jasmine - 2.0.6
phantomjs     - 2.1.1.0

1 个答案:

答案 0 :(得分:1)

我遇到了同样的问题。我认为这是phantomjs 2.1.1和jasmine中的一个错误。通过分配早期版本的phantomjs可以暂时解决问题:

gem 'phantomjs', '1.9.8'

让我先将这个问题发布到Jasmine Rails,看看是否得到了关注。