guard-jasmine 1.15.1 → 1.16.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 +65 -61
- data/lib/guard/jasmine.rb +27 -26
- data/lib/guard/jasmine/cli.rb +31 -25
- data/lib/guard/jasmine/runner.rb +16 -4
- data/lib/guard/jasmine/version.rb +1 -1
- metadata +16 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53193032b63dd7b6271957ed84d4f210e480c555
|
4
|
+
data.tar.gz: 397ee318b045ae2c7afb655bf16024a4e3e05d34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6eaa3b8cd54eaa1630ca2725faa439210b717e5716db767f99b0d94c34bb53672e73776404210f6f8d54d73a7d07f38d0491f8f42d8bae3f25a35e193950a6f
|
7
|
+
data.tar.gz: a35aeebd262c0c02d6cbd588bb2d27222986a0e6133ec0cf5907a19c7ad87276e7a1ec606a7de8171e902266f81ef4ae09ed258861fc048522dd0a53f22cc317
|
data/README.md
CHANGED
@@ -566,14 +566,17 @@ name in opposite to Jasmine).
|
|
566
566
|
#### Jenkins CI integration
|
567
567
|
|
568
568
|
You can use the Cobertura format to bring coverage support to Jenkins CI, even that Guard::Jasmine has no built in
|
569
|
-
support for it. The trick is to
|
569
|
+
support for it. The trick is to post-process the coverage data with istanbul after the spec run:
|
570
570
|
|
571
571
|
```ruby
|
572
572
|
desc "Run all JavaScript specs with Istanbul"
|
573
573
|
task :jscov => :environment do
|
574
|
-
# Run Jasmine tests with code coverage on and generate Jenkins-compatible Jasmine code coverage
|
575
|
-
#
|
576
|
-
|
574
|
+
# Run Jasmine tests with code coverage on and generate Jenkins-compatible Jasmine code coverage report file.
|
575
|
+
# Must run assets:clean first to force re-compilation.
|
576
|
+
# Make sure to fail this task if there are unit test failures.
|
577
|
+
# For some reason does not work if run as separate exec's, so combine into one.
|
578
|
+
exec('rake assets:clean; guard-jasmine --coverage --coverage-html --coverage-summary; \
|
579
|
+
code=$?; if [ $code != "0" ]; then exit $code; fi; istanbul report cobertura')
|
577
580
|
end
|
578
581
|
```
|
579
582
|
|
@@ -625,45 +628,46 @@ Usage:
|
|
625
628
|
guard-jasmine spec
|
626
629
|
|
627
630
|
Options:
|
628
|
-
-s, [--server=SERVER]
|
629
|
-
|
630
|
-
|
631
|
-
-p, [--port=N]
|
632
|
-
|
633
|
-
[--verbose]
|
634
|
-
-e, [--server-env=SERVER_ENV]
|
635
|
-
|
636
|
-
[--server-timeout=N]
|
637
|
-
|
638
|
-
-b, [--bin=BIN]
|
639
|
-
-d, [--spec-dir=SPEC_DIR]
|
640
|
-
|
641
|
-
-u, [--url=URL]
|
642
|
-
|
643
|
-
-t, [--timeout=N]
|
644
|
-
|
645
|
-
|
646
|
-
[--console=CONSOLE]
|
647
|
-
|
648
|
-
|
649
|
-
[--errors=ERRORS]
|
650
|
-
|
651
|
-
|
652
|
-
[--focus]
|
653
|
-
|
654
|
-
[--specdoc=SPECDOC]
|
655
|
-
|
656
|
-
[--coverage]
|
657
|
-
[--coverage-html]
|
658
|
-
[--coverage-
|
659
|
-
[--
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
631
|
+
-s, [--server=SERVER] # Server to start, either `auto`, `webrick`, `mongrel`, `thin`, `puma`
|
632
|
+
# `unicorn`, `jasmine_gem` or `none`
|
633
|
+
# Default: auto
|
634
|
+
-p, [--port=N] # Server port to use
|
635
|
+
# Default: Random free port
|
636
|
+
[--verbose] # Show the server output in the console
|
637
|
+
-e, [--server-env=SERVER_ENV] # The server environment to use, for example `development`, `test` etc.
|
638
|
+
# Default: test
|
639
|
+
[--server-timeout=N] # The number of seconds to wait for the Jasmine spec server
|
640
|
+
# Default: 15
|
641
|
+
-b, [--bin=BIN] # The location of the PhantomJS binary
|
642
|
+
-d, [--spec-dir=SPEC_DIR] # The directory with the Jasmine specs
|
643
|
+
# Default: spec/javascripts
|
644
|
+
-u, [--url=URL] # The url of the Jasmine test runner_options
|
645
|
+
# Default: nil
|
646
|
+
-t, [--timeout=N] # The maximum time in milliseconds to wait for the spec
|
647
|
+
# runner to finish
|
648
|
+
# Default: 10000
|
649
|
+
[--console=CONSOLE] # Whether to show console.log statements in the spec runner,
|
650
|
+
# either `always`, `never` or `failure`
|
651
|
+
# Default: failure
|
652
|
+
[--errors=ERRORS] # Whether to show errors in the spec runner,
|
653
|
+
# either `always`, `never` or `failure`
|
654
|
+
# Default: failure
|
655
|
+
[--focus] # Specdoc focus to hide successful tests when at least one test fails
|
656
|
+
# Default: true
|
657
|
+
[--specdoc=SPECDOC] # Whether to show successes in the spec runner, either `always`, `never` or `failure`
|
658
|
+
# Default: always
|
659
|
+
[--coverage] # Whether to enable the coverage support or not
|
660
|
+
[--coverage-html] # Whether to generate html coverage report. Implies --coverage
|
661
|
+
[--coverage-html-dir=REPORT_DIR] # Where to save html coverage reports. Defaults to ./coverage. Implies --coverage-html
|
662
|
+
[--coverage-summary] # Whether to generate html coverage summary. Implies --coverage
|
663
|
+
[--statements-threshold=N] # Statements coverage threshold
|
664
|
+
# Default: 0
|
665
|
+
[--functions-threshold=N] # Functions coverage threshold
|
666
|
+
# Default: 0
|
667
|
+
[--branches-threshold=N] # Branches coverage threshold
|
668
|
+
# Default: 0
|
669
|
+
[--lines-threshold=N] # Lines coverage threshold
|
670
|
+
# Default: 0
|
667
671
|
Run the Jasmine spec runner
|
668
672
|
```
|
669
673
|
|
@@ -760,17 +764,9 @@ Given your configuration, you could also need to set:
|
|
760
764
|
There are many ways to get your Jasmine specs run within a headless environment. If Guard::Jasmine isn't for you,
|
761
765
|
I recommend to check out these other brilliant Jasmine runners:
|
762
766
|
|
763
|
-
|
764
|
-
|
765
|
-
* [
|
766
|
-
* [guard-jasmine-node][] automatically & intelligently executes Jasmine Node.js specs when files are modified.
|
767
|
-
* [guard-jessie][] allows to automatically run you Jasmine specs under Node.js using Jessie runner.
|
768
|
-
|
769
|
-
### Standalone
|
770
|
-
|
771
|
-
* [Evergreen][], runs CoffeeScript specs headless, but has no continuous testing support.
|
772
|
-
* [Jezebel][] a Node.js REPL and continuous test runner for [Jessie][], a Node runner for Jasmine, but has no full
|
773
|
-
featured browser environment.
|
767
|
+
* [guard-konacha][], Automatically run [konacha][] tests through Guard.
|
768
|
+
* [guard-teabag][], Guard-Teabag: Run Javascript tests with Guard and all the features of [Teabag][]
|
769
|
+
* [Karma][] spectacular Test Runner for JavaScript.
|
774
770
|
|
775
771
|
## How to file an issue
|
776
772
|
|
@@ -804,6 +800,16 @@ Pull requests are very welcome! Please try to follow these simple rules if appli
|
|
804
800
|
For questions please join us in our [Google group](http://groups.google.com/group/guard-dev) or on
|
805
801
|
`#guard` (irc.freenode.net).
|
806
802
|
|
803
|
+
### Open Commit Bit
|
804
|
+
|
805
|
+
Guard has an open commit bit policy: Anyone with an accepted pull request gets added as a repository collaborator.
|
806
|
+
Please try to follow these simple rules:
|
807
|
+
|
808
|
+
* Commit directly onto the master branch only for typos, improvements to the readme and documentation (please add
|
809
|
+
`[ci skip]` to the commit message).
|
810
|
+
* Create a feature branch and open a pull-request early for any new features to get feedback.
|
811
|
+
* Make sure you adhere to the general pull request rules above.
|
812
|
+
|
807
813
|
### The guard-jasmine-debug executable
|
808
814
|
|
809
815
|
This Guard comes with a small executable `guard-jasmine-debug` that can be used to run the Jasmine test runner on PhantomJS
|
@@ -885,14 +891,12 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
885
891
|
[CoffeeScript]: http://jashkenas.github.com/coffee-script/
|
886
892
|
[Rails 3.1 asset pipeline]: http://guides.rubyonrails.org/asset_pipeline.html
|
887
893
|
[Homebrew]: http://mxcl.github.com/homebrew/
|
888
|
-
[Jezebel]: https://github.com/benrady/jezebel
|
889
|
-
[Jessie]: https://github.com/futuresimple/jessie
|
890
|
-
[guard-jasmine-headless-webkit]: https://github.com/johnbintz/guard-jasmine-headless-webkit
|
891
|
-
[jasmine-headless-webkit]: https://github.com/johnbintz/jasmine-headless-webkit/
|
892
|
-
[Evergreen]: https://github.com/jnicklas/evergreen
|
893
894
|
[PhantomJS script]: https://github.com/netzpirat/guard-jasmine/blob/master/lib/guard/jasmine/phantomjs/guard-jasmine.coffee
|
894
895
|
[Guard::CoffeeScript]: https://github.com/guard/guard-coffeescript
|
895
896
|
[Sinon.JS]: http://sinonjs.org
|
896
|
-
[guard-jasmine-node]: https://github.com/guard/guard-jasmine-node
|
897
|
-
[guard-jessie]: https://github.com/guard/guard-jessie
|
898
897
|
[Rails asset pipeline]: http://guides.rubyonrails.org/asset_pipeline.html
|
898
|
+
[guard-konacha]: https://github.com/alexgb/guard-konacha
|
899
|
+
[konacha]: https://github.com/jfirebaugh/konacha
|
900
|
+
[Karma]: https://github.com/karma-runner/karma
|
901
|
+
[guard-teabag]: https://github.com/modeset/guard-teabag
|
902
|
+
[Teabag]: https://github.com/modeset/teabag
|
data/lib/guard/jasmine.rb
CHANGED
@@ -22,32 +22,33 @@ module Guard
|
|
22
22
|
attr_accessor :last_run_failed, :last_failed_paths, :run_all_options
|
23
23
|
|
24
24
|
DEFAULT_OPTIONS = {
|
25
|
-
server:
|
26
|
-
server_env:
|
27
|
-
server_timeout:
|
28
|
-
port:
|
29
|
-
rackup_config:
|
30
|
-
jasmine_url:
|
31
|
-
timeout:
|
32
|
-
spec_dir:
|
33
|
-
notification:
|
34
|
-
hide_success:
|
35
|
-
all_on_start:
|
36
|
-
keep_failed:
|
37
|
-
clean:
|
38
|
-
all_after_pass:
|
39
|
-
max_error_notify:
|
40
|
-
specdoc:
|
41
|
-
console:
|
42
|
-
errors:
|
43
|
-
focus:
|
44
|
-
coverage:
|
45
|
-
coverage_html:
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
25
|
+
server: :auto,
|
26
|
+
server_env: ENV['RAILS_ENV'] || 'development',
|
27
|
+
server_timeout: 60,
|
28
|
+
port: nil,
|
29
|
+
rackup_config: nil,
|
30
|
+
jasmine_url: nil,
|
31
|
+
timeout: 60,
|
32
|
+
spec_dir: nil,
|
33
|
+
notification: true,
|
34
|
+
hide_success: false,
|
35
|
+
all_on_start: true,
|
36
|
+
keep_failed: true,
|
37
|
+
clean: true,
|
38
|
+
all_after_pass: true,
|
39
|
+
max_error_notify: 3,
|
40
|
+
specdoc: :failure,
|
41
|
+
console: :failure,
|
42
|
+
errors: :failure,
|
43
|
+
focus: true,
|
44
|
+
coverage: false,
|
45
|
+
coverage_html: false,
|
46
|
+
coverage_html_dir: "./coverage",
|
47
|
+
coverage_summary: false,
|
48
|
+
statements_threshold: 0,
|
49
|
+
functions_threshold: 0,
|
50
|
+
branches_threshold: 0,
|
51
|
+
lines_threshold: 0
|
51
52
|
}
|
52
53
|
|
53
54
|
# Initialize Guard::Jasmine.
|
data/lib/guard/jasmine/cli.rb
CHANGED
@@ -107,6 +107,11 @@ module Guard
|
|
107
107
|
default: false,
|
108
108
|
desc: 'Whether to generate html coverage report. Implies --coverage'
|
109
109
|
|
110
|
+
method_option :coverage_html_dir,
|
111
|
+
type: :string,
|
112
|
+
default: "./coverage",
|
113
|
+
desc: 'Where to save html coverage reports. Defaults to ./coverage. Implies --coverage-html'
|
114
|
+
|
110
115
|
method_option :coverage_summary,
|
111
116
|
type: :boolean,
|
112
117
|
default: false,
|
@@ -138,31 +143,32 @@ module Guard
|
|
138
143
|
# @param [Array<String>] paths the name of the specs to run
|
139
144
|
#
|
140
145
|
def spec(*paths)
|
141
|
-
runner_options
|
142
|
-
runner_options[:port]
|
143
|
-
runner_options[:spec_dir]
|
144
|
-
runner_options[:server]
|
145
|
-
runner_options[:jasmine_url]
|
146
|
-
runner_options[:phantomjs_bin]
|
147
|
-
runner_options[:timeout]
|
148
|
-
runner_options[:verbose]
|
149
|
-
runner_options[:server_env]
|
150
|
-
runner_options[:server_timeout]
|
151
|
-
runner_options[:rackup_config]
|
152
|
-
runner_options[:console]
|
153
|
-
runner_options[:errors]
|
154
|
-
runner_options[:specdoc]
|
155
|
-
runner_options[:focus]
|
156
|
-
runner_options[:coverage]
|
157
|
-
runner_options[:coverage_html]
|
158
|
-
runner_options[:
|
159
|
-
runner_options[:
|
160
|
-
runner_options[:
|
161
|
-
runner_options[:
|
162
|
-
runner_options[:
|
163
|
-
runner_options[:
|
164
|
-
runner_options[:
|
165
|
-
runner_options[:
|
146
|
+
runner_options = {}
|
147
|
+
runner_options[:port] = options.port || CLI.find_free_server_port
|
148
|
+
runner_options[:spec_dir] = options.spec_dir || (File.exists?(File.join('spec', 'javascripts')) ? File.join('spec', 'javascripts') : 'spec')
|
149
|
+
runner_options[:server] = options.server.to_sym == :auto ? ::Guard::Jasmine::Server.detect_server(runner_options[:spec_dir]) : options.server.to_sym
|
150
|
+
runner_options[:jasmine_url] = options.url || "http://localhost:#{ runner_options[:port] }#{ options.server.to_sym == :jasmine_gem ? '/' : '/jasmine' }"
|
151
|
+
runner_options[:phantomjs_bin] = options.bin || CLI.which('phantomjs')
|
152
|
+
runner_options[:timeout] = options.timeout
|
153
|
+
runner_options[:verbose] = options.verbose
|
154
|
+
runner_options[:server_env] = options.server_env
|
155
|
+
runner_options[:server_timeout] = options.server_timeout
|
156
|
+
runner_options[:rackup_config] = options.rackup_config
|
157
|
+
runner_options[:console] = [:always, :never, :failure].include?(options.console.to_sym) ? options.console.to_sym : :failure
|
158
|
+
runner_options[:errors] = [:always, :never, :failure].include?(options.errors.to_sym) ? options.errors.to_sym : :failure
|
159
|
+
runner_options[:specdoc] = [:always, :never, :failure].include?(options.specdoc.to_sym) ? options.specdoc.to_sym : :always
|
160
|
+
runner_options[:focus] = options.focus
|
161
|
+
runner_options[:coverage] = options.coverage || options.coverage_html || options.coverage_summary || options.coverage_html_dir != "./coverage"
|
162
|
+
runner_options[:coverage_html] = options.coverage_html || options.coverage_html_dir != "./coverage"
|
163
|
+
runner_options[:coverage_html_dir] = options.coverage_html_dir
|
164
|
+
runner_options[:coverage_summary] = options.coverage_summary
|
165
|
+
runner_options[:statements_threshold] = options.statements_threshold
|
166
|
+
runner_options[:functions_threshold] = options.functions_threshold
|
167
|
+
runner_options[:branches_threshold] = options.branches_threshold
|
168
|
+
runner_options[:lines_threshold] = options.lines_threshold
|
169
|
+
runner_options[:notification] = false
|
170
|
+
runner_options[:hide_success] = true
|
171
|
+
runner_options[:max_error_notify] = 0
|
166
172
|
|
167
173
|
paths = [runner_options[:spec_dir]] if paths.empty?
|
168
174
|
|
data/lib/guard/jasmine/runner.rb
CHANGED
@@ -265,7 +265,7 @@ module Guard
|
|
265
265
|
check_coverage(options)
|
266
266
|
|
267
267
|
if options[:coverage_html]
|
268
|
-
generate_html_report
|
268
|
+
generate_html_report(options)
|
269
269
|
end
|
270
270
|
end
|
271
271
|
|
@@ -318,9 +318,12 @@ module Guard
|
|
318
318
|
# Uses the Istanbul text reported to output the result of the
|
319
319
|
# last coverage run.
|
320
320
|
#
|
321
|
-
|
322
|
-
|
323
|
-
|
321
|
+
# @param [Hash] options for the HTML report
|
322
|
+
#
|
323
|
+
def generate_html_report(options)
|
324
|
+
report_directory = coverage_report_directory(options)
|
325
|
+
`#{ which('istanbul') } report --dir #{ report_directory } --root #{ coverage_root } html #{ coverage_file }`
|
326
|
+
Formatter.info "Updated HTML report available at: #{ report_directory }/index.html"
|
324
327
|
end
|
325
328
|
|
326
329
|
# Uses the Istanbul text-summary reporter to output the
|
@@ -628,6 +631,15 @@ module Guard
|
|
628
631
|
def coverage_root
|
629
632
|
File.expand_path(File.join('tmp', 'coverage'))
|
630
633
|
end
|
634
|
+
|
635
|
+
# Creates and returns the coverage report directory.
|
636
|
+
#
|
637
|
+
# @param [Hash] options for the coverage report directory
|
638
|
+
# @return [String] the coverage report directory
|
639
|
+
#
|
640
|
+
def coverage_report_directory(options)
|
641
|
+
File.expand_path(options[:coverage_html_dir])
|
642
|
+
end
|
631
643
|
end
|
632
644
|
end
|
633
645
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: guard-jasmine
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.16.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michael Kessler
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-05-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: tilt
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: bundler
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|