Sha256: 4b3e0f131204c14eb44ed8e8270ef5587520c0318d2cd23c68785b69891b46c2

Contents?: true

Size: 1.73 KB

Versions: 2

Compression:

Stored size: 1.73 KB

Contents

require 'opal/rspec/formatters/phantom_util'

module Opal
  module RSpec
    module Formatters
      # Now that we have a base working formatter, we need to add some PhantomJS related code to exit properly
      class TeamCity < ::Spec::Runner::Formatter::TeamcityFormatter
        include Opal::RSpec::Formatters::PhantomUtil
        
        ::RSpec::Core::Formatters.register self, :start, :close,
                                           :example_group_started, :example_group_finished,
                                           :example_started, :example_passed,
                                           :example_pending, :example_failed,
                                           :dump_summary, :seed
                                           
       # TeamCity doesn't yet identify fluent style examples. In Javascript/Opal, the effect of this is even more pronounced
       # since filenames and line numbers do not mean as much, so waiting to tell TeamCity the example started until it's finished,
       # that way we know the full description - https://youtrack.jetbrains.com/issue/RUBY-15519
       
       alias_method :orig_example_started, :example_started
       
       def example_started(notification)
       end
       
       def dump_summary(notification)
         super
         # Otherwise we won't know when to exit
         finish_phantom notification
       end
       
       def example_passed(notification)
         orig_example_started notification
         super
       end
       
       def example_pending(notification)
         orig_example_started notification
         super
       end
       
       def example_failed(notification)
         orig_example_started notification
         super
       end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
opal-rspec-formatter-1.0.1 opal/opal/rspec/formatters/teamcity/opal_formatter.rb
opal-rspec-formatter-1.0.0 opal/opal/rspec/formatters/teamcity/opal_formatter.rb