1 # frozen_string_literal: true
 
   3 # Monkey patch pending new release with
 
   4 # https://github.com/jejacks0n/teaspoon/pull/604
 
   5 Rack::Server = Rackup::Server
 
   7 Teaspoon.configure do |config|
 
   8   # Determines where the Teaspoon routes will be mounted. Changing this to "/jasmine" would allow you to browse to
 
   9   # `http://localhost:3000/jasmine` to run your tests.
 
  10   config.mount_at = "/teaspoon"
 
  12   # Specifies the root where Teaspoon will look for files. If you're testing an engine using a dummy application it can
 
  13   # be useful to set this to your engines root (e.g. `Teaspoon::Engine.root`).
 
  14   # Note: Defaults to `Rails.root` if nil.
 
  17   # Paths that will be appended to the Rails assets paths
 
  18   # Note: Relative to `config.root`.
 
  19   config.asset_paths = ["test/javascripts", "test/javascripts/stylesheets"]
 
  21   # Fixtures are rendered through a controller, which allows using HAML, RABL/JBuilder, etc. Files in these paths will
 
  22   # be rendered as fixtures.
 
  23   config.fixture_paths = ["test/javascripts/fixtures"]
 
  27   # You can modify the default suite configuration and create new suites here. Suites are isolated from one another.
 
  29   # When defining a suite you can provide a name and a block. If the name is left blank, :default is assumed. You can
 
  30   # omit various directives and the ones defined in the default suite will be used.
 
  32   # To run a specific suite
 
  33   # - in the browser: http://localhost/teaspoon/[suite_name]
 
  34   # - with the rake task: rake teaspoon suite=[suite_name]
 
  35   # - with the cli: teaspoon --suite=[suite_name]
 
  36   config.suite do |suite|
 
  37     # Specify the framework you would like to use. This allows you to select versions, and will do some basic setup for
 
  38     # you -- which you can override with the directives below. This should be specified first, as it can override other
 
  40     # Note: If no version is specified, the latest is assumed.
 
  42     # Versions: 1.10.0, 1.17.1, 1.18.2, 1.19.0, 2.0.1, 2.1.0, 2.2.4, 2.2.5, 2.3.3
 
  43     suite.use_framework :mocha, "2.3.3"
 
  45     # Specify a file matcher as a regular expression and all matching files will be loaded when the suite is run. These
 
  46     # files need to be within an asset path. You can add asset paths using the `config.asset_paths`.
 
  47     suite.matcher = "{test/javascripts,app/assets}/**/*_test.{js,js.coffee,coffee,es6,js.es6}"
 
  49     # Load additional JS files, but requiring them in your spec helper is the preferred way to do this.
 
  50     # suite.javascripts = []
 
  52     # You can include your own stylesheets if you want to change how Teaspoon looks.
 
  53     # Note: Spec related CSS can and should be loaded using fixtures.
 
  54     # suite.stylesheets = ["teaspoon"]
 
  56     # This suites spec helper, which can require additional support files. This file is loaded before any of your test
 
  58     suite.helper = "test_helper"
 
  60     # Partial to be rendered in the head tag of the runner. You can use the provided ones or define your own by creating
 
  61     # a `_boot.html.erb` in your fixtures path, and adjust the config to `"/boot"` for instance.
 
  63     # Available: boot, boot_require_js
 
  64     suite.boot_partial = "boot"
 
  66     # Partial to be rendered in the body tag of the runner. You can define your own to create a custom body structure.
 
  67     suite.body_partial = "body"
 
  69     # Hooks allow you to use `Teaspoon.hook("fixtures")` before, after, or during your spec run. This will make a
 
  70     # synchronous Ajax request to the server that will call all of the blocks you've defined for that hook name.
 
  71     # suite.hook :fixtures, &proc{}
 
  73     # Determine whether specs loaded into the test harness should be embedded as individual script tags or concatenated
 
  74     # into a single file. Similar to Rails' asset `debug: true` and `config.assets.debug = true` options. By default,
 
  75     # Teaspoon expands all assets to provide more valuable stack traces that reference individual source files.
 
  76     # suite.expand_assets = true
 
  78     # Non-.js file extensions Teaspoon should consider JavaScript files
 
  79     # suite.js_extensions = [/(\.js)?.coffee/, /(\.js)?.es6/, ".es6.js"]
 
  82   # Example suite. Since we're just filtering to files already within the root test/javascripts, these files will also
 
  83   # be run in the default suite -- but can be focused into a more specific suite.
 
  84   # config.suite :targeted do |suite|
 
  85   #  suite.matcher = "spec/javascripts/targeted/*_spec.{js,js.coffee,coffee}"
 
  88   # CONSOLE RUNNER SPECIFIC
 
  90   # These configuration directives are applicable only when running via the rake task or command line interface. These
 
  91   # directives can be overridden using the command line interface arguments or with ENV variables when using the rake
 
  94   # Command Line Interface:
 
  95   # teaspoon --driver=phantomjs --server-port=31337 --fail-fast=true --format=junit --suite=my_suite /spec/file_spec.js
 
  98   # teaspoon DRIVER=phantomjs SERVER_PORT=31337 FAIL_FAST=true FORMATTERS=junit suite=my_suite
 
 100   # Specify which headless driver to use. Supports PhantomJS, Selenium Webdriver and BrowserStack Webdriver.
 
 102   # Available: :phantomjs, :selenium, :browserstack
 
 103   # PhantomJS: https://github.com/jejacks0n/teaspoon/wiki/Using-PhantomJS
 
 104   # Selenium Webdriver: https://github.com/jejacks0n/teaspoon/wiki/Using-Selenium-WebDriver
 
 105   # BrowserStack Webdriver: https://github.com/jejacks0n/teaspoon/wiki/Using-BrowserStack-WebDriver
 
 106   # Capybara Webkit: https://github.com/jejacks0n/teaspoon/wiki/Using-Capybara-Webkit
 
 107   require "selenium-webdriver"
 
 108   config.driver = :selenium
 
 109   firefox_options = Selenium::WebDriver::Firefox::Options.new
 
 110   firefox_options.args = ["-headless"] if Settings.system_test_headless
 
 111   firefox_options.binary = Settings.system_test_firefox_binary if Settings.system_test_firefox_binary
 
 112   config.driver_options = {
 
 113     :client_driver => :firefox,
 
 114     :selenium_options => {
 
 115       :options => firefox_options
 
 119   # Specify additional options for the driver.
 
 121   # PhantomJS: https://github.com/jejacks0n/teaspoon/wiki/Using-PhantomJS
 
 122   # Selenium Webdriver: https://github.com/jejacks0n/teaspoon/wiki/Using-Selenium-WebDriver
 
 123   # BrowserStack Webdriver: https://github.com/jejacks0n/teaspoon/wiki/Using-BrowserStack-WebDriver
 
 124   # Capybara Webkit: https://github.com/jejacks0n/teaspoon/wiki/Using-Capybara-Webkit
 
 125   # config.driver_options = nil
 
 127   # Specify the timeout for the driver. Specs are expected to complete within this time frame or the run will be
 
 128   # considered a failure. This is to avoid issues that can arise where tests stall.
 
 129   # config.driver_timeout = 180
 
 131   # Specify a server to use with Rack (e.g. thin, mongrel). If nil is provided Rack::Server is used.
 
 132   # config.server = nil
 
 134   # Specify a host to run on a specific host, otherwise Teaspoon will use 127.0.0.1.
 
 135   # config.server_host = nil
 
 137   # Specify a port to run on a specific port, otherwise Teaspoon will use a random available port.
 
 138   # config.server_port = nil
 
 140   # Timeout for starting the server in seconds. If your server is slow to start you may have to bump this, or you may
 
 141   # want to lower this if you know it shouldn't take long to start.
 
 142   # config.server_timeout = 20
 
 144   # Force Teaspoon to fail immediately after a failing suite. Can be useful to make Teaspoon fail early if you have
 
 145   # several suites, but in environments like CI this may not be desirable.
 
 146   # config.fail_fast = true
 
 148   # Specify the formatters to use when outputting the results.
 
 149   # Note: Output files can be specified by using `"junit>/path/to/output.xml"`.
 
 151   # Available: :dot, :clean, :documentation, :json, :junit, :pride, :rspec_html, :snowday, :swayze_or_oprah, :tap, :tap_y, :teamcity
 
 152   # config.formatters = [:dot]
 
 154   # Specify if you want color output from the formatters.
 
 155   # config.color = true
 
 157   # Teaspoon pipes all console[log/debug/error] to $stdout. This is useful to catch places where you've forgotten to
 
 158   # remove them, but in verbose applications this may not be desirable.
 
 159   # config.suppress_log = false
 
 161   # COVERAGE REPORTS / THRESHOLD ASSERTIONS
 
 163   # Coverage reports requires Istanbul (https://github.com/gotwarlost/istanbul) to add instrumentation to your code and
 
 164   # display coverage statistics.
 
 166   # Coverage configurations are similar to suites. You can define several, and use different ones under different
 
 169   # To run with a specific coverage configuration
 
 170   # - with the rake task: rake teaspoon USE_COVERAGE=[coverage_name]
 
 171   # - with the cli: teaspoon --coverage=[coverage_name]
 
 173   # Specify that you always want a coverage configuration to be used. Otherwise, specify that you want coverage
 
 175   # Set this to "true" or the name of your coverage config.
 
 176   # config.use_coverage = nil
 
 178   # You can have multiple coverage configs by passing a name to config.coverage.
 
 179   # e.g. config.coverage :ci do |coverage|
 
 180   # The default coverage config name is :default.
 
 181   config.coverage do |coverage|
 
 182     # Which coverage reports Istanbul should generate. Correlates directly to what Istanbul supports.
 
 184     # Available: text-summary, text, html, lcov, lcovonly, cobertura, teamcity
 
 185     # coverage.reports = ["text-summary", "html"]
 
 187     # The path that the coverage should be written to - when there's an artifact to write to disk.
 
 188     # Note: Relative to `config.root`.
 
 189     # coverage.output_path = "coverage"
 
 191     # Assets to be ignored when generating coverage reports. Accepts an array of filenames or regular expressions. The
 
 192     # default excludes assets from vendor, gems and support libraries.
 
 193     # coverage.ignore = [%r{/lib/ruby/gems/}, %r{/vendor/assets/}, %r{/support/}, %r{/(.+)_helper.}]
 
 195     # Various thresholds requirements can be defined, and those thresholds will be checked at the end of a run. If any
 
 196     # aren't met the run will fail with a message. Thresholds can be defined as a percentage (0-100), or nil.
 
 197     # coverage.statements = nil
 
 198     # coverage.functions = nil
 
 199     # coverage.branches = nil
 
 200     # coverage.lines = nil