teaspoon 0.7.9 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +382 -260
- data/app/assets/javascripts/teaspoon-angular.js +108 -26241
- data/app/assets/javascripts/teaspoon-jasmine.js +103 -2642
- data/app/assets/javascripts/teaspoon-mocha.js +109 -5416
- data/app/assets/javascripts/teaspoon-qunit.js +107 -2255
- data/app/assets/javascripts/teaspoon-teaspoon.js +0 -1
- data/app/assets/javascripts/teaspoon/angular.coffee +3 -1
- data/app/assets/javascripts/teaspoon/base/hook.coffee +21 -0
- data/app/assets/javascripts/teaspoon/base/reporters/html.coffee +26 -14
- data/app/assets/javascripts/teaspoon/base/reporters/html/progress_view.coffee +1 -1
- data/app/assets/javascripts/teaspoon/base/reporters/html/template.coffee +3 -3
- data/app/assets/javascripts/teaspoon/base/teaspoon.coffee +10 -1
- data/app/assets/javascripts/teaspoon/jasmine.coffee +3 -1
- data/app/assets/javascripts/teaspoon/mocha.coffee +3 -1
- data/app/assets/javascripts/teaspoon/mocha/reporters/html.coffee +1 -1
- data/app/assets/javascripts/teaspoon/qunit.coffee +3 -1
- data/app/assets/javascripts/teaspoon/qunit/reporters/html.coffee +1 -1
- data/app/assets/javascripts/teaspoon/teaspoon.coffee +0 -1
- data/app/assets/stylesheets/teaspoon.css +12 -8
- data/app/controllers/teaspoon/suite_controller.rb +32 -0
- data/app/views/teaspoon/suite/_body.html.erb +0 -0
- data/app/views/teaspoon/suite/_boot.html.erb +4 -0
- data/app/views/teaspoon/suite/_boot_require_js.html.erb +19 -0
- data/app/views/teaspoon/{spec/suites.html.erb → suite/index.html.erb} +6 -7
- data/app/views/teaspoon/suite/show.html.erb +19 -0
- data/bin/teaspoon +1 -1
- data/config/routes.rb +14 -4
- data/lib/generators/teaspoon/install/POST_INSTALL +2 -2
- data/lib/generators/teaspoon/install/install_generator.rb +22 -11
- data/lib/generators/teaspoon/install/templates/_body.html.erb +0 -0
- data/lib/generators/teaspoon/install/templates/_boot.html.erb +4 -0
- data/lib/generators/teaspoon/install/templates/jasmine/env.rb +11 -0
- data/lib/generators/teaspoon/install/templates/jasmine/env_comments.rb +182 -0
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.coffee +8 -6
- data/lib/generators/teaspoon/install/templates/jasmine/spec_helper.js +8 -7
- data/lib/generators/teaspoon/install/templates/mocha/env.rb +11 -0
- data/lib/generators/teaspoon/install/templates/mocha/env_comments.rb +182 -0
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.coffee +13 -13
- data/lib/generators/teaspoon/install/templates/mocha/spec_helper.js +13 -13
- data/lib/generators/teaspoon/install/templates/qunit/env.rb +11 -0
- data/lib/generators/teaspoon/install/templates/qunit/env_comments.rb +182 -0
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.coffee +6 -5
- data/lib/generators/teaspoon/install/templates/qunit/test_helper.js +6 -5
- data/lib/tasks/teaspoon.rake +9 -2
- data/lib/teaspoon.rb +4 -6
- data/lib/teaspoon/command_line.rb +116 -134
- data/lib/teaspoon/configuration.rb +144 -66
- data/lib/teaspoon/console.rb +70 -37
- data/lib/teaspoon/coverage.rb +42 -15
- data/lib/teaspoon/deprecated.rb +65 -0
- data/lib/teaspoon/drivers/base.rb +10 -0
- data/lib/teaspoon/drivers/phantomjs/runner.js +9 -11
- data/lib/teaspoon/drivers/phantomjs_driver.rb +21 -21
- data/lib/teaspoon/drivers/selenium_driver.rb +32 -13
- data/lib/teaspoon/engine.rb +32 -12
- data/lib/teaspoon/environment.rb +16 -12
- data/lib/teaspoon/exceptions.rb +41 -5
- data/lib/teaspoon/exporter.rb +52 -0
- data/lib/teaspoon/formatters/base.rb +171 -0
- data/lib/teaspoon/formatters/clean_formatter.rb +2 -4
- data/lib/teaspoon/formatters/documentation_formatter.rb +60 -0
- data/lib/teaspoon/formatters/dot_formatter.rb +12 -90
- data/lib/teaspoon/formatters/json_formatter.rb +36 -0
- data/lib/teaspoon/formatters/junit_formatter.rb +51 -32
- data/lib/teaspoon/formatters/modules/report_module.rb +76 -0
- data/lib/teaspoon/formatters/pride_formatter.rb +23 -27
- data/lib/teaspoon/formatters/snowday_formatter.rb +7 -11
- data/lib/teaspoon/formatters/swayze_or_oprah_formatter.rb +88 -64
- data/lib/teaspoon/formatters/tap_formatter.rb +18 -27
- data/lib/teaspoon/formatters/tap_y_formatter.rb +35 -45
- data/lib/teaspoon/formatters/teamcity_formatter.rb +69 -31
- data/lib/teaspoon/instrumentation.rb +33 -33
- data/lib/teaspoon/result.rb +2 -1
- data/lib/teaspoon/runner.rb +40 -28
- data/lib/teaspoon/server.rb +23 -25
- data/lib/teaspoon/suite.rb +52 -72
- data/lib/teaspoon/utility.rb +3 -14
- data/lib/teaspoon/version.rb +1 -1
- data/spec/dummy/app/assets/javascripts/integration/integration_spec.coffee +3 -0
- data/spec/dummy/app/assets/javascripts/integration/spec_helper.coffee +2 -0
- data/spec/dummy/config/application.rb +3 -0
- data/spec/features/console_reporter_spec.rb +48 -18
- data/spec/features/hooks_spec.rb +23 -41
- data/spec/features/html_reporter_spec.rb +38 -21
- data/spec/features/install_generator_spec.rb +34 -20
- data/spec/features/instrumentation_spec.rb +3 -2
- data/spec/fixtures/coverage.json +243 -0
- data/spec/javascripts/fixtures/_body.html.erb +1 -0
- data/spec/javascripts/jasmine_helper.coffee +1 -1
- data/spec/javascripts/teaspoon/base/fixture_spec.coffee +4 -4
- data/spec/javascripts/teaspoon/base/reporters/html_spec.coffee +9 -10
- data/spec/javascripts/teaspoon/mocha/reporters/html_mspec.coffee +0 -6
- data/spec/javascripts/teaspoon/phantomjs/runner_spec.coffee +5 -6
- data/spec/javascripts/turbolinks_helper.coffee +1 -1
- data/spec/spec_helper.rb +3 -4
- data/spec/teaspoon/command_line_spec.rb +139 -23
- data/spec/teaspoon/configuration_spec.rb +164 -46
- data/spec/teaspoon/console_spec.rb +142 -47
- data/spec/teaspoon/coverage_spec.rb +98 -28
- data/spec/teaspoon/drivers/base_spec.rb +5 -0
- data/spec/teaspoon/drivers/phantomjs_driver_spec.rb +32 -14
- data/spec/teaspoon/drivers/selenium_driver_spec.rb +32 -24
- data/spec/teaspoon/engine_spec.rb +8 -5
- data/spec/teaspoon/environment_spec.rb +56 -33
- data/spec/teaspoon/exceptions_spec.rb +57 -0
- data/spec/teaspoon/exporter_spec.rb +96 -0
- data/spec/teaspoon/formatters/base_spec.rb +259 -0
- data/spec/teaspoon/formatters/clean_formatter_spec.rb +37 -0
- data/spec/teaspoon/formatters/documentation_formatter_spec.rb +127 -0
- data/spec/teaspoon/formatters/dot_formatter_spec.rb +52 -56
- data/spec/teaspoon/formatters/json_formatter_spec.rb +77 -0
- data/spec/teaspoon/formatters/junit_formatter_spec.rb +72 -35
- data/spec/teaspoon/formatters/pride_formatter_spec.rb +37 -0
- data/spec/teaspoon/formatters/snowday_formatter_spec.rb +35 -0
- data/spec/teaspoon/formatters/tap_formatter_spec.rb +29 -81
- data/spec/teaspoon/formatters/tap_y_formatter_spec.rb +31 -141
- data/spec/teaspoon/formatters/teamcity_formatter_spec.rb +99 -42
- data/spec/teaspoon/instrumentation_spec.rb +44 -44
- data/spec/teaspoon/result_spec.rb +37 -0
- data/spec/teaspoon/runner_spec.rb +70 -59
- data/spec/teaspoon/server_spec.rb +34 -52
- data/spec/teaspoon/suite_spec.rb +42 -188
- data/spec/teaspoon_env.rb +39 -28
- data/vendor/assets/javascripts/{angular-scenario-1.0.5.js → angular/1.0.5.js} +0 -0
- data/vendor/assets/javascripts/{angular-scenario-1.0.5.MIT-LICENSE → angular/MIT-LICENSE} +0 -0
- data/vendor/assets/javascripts/{jasmine-1.3.1.js → jasmine/1.3.1.js} +0 -0
- data/vendor/assets/javascripts/jasmine/2.0.0.js +2412 -0
- data/vendor/assets/javascripts/{jasmine-1.3.1.MIT.LICENSE → jasmine/MIT.LICENSE} +0 -0
- data/vendor/assets/javascripts/{mocha-1.10.0.js → mocha/1.10.0.js} +1 -0
- data/vendor/assets/javascripts/mocha/1.17.1.js +5813 -0
- data/vendor/assets/javascripts/{mocha-1.10.1.MIT.LICENSE → mocha/MIT.LICENSE} +0 -0
- data/vendor/assets/javascripts/{qunit-1.12.0.js → qunit/1.12.0.js} +1 -1
- data/vendor/assets/javascripts/qunit/1.14.0.js +2288 -0
- data/vendor/assets/javascripts/{qunit-1.12.0.MIT.LICENSE → qunit/MIT.LICENSE} +0 -0
- data/vendor/assets/javascripts/support/chai.js +827 -385
- data/vendor/assets/javascripts/support/jasmine-jquery-1.7.0.js +720 -0
- data/vendor/assets/javascripts/support/jasmine-jquery-2.0.0.js +812 -0
- data/vendor/assets/javascripts/support/sinon-chai.js +17 -0
- data/vendor/assets/javascripts/support/sinon.js +1138 -643
- metadata +57 -36
- data/app/controllers/teaspoon/spec_controller.rb +0 -38
- data/app/helpers/teaspoon/spec_helper.rb +0 -36
- data/app/views/teaspoon/spec/_require_js.html.erb +0 -21
- data/app/views/teaspoon/spec/_standard.html.erb +0 -4
- data/app/views/teaspoon/spec/runner.html.erb +0 -19
- data/lib/generators/teaspoon/install/templates/env.rb +0 -38
- data/lib/generators/teaspoon/install/templates/jasmine/initializer.rb +0 -64
- data/lib/generators/teaspoon/install/templates/mocha/initializer.rb +0 -64
- data/lib/generators/teaspoon/install/templates/qunit/initializer.rb +0 -64
- data/lib/teaspoon/check_coverage.rb +0 -33
- data/lib/teaspoon/drivers/base_driver.rb +0 -10
- data/lib/teaspoon/exception_handling.rb +0 -18
- data/lib/teaspoon/formatters/base_formatter.rb +0 -63
- data/spec/dummy/config/initializers/teaspoon.rb +0 -41
- data/spec/teaspoon/check_coverage_spec.rb +0 -50
- data/spec/teaspoon/formatters/base_formatter_spec.rb +0 -45
- data/vendor/assets/javascripts/support/chai.MIT.LICENSE +0 -22
- data/vendor/assets/javascripts/support/expect.MIT.LICENSE +0 -22
- data/vendor/assets/javascripts/support/jasmine-jquery.MIT.LICENSE +0 -20
- data/vendor/assets/javascripts/support/jasmine-jquery.js +0 -659
- data/vendor/assets/javascripts/support/sinon-chai.MIT-ISH.LICENSE +0 -13
- data/vendor/assets/javascripts/support/sinon.BSD.LICENSE +0 -27
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
Teaspoon.setup do |config|
|
|
2
|
-
|
|
3
|
-
# This determines where the Teaspoon routes will be mounted. Changing this to "/jasmine" would allow you to browse to
|
|
4
|
-
# http://localhost:3000/jasmine to run your specs.
|
|
5
|
-
config.mount_at = "/teaspoon"
|
|
6
|
-
|
|
7
|
-
# This defaults to Rails.root if left nil. If you're testing an engine using a dummy application it can be useful to
|
|
8
|
-
# set this to your engines root.. E.g. `Teaspoon::Engine.root`
|
|
9
|
-
config.root = nil
|
|
10
|
-
|
|
11
|
-
# These paths are appended to the Rails assets paths (relative to config.root), and by default is an array that you
|
|
12
|
-
# can replace or add to.
|
|
13
|
-
config.asset_paths = ["spec/javascripts", "spec/javascripts/stylesheets"]
|
|
14
|
-
|
|
15
|
-
# Fixtures are rendered through a standard controller. This means you can use things like HAML or RABL/JBuilder, etc.
|
|
16
|
-
# to generate fixtures within this path.
|
|
17
|
-
config.fixture_path = "spec/javascripts/fixtures"
|
|
18
|
-
|
|
19
|
-
# You can modify the default suite configuration and create new suites here. Suites can be isolated from one another.
|
|
20
|
-
# When defining a suite you can provide a name and a block. If the name is left blank, :default is assumed. You can
|
|
21
|
-
# omit various directives and the defaults will be used.
|
|
22
|
-
#
|
|
23
|
-
# To run a specific suite
|
|
24
|
-
# - in the browser: http://localhost/teaspoon/[suite_name]
|
|
25
|
-
# - from the command line: rake teaspoon suite=[suite_name]
|
|
26
|
-
config.suite do |suite|
|
|
27
|
-
|
|
28
|
-
# You can specify a file matcher and all matching files will be loaded when the suite is run. It's important that
|
|
29
|
-
# these files are serve-able from sprockets.
|
|
30
|
-
#
|
|
31
|
-
# Note: Can also be set to nil.
|
|
32
|
-
suite.matcher = "{spec/javascripts,app/assets}/**/*_spec.{js,js.coffee,coffee}"
|
|
33
|
-
|
|
34
|
-
# Each suite can load a different helper, which can in turn require additional files. This file is loaded before
|
|
35
|
-
# your specs are loaded, and can be used as a manifest.
|
|
36
|
-
suite.helper = "spec_helper"
|
|
37
|
-
|
|
38
|
-
# These are the core Teaspoon javascripts. It's strongly encouraged to include only the base files here. You can
|
|
39
|
-
# require other support libraries in your spec helper, which allows you to change them without having to restart the
|
|
40
|
-
# server.
|
|
41
|
-
#
|
|
42
|
-
# Available frameworks: teaspoon-jasmine, teaspoon-mocha, teaspoon-qunit
|
|
43
|
-
#
|
|
44
|
-
# Note: To use the CoffeeScript source files use `"teaspoon/mocha"` etc.
|
|
45
|
-
suite.javascripts = ["teaspoon-mocha"]
|
|
46
|
-
|
|
47
|
-
# If you want to change how Teaspoon looks, or include your own stylesheets you can do that here. The default is the
|
|
48
|
-
# stylesheet for the HTML reporter.
|
|
49
|
-
suite.stylesheets = ["teaspoon"]
|
|
50
|
-
|
|
51
|
-
# When running coverage reports, you probably want to exclude libraries that you're not testing.
|
|
52
|
-
# Accepts an array of filenames or regular expressions. The default is to exclude assets from vendors or gems.
|
|
53
|
-
suite.no_coverage = [%r{/lib/ruby/gems/}, %r{/vendor/assets/}, %r{/support/}, %r{/(.+)_helper.}]
|
|
54
|
-
# suite.no_coverage << "jquery.min.js" # excludes jquery from coverage reports
|
|
55
|
-
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
# Example suite. Since we're just filtering to files already within the root spec/javascripts, these files will also
|
|
59
|
-
# be run in the default suite -- but can be focused into a more specific suite.
|
|
60
|
-
#config.suite :targeted do |suite|
|
|
61
|
-
# suite.matcher = "spec/javascripts/targeted/*_spec.{js,js.coffee,coffee}"
|
|
62
|
-
#end
|
|
63
|
-
|
|
64
|
-
end if defined?(Teaspoon) && Teaspoon.respond_to?(:setup) # let Teaspoon be undefined outside of development/test/asset groups
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
Teaspoon.setup do |config|
|
|
2
|
-
|
|
3
|
-
# This determines where the Teaspoon routes will be mounted. Changing this to "/jasmine" would allow you to browse to
|
|
4
|
-
# http://localhost:3000/jasmine to run your tests.
|
|
5
|
-
config.mount_at = "/teaspoon"
|
|
6
|
-
|
|
7
|
-
# This defaults to Rails.root if left nil. If you're testing an engine using a dummy application it can be useful to
|
|
8
|
-
# set this to your engines root.. E.g. `Teaspoon::Engine.root`
|
|
9
|
-
config.root = nil
|
|
10
|
-
|
|
11
|
-
# These paths are appended to the Rails assets paths (relative to config.root), and by default is an array that you
|
|
12
|
-
# can replace or add to.
|
|
13
|
-
config.asset_paths = ["test/javascripts", "test/javascripts/stylesheets"]
|
|
14
|
-
|
|
15
|
-
# Fixtures are rendered through a standard controller. This means you can use things like HAML or RABL/JBuilder, etc.
|
|
16
|
-
# to generate fixtures within this path.
|
|
17
|
-
config.fixture_path = "test/javascripts/fixtures"
|
|
18
|
-
|
|
19
|
-
# You can modify the default suite configuration and create new suites here. Suites can be isolated from one another.
|
|
20
|
-
# When defining a suite you can provide a name and a block. If the name is left blank, :default is assumed. You can
|
|
21
|
-
# omit various directives and the defaults will be used.
|
|
22
|
-
#
|
|
23
|
-
# To run a specific suite
|
|
24
|
-
# - in the browser: http://localhost/teaspoon/[suite_name]
|
|
25
|
-
# - from the command line: rake teaspoon suite=[suite_name]
|
|
26
|
-
config.suite do |suite|
|
|
27
|
-
|
|
28
|
-
# You can specify a file matcher and all matching files will be loaded when the suite is run. It's important that
|
|
29
|
-
# these files are serve-able from sprockets.
|
|
30
|
-
#
|
|
31
|
-
# Note: Can also be set to nil.
|
|
32
|
-
suite.matcher = "{test/javascripts,app/assets}/**/*_test.{js,js.coffee,coffee}"
|
|
33
|
-
|
|
34
|
-
# Each suite can load a different helper, which can in turn require additional files. This file is loaded before
|
|
35
|
-
# your tests are loaded, and can be used as a manifest.
|
|
36
|
-
suite.helper = "spec_helper"
|
|
37
|
-
|
|
38
|
-
# These are the core Teaspoon javascripts. It's strongly encouraged to include only the base files here. You can
|
|
39
|
-
# require other support libraries in your test helper, which allows you to change them without having to restart the
|
|
40
|
-
# server.
|
|
41
|
-
#
|
|
42
|
-
# Available frameworks: teaspoon-jasmine, teaspoon-mocha, teaspoon-qunit
|
|
43
|
-
#
|
|
44
|
-
# Note: To use the CoffeeScript source files use `"teaspoon/qunit"` etc.
|
|
45
|
-
suite.javascripts = ["teaspoon-qunit"]
|
|
46
|
-
|
|
47
|
-
# If you want to change how Teaspoon looks, or include your own stylesheets you can do that here. The default is the
|
|
48
|
-
# stylesheet for the HTML reporter.
|
|
49
|
-
suite.stylesheets = ["teaspoon"]
|
|
50
|
-
|
|
51
|
-
# When running coverage reports, you probably want to exclude libraries that you're not testing.
|
|
52
|
-
# Accepts an array of filenames or regular expressions. The default is to exclude assets from vendors or gems.
|
|
53
|
-
suite.no_coverage = [%r{/lib/ruby/gems/}, %r{/vendor/assets/}, %r{/support/}, %r{/(.+)_helper.}]
|
|
54
|
-
# suite.no_coverage << "jquery.min.js" # excludes jquery from coverage reports
|
|
55
|
-
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
# Example suite. Since we're just filtering to files already within the root test/javascripts, these files will also
|
|
59
|
-
# be run in the default suite -- but can be focused into a more specific suite.
|
|
60
|
-
#config.suite :targeted do |suite|
|
|
61
|
-
# suite.matcher = "test/javascripts/targeted/*_test.{js,js.coffee,coffee}"
|
|
62
|
-
#end
|
|
63
|
-
|
|
64
|
-
end if defined?(Teaspoon) && Teaspoon.respond_to?(:setup) # let Teaspoon be undefined outside of development/test/asset groups
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
module Teaspoon
|
|
2
|
-
class CheckCoverage
|
|
3
|
-
include Teaspoon::Utility
|
|
4
|
-
|
|
5
|
-
def initialize(input)
|
|
6
|
-
@input = input
|
|
7
|
-
end
|
|
8
|
-
|
|
9
|
-
def check_coverage
|
|
10
|
-
do_check_coverage(check_coverage_options.strip) unless check_coverage_options.nil?
|
|
11
|
-
end
|
|
12
|
-
|
|
13
|
-
private
|
|
14
|
-
|
|
15
|
-
def do_check_coverage(options)
|
|
16
|
-
result = %x{#{executable} check-coverage #{options} #{@input.shellescape}}
|
|
17
|
-
raise "Coverage threshold failure (current levels: #{options})" unless $?.exitstatus == 0
|
|
18
|
-
result.strip
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
def check_coverage_options
|
|
22
|
-
@check_coverage_options ||= %w{statements functions branches lines}.inject("") do |line, coverage_type|
|
|
23
|
-
threshold = Teaspoon.configuration.send(:"#{coverage_type}_coverage_threshold")
|
|
24
|
-
|
|
25
|
-
line += "--#{coverage_type} #{threshold} " unless threshold.nil?
|
|
26
|
-
end
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
def executable
|
|
30
|
-
@executable ||= which("istanbul")
|
|
31
|
-
end
|
|
32
|
-
end
|
|
33
|
-
end
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
# todo: exception handling like this should probably be configurable, because it may cause issues in some setups.
|
|
2
|
-
require 'action_dispatch/middleware/debug_exceptions'
|
|
3
|
-
|
|
4
|
-
if Teaspoon.configuration.driver == "phantomjs"
|
|
5
|
-
# debugging should be off to display errors in the spec_controller
|
|
6
|
-
Rails.application.config.assets.debug = false
|
|
7
|
-
|
|
8
|
-
# we want rails to display exceptions
|
|
9
|
-
Rails.application.config.action_dispatch.show_exceptions = true
|
|
10
|
-
|
|
11
|
-
class ActionDispatch::DebugExceptions
|
|
12
|
-
def render_exception(env, exception)
|
|
13
|
-
message = "#{exception.class.name}: #{exception.message}"
|
|
14
|
-
body = "<script>throw Error(#{message.inspect})</script>"
|
|
15
|
-
[200, {'Content-Type' => "text/html;", 'Content-Length' => body.bytesize.to_s}, [body]]
|
|
16
|
-
end
|
|
17
|
-
end
|
|
18
|
-
end
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
module Teaspoon
|
|
2
|
-
module Formatters
|
|
3
|
-
|
|
4
|
-
autoload :CleanFormatter, 'teaspoon/formatters/clean_formatter'
|
|
5
|
-
autoload :DotFormatter, 'teaspoon/formatters/dot_formatter'
|
|
6
|
-
autoload :JunitFormatter, 'teaspoon/formatters/junit_formatter'
|
|
7
|
-
autoload :PrideFormatter, 'teaspoon/formatters/pride_formatter'
|
|
8
|
-
autoload :SnowdayFormatter, 'teaspoon/formatters/snowday_formatter'
|
|
9
|
-
autoload :SwayzeOrOprahFormatter, 'teaspoon/formatters/swayze_or_oprah_formatter'
|
|
10
|
-
autoload :TapFormatter, 'teaspoon/formatters/tap_formatter'
|
|
11
|
-
autoload :TapYFormatter, 'teaspoon/formatters/tap_y_formatter'
|
|
12
|
-
autoload :TeamcityFormatter, 'teaspoon/formatters/teamcity_formatter'
|
|
13
|
-
|
|
14
|
-
class BaseFormatter
|
|
15
|
-
|
|
16
|
-
attr_accessor :total, :passes, :pendings, :failures, :errors
|
|
17
|
-
|
|
18
|
-
def initialize(suite_name = :default)
|
|
19
|
-
@suite_name = suite_name.to_s
|
|
20
|
-
@total = 0
|
|
21
|
-
@passes = []
|
|
22
|
-
@pendings = []
|
|
23
|
-
@failures = []
|
|
24
|
-
@errors = []
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
def spec(result)
|
|
28
|
-
@total += 1
|
|
29
|
-
if result.passing?
|
|
30
|
-
@passes << result
|
|
31
|
-
elsif result.pending?
|
|
32
|
-
@pendings << result
|
|
33
|
-
else
|
|
34
|
-
@failures << result
|
|
35
|
-
end
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def result(results)
|
|
39
|
-
log_coverage(results["coverage"])
|
|
40
|
-
return if failures.size == 0
|
|
41
|
-
STDOUT.print("\n")
|
|
42
|
-
raise Teaspoon::Failure if Teaspoon.configuration.fail_fast
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
# Exceptions come from startup errors in the server
|
|
46
|
-
def exception(exception = {})
|
|
47
|
-
raise Teaspoon::RunnerException
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
def suppress_logs?
|
|
51
|
-
false
|
|
52
|
-
end
|
|
53
|
-
|
|
54
|
-
private
|
|
55
|
-
|
|
56
|
-
def log_coverage(data)
|
|
57
|
-
return if data.blank?
|
|
58
|
-
report_output = Teaspoon::Coverage.new(data, @suite_name).reports
|
|
59
|
-
STDOUT.print(report_output) unless suppress_logs?
|
|
60
|
-
end
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
end
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
Teaspoon.setup do |config|
|
|
2
|
-
|
|
3
|
-
config.root = Teaspoon::Engine.root
|
|
4
|
-
config.asset_paths << Teaspoon::Engine.root.join('lib/teaspoon')
|
|
5
|
-
|
|
6
|
-
config.suite do |suite|
|
|
7
|
-
suite.matcher = "{spec/javascripts,spec/dummy/app/assets/javascripts/specs}/**/*_spec.{js,js.coffee,coffee,js.coffee.erb}"
|
|
8
|
-
suite.javascripts = ["teaspoon/jasmine"]
|
|
9
|
-
end
|
|
10
|
-
|
|
11
|
-
config.suite :jasmine do |suite|
|
|
12
|
-
suite.matcher = "spec/javascripts/**/*_jspec.{js,js.coffee,coffee}"
|
|
13
|
-
suite.javascripts = ["teaspoon/jasmine"]
|
|
14
|
-
suite.helper = "jasmine_helper"
|
|
15
|
-
end
|
|
16
|
-
|
|
17
|
-
config.suite :mocha do |suite|
|
|
18
|
-
suite.matcher = "spec/javascripts/**/*_mspec.{js,js.coffee,coffee}"
|
|
19
|
-
suite.javascripts = ["teaspoon/mocha"]
|
|
20
|
-
suite.helper = "mocha_helper"
|
|
21
|
-
end
|
|
22
|
-
|
|
23
|
-
config.suite :qunit do |suite|
|
|
24
|
-
suite.matcher = "test/javascripts/**/*_test.{js,js.coffee,coffee}"
|
|
25
|
-
suite.javascripts = ["teaspoon/qunit"]
|
|
26
|
-
suite.helper = "qunit_helper"
|
|
27
|
-
end
|
|
28
|
-
|
|
29
|
-
config.suite :angular do |suite|
|
|
30
|
-
suite.matcher = "spec/javascripts/**/*_aspec.{js,js.coffee,coffee}"
|
|
31
|
-
suite.javascripts = ["teaspoon/angular"]
|
|
32
|
-
suite.helper = "angular_helper"
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
#config.suite :integration do |suite|
|
|
36
|
-
# suite.matcher = "spec/dummy/app/assets/javascripts/integration/*_spec.{js,js.coffee,coffee}"
|
|
37
|
-
# suite.javascripts = ["teaspoon/jasmine"]
|
|
38
|
-
# suite.helper = nil
|
|
39
|
-
#end
|
|
40
|
-
|
|
41
|
-
end if defined?(Teaspoon) && Teaspoon.respond_to?(:setup) # let Teaspoon be undefined outside of development/test/asset groups
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require "teaspoon/check_coverage"
|
|
3
|
-
|
|
4
|
-
describe Teaspoon::CheckCoverage do
|
|
5
|
-
|
|
6
|
-
before(:each) do
|
|
7
|
-
path = nil
|
|
8
|
-
Dir.mktmpdir { |p| path = p }
|
|
9
|
-
Dir.stub(:mktmpdir).and_yield(path)
|
|
10
|
-
output = File.join(path, "coverage.json")
|
|
11
|
-
@subject = Teaspoon::CheckCoverage.new(output)
|
|
12
|
-
end
|
|
13
|
-
|
|
14
|
-
describe "#check_coverage" do
|
|
15
|
-
|
|
16
|
-
context "coverage thresholds NOT set" do
|
|
17
|
-
|
|
18
|
-
before do
|
|
19
|
-
Teaspoon.configuration.should_receive(:statements_coverage_threshold).and_return(nil)
|
|
20
|
-
Teaspoon.configuration.should_receive(:functions_coverage_threshold).and_return(nil)
|
|
21
|
-
Teaspoon.configuration.should_receive(:branches_coverage_threshold).and_return(nil)
|
|
22
|
-
Teaspoon.configuration.should_receive(:lines_coverage_threshold).and_return(nil)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
it "does not check the coverage" do
|
|
26
|
-
@subject.should_not_receive(:do_check_coverage)
|
|
27
|
-
@subject.check_coverage
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
context "coverage thresholds set" do
|
|
33
|
-
before do
|
|
34
|
-
Teaspoon.configuration.should_receive(:statements_coverage_threshold).and_return(50)
|
|
35
|
-
Teaspoon.configuration.should_receive(:functions_coverage_threshold).and_return(60)
|
|
36
|
-
Teaspoon.configuration.should_receive(:branches_coverage_threshold).and_return(70)
|
|
37
|
-
Teaspoon.configuration.should_receive(:lines_coverage_threshold).and_return(80)
|
|
38
|
-
@subject.stub(:do_check_coverage)
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
it "checks the coverage" do
|
|
42
|
-
@subject.should_receive(:do_check_coverage).with("--statements 50 --functions 60 --branches 70 --lines 80")
|
|
43
|
-
@subject.check_coverage
|
|
44
|
-
end
|
|
45
|
-
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
end
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
require "spec_helper"
|
|
2
|
-
require "teaspoon/formatters/base_formatter"
|
|
3
|
-
require "teaspoon/result"
|
|
4
|
-
|
|
5
|
-
describe Teaspoon::Formatters::BaseFormatter do
|
|
6
|
-
|
|
7
|
-
before do
|
|
8
|
-
@log = ""
|
|
9
|
-
STDOUT.stub(:print) { |s| @log << s }
|
|
10
|
-
end
|
|
11
|
-
|
|
12
|
-
describe "#result" do
|
|
13
|
-
|
|
14
|
-
it "calls log_coverage" do
|
|
15
|
-
subject.should_receive(:log_coverage).with("_coverage_")
|
|
16
|
-
subject.result("coverage" => "_coverage_")
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
describe "#log_coverage" do
|
|
22
|
-
|
|
23
|
-
it "logs the coverage information" do
|
|
24
|
-
double = double(reports: nil)
|
|
25
|
-
Teaspoon::Coverage.should_receive(:new).with("_data_", "default").and_return(double)
|
|
26
|
-
double.should_receive(:reports).and_return("_reports_")
|
|
27
|
-
STDOUT.should_receive(:print).with("_reports_")
|
|
28
|
-
subject.send(:log_coverage, "_data_")
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
it "doesn't log if there's no data" do
|
|
32
|
-
Teaspoon::Coverage.should_not_receive(:new)
|
|
33
|
-
subject.send(:log_coverage, {})
|
|
34
|
-
end
|
|
35
|
-
|
|
36
|
-
it "doesn't log when suppressing logs" do
|
|
37
|
-
subject.should_receive(:suppress_logs?).and_return(true)
|
|
38
|
-
Teaspoon::Coverage.should_receive(:new).and_return(double(reports: nil))
|
|
39
|
-
STDOUT.should_not_receive(:print)
|
|
40
|
-
subject.send(:log_coverage, "_data_")
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
end
|
|
44
|
-
|
|
45
|
-
end
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
(The MIT License)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2011-2012 Jake Luer jake@alogicalparadox.com
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
a copy of this software and associated documentation files (the
|
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
-
the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
|
14
|
-
included in all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
(The MIT License)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2011 Guillermo Rauch <guillermo@learnboost.com>
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
-
a copy of this software and associated documentation files (the
|
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
-
the following conditions:
|
|
12
|
-
|
|
13
|
-
The above copyright notice and this permission notice shall be
|
|
14
|
-
included in all copies or substantial portions of the Software.
|
|
15
|
-
|
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|