File: config_json_formatter.feature

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 (47 lines) | stat: -rw-r--r-- 1,465 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
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
@test_unit @config
Feature:

  SimpleCov::Formatter::JSONFormatter is one of the
  formatters included by default, useful for exporting
  coverage results in JSON format.

  Background:
    Given I'm working on the project "faked_project"

  Scenario: With JSONFormatter
    Given SimpleCov for Test/Unit is configured with:
      """
      require 'simplecov'
      require 'simplecov_json_formatter'
      SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter
      SimpleCov.at_exit do
        puts SimpleCov.result.format!
      end
      SimpleCov.start do
        add_group 'Libs', 'lib/faked_project/'
      end
      """

    When I successfully run `bundle exec rake test`
    Then a JSON coverage report should have been generated in "coverage"
    And the output should contain "JSON Coverage report generated"

  Scenario: When CC_TEST_REPORTER_ID is set in the environment
    Given SimpleCov for Test/Unit is configured with:
      """
      require 'simplecov'
      SimpleCov.at_exit do
        puts SimpleCov.result.format!
      end
      SimpleCov.start do
        add_group 'Libs', 'lib/faked_project/'
      end
      """
    And I set the environment variables to:
      | variable            | value   |
      | CC_TEST_REPORTER_ID | some-id |

    When I successfully run `bundle exec rake test`

    Then a JSON coverage report should have been generated in "coverage"
    And the output should contain "JSON Coverage report generated"