Class: Maze::ErrorMonitor::Config Private

Inherits:
Object
  • Object
show all
Defined in:
lib/maze/error_monitor/config.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

This class is responsible for configuring Bugsnag and setting up the middleware for error reporting.

Class Method Summary collapse

Class Method Details

.start_bugsnag(cucumber_config) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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
48
49
50
51
52
53
54
55
# File 'lib/maze/error_monitor/config.rb', line 15

def start_bugsnag(cucumber_config)
  # Use MAZE_BUGSNAG_API_KEY explicitly to avoid collisions with test env
  return unless Maze.config.enable_bugsnag && ENV['MAZE_BUGSNAG_API_KEY']

  Bugsnag.configure do |config|
    config.api_key = ENV['MAZE_BUGSNAG_API_KEY']
    config.app_version = Maze::VERSION
    config.(:'test driver', {
      'driver type': Maze.driver.class,
      'device farm': Maze.config.farm,
      'capabilities': Maze.config.capabilities
    }) if Maze.driver

    if ENV['BUILDKITE']
       = {
        'pipeline': ENV['BUILDKITE_PIPELINE_NAME'],
        'repo': ENV['BUILDKITE_REPO'],
        'build url': ENV['BUILDKITE_BUILD_URL'],
        'branch': ENV['BUILDKITE_BRANCH'],
        'builder': ENV['BUILDKITE_BUILD_CREATOR'],
        'message': ENV['BUILDKITE_MESSAGE'],
        'step': ENV['BUILDKITE_LABEL']
      }
      if ENV['BUILDKITE_JOB_ID']
        ['job url'] = ENV['BUILDKITE_BUILD_URL'] + "#" + ENV['BUILDKITE_JOB_ID']
      end
    end
    config.middleware.use(AssertErrorMiddleware)
    config.middleware.use(SeleniumErrorMiddleware)
    config.(:'buildkite', )
    config.project_root = Dir.pwd
  end

  Bugsnag.start_session

  at_exit do
    if $!
      Bugsnag.notify($!)
    end
  end
end