Sha256: c3b35e7c4f6c7a53bcac911395409e5cc5857c0e2812d8963df6b4f5e2ae1dad

Contents?: true

Size: 995 Bytes

Versions: 4

Compression:

Stored size: 995 Bytes

Contents

UNHANDLED_REJECTIONS = []

beforeAll ->
  window.addEventListener 'unhandledrejection', (event) ->
    UNHANDLED_REJECTIONS.push(event)

beforeEach ->
  UNHANDLED_REJECTIONS = []

  jasmine.addMatchers
    toHaveUnhandledRejections: (util, customEqualityTesters) ->
      compare: (actual) ->
        # It doesn't really matter what's in actual.
        # A good way to call this is e.g. `expect(window).not.toHaveUnhandledRejections()
        pass: UNHANDLED_REJECTIONS.length > 0

#UnhandledRejectionTracker = do ->
#
#
#
#
#
##beforeEach (done) ->
##  @unhandledRejections = []
##  @trackUnhandledRejections = (event) =>
##    @unhandledRejections.push(event)
##  window.addEventListener('unhandledrejection', @trackUnhandledRejections)
##  done()
##
##afterEach (done) ->
##  hadUnhandledRejections = @unhandledRejections.length > 0
##  @unhandledRejections = []
##  if hadUnhandledRejections
##    done.fail('There were rejected promises without a rejection handler')
##  else
##    done()

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
unpoly-rails-0.54.0 spec_app/spec/javascripts/helpers/to_have_unhandled_rejections.coffee
unpoly-rails-0.53.4 spec_app/spec/javascripts/helpers/to_have_unhandled_rejections.coffee
unpoly-rails-0.53.3 spec_app/spec/javascripts/helpers/to_have_unhandled_rejections.coffee
unpoly-rails-0.53.2 spec_app/spec/javascripts/helpers/to_have_unhandled_rejections.coffee