master
1# Set RAILS_ROOT and load the environment if it's not already loaded.
2unless defined?(Rails)
3 ENV["RAILS_ROOT"] = File.expand_path("../../", __FILE__)
4 require File.expand_path("../../config/environment", __FILE__)
5end
6
7Teaspoon.configure do |config|
8
9 # Determines where the Teaspoon routes will be mounted. Changing this to "/jasmine" would allow you to browse to
10 # `http://localhost:3000/jasmine` to run your tests.
11 #config.mount_at = "/teaspoon"
12
13 # Specifies the root where Teaspoon will look for files. If you're testing an engine using a dummy application it can
14 # be useful to set this to your engines root (e.g. `Teaspoon::Engine.root`).
15 # Note: Defaults to `Rails.root` if nil.
16 #config.root = nil
17
18 # Paths that will be appended to the Rails assets paths
19 # Note: Relative to `config.root`.
20 #config.asset_paths = ["spec/javascripts", "spec/javascripts/stylesheets"]
21
22 # Fixtures are rendered through a controller, which allows using HAML, RABL/JBuilder, etc. Files in these paths will
23 # be rendered as fixtures.
24 #config.fixture_paths = ["spec/javascripts/fixtures"]
25
26 # SUITES
27 #
28 # You can modify the default suite configuration and create new suites here. Suites are isolated from one another.
29 #
30 # When defining a suite you can provide a name and a block. If the name is left blank, :default is assumed. You can
31 # omit various directives and the ones defined in the default suite will be used.
32 #
33 # To run a specific suite
34 # - in the browser: http://localhost/teaspoon/[suite_name]
35 # - with the rake task: rake teaspoon suite=[suite_name]
36 # - with the cli: teaspoon --suite=[suite_name]
37 config.suite do |suite|
38
39 # Specify the framework you would like to use. This allows you to select versions, and will do some basic setup for
40 # you -- which you can override with the directives below. This should be specified first, as it can override other
41 # directives.
42 # Note: If no version is specified, the latest is assumed.
43 #
44 # Available: jasmine[1.3.1, 2.0.0], mocha[1.10.0, 1.17.1] qunit[1.12.0, 1.14.0]
45 suite.use_framework :jasmine, "2.2.0"
46
47 # Specify a file matcher as a regular expression and all matching files will be loaded when the suite is run. These
48 # files need to be within an asset path. You can add asset paths using the `config.asset_paths`.
49 #suite.matcher = "{spec/javascripts,app/assets}/**/*_spec.{js,js.coffee,coffee}"
50
51 # This suites spec helper, which can require additional support files. This file is loaded before any of your test
52 # files are loaded.
53 #suite.helper = "spec_helper"
54
55 # The core Teaspoon javascripts. It's recommended to include only the base files here, as you can require support
56 # libraries from your spec helper.
57 # Note: For CoffeeScript files use `"teaspoon/jasmine"` etc.
58 #
59 # Available: teaspoon-jasmine, teaspoon-mocha, teaspoon-qunit
60 #suite.javascripts = ["jasmine/1.3.1", "teaspoon-jasmine"]
61
62 # You can include your own stylesheets if you want to change how Teaspoon looks.
63 # Note: Spec related CSS can and should be loaded using fixtures.
64 #suite.stylesheets = ["teaspoon"]
65
66 # Partial to be rendered in the head tag of the runner. You can use the provided ones or define your own by creating
67 # a `_boot.html.erb` in your fixtures path, and adjust the config to `"/boot"` for instance.
68 #
69 # Available: boot, boot_require_js
70 #suite.boot_partial = "boot"
71
72 # Partial to be rendered in the body tag of the runner. You can define your own to create a custom body structure.
73 #suite.body_partial = "body"
74
75 # Assets to be ignored when generating coverage reports. Accepts an array of filenames or regular expressions. The
76 # default excludes assets from vendor, gems and support libraries.<br/><br/>
77 #suite.no_coverage = [%r{/lib/ruby/gems/}, %r{/vendor/assets/}, %r{/support/}, %r{/(.+)_helper.}]
78
79 # Hooks allow you to use `Teaspoon.hook("fixtures")` before, after, or during your spec run. This will make a
80 # synchronous Ajax request to the server that will call all of the blocks you've defined for that hook name.
81 #suite.hook :fixtures, proc{ }
82 end
83
84 # Example suite. Since we're just filtering to files already within the root test/javascripts, these files will also
85 # be run in the default suite -- but can be focused into a more specific suite.
86 #config.suite :targeted do |suite|
87 # suite.matcher = "test/javascripts/targeted/*_test.{js,js.coffee,coffee}"
88 #end
89
90 # CONSOLE RUNNER SPECIFIC
91 #
92 # These configuration directives are applicable only when running via the rake task or command line interface. These
93 # directives can be overridden using the command line interface arguments or with ENV variables when using the rake
94 # task.
95 #
96 # Command Line Interface:
97 # teaspoon --driver=phantomjs --server-port=31337 --fail-fast=true --format=junit --suite=my_suite /spec/file_spec.js
98 #
99 # Rake:
100 # teaspoon DRIVER=phantomjs SERVER_PORT=31337 FAIL_FAST=true FORMATTERS=junit suite=my_suite
101
102 # Specify which headless driver to use. Supports PhantomJS and Selenium Webdriver.
103 #
104 # Available: phantomjs, selenium
105 # PhantomJS: https://github.com/modeset/teaspoon/wiki/Using-PhantomJS
106 # Selenium Webdriver: https://github.com/modeset/teaspoon/wiki/Using-Selenium-WebDriver
107 #config.driver = "phantomjs"
108
109 # Specify additional options for the driver.
110 #
111 # PhantomJS: https://github.com/modeset/teaspoon/wiki/Using-PhantomJS
112 # Selenium Webdriver: https://github.com/modeset/teaspoon/wiki/Using-Selenium-WebDriver
113 #config.driver_options = nil
114
115 # Specify the timeout for the driver. Specs are expected to complete within this time frame or the run will be
116 # considered a failure. This is to avoid issues that can arise where tests stall.
117 #config.driver_timeout = 180
118
119 # Specify a server to use with Rack (e.g. thin, mongrel). If nil is provided Rack::Server is used.
120 #config.server = nil
121
122 # Specify a port to run on a specific port, otherwise Teaspoon will use a random available port.
123 #config.server_port = nil
124
125 # Timeout for starting the server in seconds. If your server is slow to start you may have to bump this, or you may
126 # want to lower this if you know it shouldn't take long to start.
127 #config.server_timeout = 20
128
129 # Force Teaspoon to fail immediately after a failing suite. Can be useful to make Teaspoon fail early if you have
130 # several suites, but in environments like CI this may not be desirable.
131 #config.fail_fast = true
132
133 # Specify the formatters to use when outputting the results.
134 # Note: Output files can be specified by using `"junit>/path/to/output.xml"`.
135 #
136 # Available: dot, documentation, clean, json, junit, pride, snowday, swayze_or_oprah, tap, tap_y, teamcity
137 #config.formatters = ["dot"]
138
139 # Specify if you want color output from the formatters.
140 #config.color = true
141
142 # Teaspoon pipes all console[log/debug/error] to $stdout. This is useful to catch places where you've forgotten to
143 # remove them, but in verbose applications this may not be desirable.
144 #config.suppress_log = false
145
146 # COVERAGE REPORTS / THRESHOLD ASSERTIONS
147 #
148 # Coverage reports requires Istanbul (https://github.com/gotwarlost/istanbul) to add instrumentation to your code and
149 # display coverage statistics.
150 #
151 # Coverage configurations are similar to suites. You can define several, and use different ones under different
152 # conditions.
153 #
154 # To run with a specific coverage configuration
155 # - with the rake task: rake teaspoon USE_COVERAGE=[coverage_name]
156 # - with the cli: teaspoon --coverage=[coverage_name]
157
158 # Specify that you always want a coverage configuration to be used.
159 #config.use_coverage = nil
160
161 config.coverage do |coverage|
162 # Which coverage reports Instanbul should generate. Correlates directly to what Istanbul supports.
163 #
164 # Available: text-summary, text, html, lcov, lcovonly, cobertura, teamcity
165 #coverage.reports = ["text-summary", "html"]
166 coverage.reports = ['text', 'html', 'lcov', 'cobertura']
167
168 # The path that the coverage should be written to - when there's an artifact to write to disk.
169 # Note: Relative to `config.root`.
170 #coverage.output_dir = "coverage"
171
172 # Various thresholds requirements can be defined, and those thresholds will be checked at the end of a run. If any
173 # aren't met the run will fail with a message. Thresholds can be defined as a percentage (0-100), or nil.
174 coverage.statements = 80
175 coverage.functions = 80
176 coverage.branches = 80
177 coverage.lines = 80
178 end
179end