Minitest控制台输出不显示颜色

问题描述 投票:1回答:1

我安装了ansicon,以使ansi彩色控制台输出成为可能,以便在Windows上进行最小的测试反馈。

我正在使用minitest-reporters gem运行minitest以格式化输出,但是无论如何我都无法使输出显示颜色(所有文本均为黑色)。

这是我的test_helper.rb文件:

ENV['RAILS_ENV'] ||= 'test'
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require "minitest/reporters"
Minitest::Reporters.use! Minitest::Reporters::ProgressReporter.new( { :color     => true } )

class ActiveSupport::TestCase
# Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
fixtures :all
# Add more helper methods to be used by all tests here...
end

有人知道这个问题吗?

ruby-on-rails ruby minitest
1个回答
0
投票

参考:https://github.com/kern/minitest-reporters

我看到该帖子来自2015年。从那时起已经过去了4年。无论如何,还是让我分享一下它对我的作用。

  1. Gemfilegem 'minitest-reporters'

  2. bundle install

  3. test_helper.rb

    需要“最小/报告人”Minitest :: Reporters.use!

  4. rake

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.