File: default_formatter.rb

package info (click to toggle)
ruby-simplecov 0.22.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,500 kB
  • sloc: ruby: 5,550; makefile: 10
file content (20 lines) | stat: -rw-r--r-- 492 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

require "simplecov-html"
module SimpleCov
  module Formatter
    class << self
      def from_env(env)
        formatters = [SimpleCov::Formatter::HTMLFormatter]

        # When running under a CI that uses CodeClimate, JSON output is expected
        if env.fetch("CC_TEST_REPORTER_ID", nil)
          require "simplecov_json_formatter"
          formatters.push(SimpleCov::Formatter::JSONFormatter)
        end

        formatters
      end
    end
  end
end