【问题标题】:Jasmine-gem / jasmine:ci : How to console.log?Jasmine-gem / jasmine:ci:如何控制台日志?
【发布时间】:2015-02-13 16:17:31
【问题描述】:

我正在使用 jasmine-gem 作为 Rails 项目的一部分。

我知道我可以使用rake jasmine 在浏览器中运行测试,但我需要通过rake jasmine:ci 无头运行它们。

当我在 headless/ci 模式下运行它们时,console.logs 不会被输出。我怎样才能做到这一点?也许jasmine_helper.rb 里有什么?

【问题讨论】:

    标签: javascript ruby-on-rails testing jasmine


    【解决方案1】:

    想通了。

    jasmine_helpers.rb:

    Jasmine.configure do |config|
      config.show_console_log = true
    end
    

    【讨论】:

    • 这个config 选项是在 2.x 中添加的;在 1.x 中尝试使用 jasmine.log 而不是 console.log
    【解决方案2】:

    您可以通过将以下内容添加到您的 jasmine.yml 文件中来做到这一点:

    show_console_log: true

    【讨论】:

      猜你喜欢
      • 2022-01-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-08-05
      • 1970-01-01
      • 1970-01-01
      • 2013-09-16
      • 1970-01-01
      相关资源
      最近更新 更多