Polychrest

Rack middleware to trap javascript errors and inject them in the DOM so capybara drivers without javascript error reporting can find them.

Installation

Add this line to your application's Gemfile:

gem 'polychrest'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install polychrest

Usage

Polychrest will only inject script if the environment variable TRACK_JS_ERRORS is set:

$ export TRACK_JS_ERRORS; cucumber

or set it in a hook:

Around('@javascript') do |scenario, block|
  ENV['TRACK_JS_ERRORS'] = 'true'
  block.call
  ENV.delete('TRACK_JS_ERRORS')
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Added some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request