jasmine 2.4.0 → 2.5.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff37a8a0b4e7f15fb350194406360300f16c145d
4
- data.tar.gz: 294bf35be0b19f6db43c4dde6197d31a954563db
3
+ metadata.gz: 992b7f642738d2f5c0e197262e7385c3cdc863c5
4
+ data.tar.gz: 4ebd0b1ab88fe4d24f6d225e78ed56f8a78b0fe5
5
5
  SHA512:
6
- metadata.gz: afb5493aeb86c4cc6347bb0b214c67d4a1eedb7ac05b4e5cdef3e0441f121c8b5366e1a83b22310ddcc04c9310778ed87302344b60ddb48ed05811fd4cdd3ebe
7
- data.tar.gz: 8406f91af81474b6089da889fd55c9fef374e3d6572443abe405c1e85af8e0743f3c37618e89937901db481b279a23cc2b4cf1a5ae18e116d8f26e4257c2dbe4
6
+ metadata.gz: c3fa659eacfe55b0b62c315aacc145518d5ef650fe73c129238080110c7a90efd9dc3489c0a2e382b4f84465d8ec4db9077199a76524729fff0bedce47f53c1a
7
+ data.tar.gz: a47b688b3a447d752216588f6e5db29b5e3afa827dd454fccc148de75c46ce3271eaefeaefc6ed6732d94db0ae36b8f8b82dc7e2eb641c41078bff913190a678
data/Gemfile CHANGED
@@ -5,7 +5,7 @@ gemspec
5
5
  gem 'anchorman', :platform => :mri
6
6
  # during development, do not release
7
7
  if ENV['TRAVIS']
8
- gem 'jasmine-core', :git => 'http://github.com/pivotal/jasmine.git'
8
+ gem 'jasmine-core', :git => 'http://github.com/jasmine/jasmine.git'
9
9
  else
10
10
  gem 'jasmine-core', :path => '../jasmine'
11
11
  end
@@ -16,6 +16,8 @@ else
16
16
  gem 'rack', '1.5.2'
17
17
  end
18
18
 
19
+ gem 'mime-types', '< 3.0', platform: [:mri_19, :jruby]
20
+
19
21
  platform :rbx do
20
22
  gem 'json'
21
23
  gem 'rubysl'
@@ -21,9 +21,9 @@ end
21
21
 
22
22
  To initialize a rails project for Jasmine
23
23
 
24
- rails g jasmine:install
24
+ rails generate jasmine:install
25
25
 
26
- rails g jasmine:examples
26
+ rails generate jasmine:examples
27
27
 
28
28
  For any other project (Sinatra, Merb, or something we don't yet know about) use
29
29
 
@@ -45,7 +45,11 @@ For Continuous Integration environments, add this task to the project build step
45
45
 
46
46
  This uses PhantomJS to load and run the Jasmine suite.
47
47
 
48
- Please note that PhantomJS will be auto-installed by the [phantomjs-gem][phantomjs-gem] at the first `rake jasmine:ci` run. If you have a matching PhantomJS version somewhere on your path, it won't install. You can disable automatic installation altogether (and use the PhantomJS on your path) via the config helper.
48
+ Please note that PhantomJS will be auto-installed by the [phantomjs-gem][phantomjs-gem] at the first `rake jasmine:ci` run. If you have a matching PhantomJS version somewhere on your path, it won't install. You can disable automatic installation altogether (and use the PhantomJS on your path) via the config helper in your jasmine_helper.rb:
49
+
50
+ Jasmine.configure do |config|
51
+ config.prevent_phantom_js_auto_install = true
52
+ end
49
53
 
50
54
  [phantomjs-gem]: https://github.com/colszowka/phantomjs-gem#phantomjs-as-a-rubygem
51
55
 
@@ -59,7 +63,7 @@ Alternatively, you may specify the path to your `jasmine.yml` by setting an envi
59
63
  `rake jasmine:ci JASMINE_CONFIG_PATH=relative/path/to/your/jasmine.yml`
60
64
 
61
65
  In addition, the `spec_helper` key in your jasmine.yml specifies the path to a ruby file that can do programmatic configuration.
62
- After running `jasmine init` or `rails g jasmine:install` it will point to `spec/javascripts/support/jasmine_helper.rb` which you can modify to fit your needs.
66
+ After running `jasmine init` or `rails generate jasmine:install` it will point to `spec/javascripts/support/jasmine_helper.rb` which you can modify to fit your needs.
63
67
 
64
68
  ### Running Jasmine on a different port
65
69
 
@@ -33,7 +33,7 @@ Gem::Specification.new do |s|
33
33
  s.add_development_dependency 'rspec', '>= 2.5.0'
34
34
  s.add_development_dependency 'nokogiri'
35
35
 
36
- s.add_dependency 'jasmine-core', '~> 2.4'
36
+ s.add_dependency 'jasmine-core', '~> 2.5'
37
37
  s.add_dependency 'rack', '>= 1.2.1'
38
38
  s.add_dependency 'rake'
39
39
  s.add_dependency 'phantomjs'
@@ -8,7 +8,7 @@
8
8
  # src_files:
9
9
  # - lib/source1.js
10
10
  # - lib/source2.js
11
- # - dist/**/*.js
11
+ # - 'dist/**/*.js'
12
12
  #
13
13
  src_files:
14
14
  - assets/application.js
@@ -22,7 +22,7 @@ src_files:
22
22
  #
23
23
  # stylesheets:
24
24
  # - css/style.css
25
- # - stylesheets/*.css
25
+ # - 'stylesheets/*.css'
26
26
  #
27
27
  stylesheets:
28
28
  - assets/application.css
@@ -35,7 +35,7 @@ stylesheets:
35
35
  # EXAMPLE:
36
36
  #
37
37
  # helpers:
38
- # - helpers/**/*.js
38
+ # - 'helpers/**/*.js'
39
39
  #
40
40
  helpers:
41
41
  - 'helpers/**/*.js'
@@ -48,7 +48,7 @@ helpers:
48
48
  # EXAMPLE:
49
49
  #
50
50
  # spec_files:
51
- # - **/*[sS]pec.js
51
+ # - '**/*[sS]pec.js'
52
52
  #
53
53
  spec_files:
54
54
  - '**/*[sS]pec.js'
@@ -1,15 +1,16 @@
1
- #Use this file to set/override Jasmine configuration options
2
- #You can remove it if you don't need it.
3
- #This file is loaded *after* jasmine.yml is interpreted.
1
+ # Use this file to set/override Jasmine configuration options
2
+ # You can remove it if you don't need it.
3
+ # This file is loaded *after* jasmine.yml is interpreted.
4
4
  #
5
- #Example: using a different boot file.
6
- #Jasmine.configure do |config|
7
- # config.boot_dir = '/absolute/path/to/boot_dir'
8
- # config.boot_files = lambda { ['/absolute/path/to/boot_dir/file.js'] }
9
- #end
10
- #
11
- #Example: prevent PhantomJS auto install, uses PhantomJS already on your path.
12
- #Jasmine.configure do |config|
13
- # config.prevent_phantom_js_auto_install = true
14
- #end
5
+ # Example: using a different boot file.
6
+ # Jasmine.configure do |config|
7
+ # config.boot_dir = '/absolute/path/to/boot_dir'
8
+ # config.boot_files = lambda { ['/absolute/path/to/boot_dir/file.js'] }
9
+ # end
15
10
  #
11
+ # Example: prevent PhantomJS auto install, uses PhantomJS already on your path.
12
+ Jasmine.configure do |config|
13
+ if ENV['TRAVIS']
14
+ config.prevent_phantom_js_auto_install = true
15
+ end
16
+ end
@@ -108,7 +108,9 @@ module Jasmine
108
108
  config.css_files = lambda { yaml_config.css_files }
109
109
 
110
110
  config.spec_dir = yaml_config.spec_dir
111
- config.spec_files = lambda { yaml_config.helpers + yaml_config.spec_files }
111
+ config.helper_files = yaml_config.helpers
112
+ config.spec_files = yaml_config.spec_files
113
+ config.testing_files = lambda { config.helper_files + config.spec_files }
112
114
 
113
115
  config.show_console_log = yaml_config.show_console_log
114
116
  config.stop_spec_on_expectation_failure = yaml_config.stop_spec_on_expectation_failure
@@ -123,4 +125,10 @@ module Jasmine
123
125
  end
124
126
  end
125
127
 
128
+ def self.load_spec(spec_path)
129
+ return if spec_path.nil?
130
+ Jasmine.configure do |c|
131
+ c.spec_files = [spec_path]
132
+ end
133
+ end
126
134
  end
@@ -1,8 +1,9 @@
1
1
  module Jasmine
2
2
  class Configuration
3
3
  attr_writer :jasmine_css_files, :css_files
4
- attr_writer :jasmine_files, :boot_files, :src_files, :spec_files, :runner_boot_files
5
- attr_accessor :jasmine_path, :spec_path, :boot_path, :src_path, :image_path, :runner_boot_path
4
+ attr_writer :jasmine_files, :boot_files, :src_files, :runner_boot_files
5
+ attr_accessor :helper_files, :spec_files, :testing_files
6
+ attr_accessor :jasmine_path, :spec_path, :boot_path, :src_path, :image_path, :runner_boot_path, :helper_files
6
7
  attr_accessor :jasmine_dir, :spec_dir, :boot_dir, :src_dir, :images_dir, :runner_boot_dir
7
8
  attr_accessor :formatters
8
9
  attr_accessor :host
@@ -27,7 +28,7 @@ module Jasmine
27
28
  @boot_files = lambda { [] }
28
29
  @runner_boot_files = lambda { [] }
29
30
  @src_files = lambda { [] }
30
- @spec_files = lambda { [] }
31
+ @testing_files = lambda { [] }
31
32
  @runner = lambda { |config| }
32
33
  @rack_options = {}
33
34
  @show_console_log = false
@@ -50,7 +51,7 @@ module Jasmine
50
51
  map(@boot_files, :boot) +
51
52
  map(@runner_boot_files, :runner_boot) +
52
53
  map(@src_files, :src) +
53
- map(@spec_files, :spec)
54
+ map(@testing_files, :spec)
54
55
  end
55
56
 
56
57
  def rack_path_map
@@ -14,6 +14,8 @@ module Jasmine
14
14
  def done(run_details)
15
15
  outputter.puts
16
16
 
17
+ global_failure_details(run_details)
18
+
17
19
  failure_count = results.count(&:failed?)
18
20
  if failure_count > 0
19
21
  outputter.puts('Failures:')
@@ -50,6 +52,15 @@ module Jasmine
50
52
  results.select(&:pending?).map { |spec| pending_message(spec) }.join("\n\n")
51
53
  end
52
54
 
55
+ def global_failure_details(run_details)
56
+ fails = run_details.fetch('failedExpectations', [])
57
+ if fails.size > 0
58
+ fail_result = Jasmine::Result.new('fullName' => 'Error occurred in afterAll', 'description' => '', 'failedExpectations' => fails)
59
+ outputter.puts(failure_message(fail_result))
60
+ outputter.puts
61
+ end
62
+ end
63
+
53
64
  def chars(results)
54
65
  results.map do |result|
55
66
  if result.succeeded?
@@ -3,6 +3,7 @@ module Jasmine
3
3
  class ExitCode
4
4
  def initialize
5
5
  @results = []
6
+ @global_failure = false
6
7
  end
7
8
 
8
9
  def format(results)
@@ -10,14 +11,11 @@ module Jasmine
10
11
  end
11
12
 
12
13
  def done(details)
13
- end
14
-
15
- def exit_code
16
- @results.detect(&:failed?) ? 1 : 0
14
+ @global_failure = details.fetch('failedExpectations', []).size > 0
17
15
  end
18
16
 
19
17
  def succeeded?
20
- !@results.detect(&:failed?)
18
+ !@results.detect(&:failed?) && !@global_failure
21
19
  end
22
20
  end
23
21
  end
@@ -13,7 +13,8 @@
13
13
  }
14
14
 
15
15
  var page = require('webpage').create();
16
-
16
+ configScript = configScript.replace(/['"]{2}/,"");
17
+
17
18
  if (configScript !== '') {
18
19
  try {
19
20
  require(configScript).configure(page);
@@ -14,7 +14,7 @@ module Jasmine
14
14
 
15
15
  def run
16
16
  phantom_script = File.join(File.dirname(__FILE__), 'phantom_jasmine_run.js')
17
- command = "#{phantom_js_path} '#{phantom_script}' \"#{jasmine_server_url}\" #{show_console_log} '#{@phantom_config_script}'"
17
+ command = "\"#{phantom_js_path}\" \"#{phantom_script}\" \"#{jasmine_server_url}\" \"#{show_console_log}\" \"#{@phantom_config_script}\""
18
18
  run_details = { 'random' => false }
19
19
  IO.popen(command) do |output|
20
20
  output.each do |line|
@@ -10,7 +10,7 @@ once. This should be done for you automatically if you installed jasmine's rake
10
10
  with either 'jasmine init' or 'rails g jasmine:install'.
11
11
 
12
12
 
13
- EOF
13
+ EOF
14
14
  raise Exception.new(message)
15
15
  end
16
16
 
@@ -43,6 +43,14 @@ namespace :jasmine do
43
43
 
44
44
  desc 'Run jasmine tests in a browser, random and seed override config'
45
45
  task :ci, [:random, :seed] => %w(jasmine:require_json jasmine:require jasmine:configure jasmine:configure_plugins) do |t, args|
46
+ if ENV['spec']
47
+ spec_path = ENV['spec'].dup
48
+ if spec_path.include? "spec/javascripts/" # crappy hack to allow for bash tab completion
49
+ spec_path.slice! "spec/javascripts/"
50
+ end
51
+ Jasmine.load_spec(spec_path)
52
+ end
53
+
46
54
  ci_runner = Jasmine::CiRunner.new(Jasmine.config, args.to_hash)
47
55
  exit(1) unless ci_runner.run
48
56
  end
@@ -1,3 +1,3 @@
1
1
  module Jasmine
2
- VERSION = "2.4.0"
2
+ VERSION = "2.5.0"
3
3
  end
@@ -0,0 +1,35 @@
1
+ # Jasmine Gem 2.5.0 Release Notes
2
+
3
+ ## Summary
4
+
5
+ This release updated the jasmine-core dependency to 2.5.0. See the
6
+ [jasmine-core release notes](https://github.com/jasmine/jasmine/blob/master/release_notes/2.5.0.md)
7
+ for more information
8
+
9
+ ## Changes
10
+
11
+ * Update rails examples to spell out `generate`
12
+ - Fixes [#270](https://github.com/jasmine/jasmine-gem/issues/270)
13
+
14
+ * Update commented examples to be valid yaml
15
+ - Fixes [#266](https://github.com/jasmine/jasmine-gem/issues/266)
16
+
17
+ * Document non auto install configuration
18
+ - Merges [#264](https://github.com/jasmine/jasmine-gem/issues/264) from @eric-hu
19
+
20
+ * Clean up helper output
21
+ - Merges [#263](https://github.com/jasmine/jasmine-gem/issues/263) from @salbertson
22
+
23
+ * Fix for windows phantom execution
24
+ - Merges [#260](https://github.com/jasmine/jasmine-gem/issues/260) from @pf-bajorek
25
+
26
+ * Report failures in global afterAll
27
+ - Fixes [#811](https://github.com/jasmine/jasmine-gem/issues/811)
28
+
29
+ * Add functionality to specify specific suites to run
30
+ - Fixes [#234](https://github.com/jasmine/jasmine-gem/issues/234)
31
+ - Merges [#251](https://github.com/jasmine/jasmine-gem/issues/251) from @hwayne
32
+
33
+ ------
34
+
35
+ _Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_
@@ -11,4 +11,23 @@ describe Jasmine do
11
11
  File.should_receive(:expand_path) { |path| path }
12
12
  Jasmine.root('subdir1', 'subdir2').should == File.join('lib/jasmine', 'subdir1', 'subdir2')
13
13
  end
14
+ describe '#load_spec' do
15
+ it 'assigns the spec to the spec path' do
16
+ Jasmine.load_spec("spec/test")
17
+ Jasmine.config.spec_files.should == [ "spec/test" ]
18
+ end
19
+
20
+ it 'does not assign a spec path if passed a nil' do
21
+ Jasmine.load_spec("spec/test")
22
+ Jasmine.load_spec(nil)
23
+ Jasmine.config.spec_files.should == [ "spec/test" ]
24
+ end
25
+
26
+ it 'does not override nonspec files' do
27
+ Jasmine.config.helper_files = ["aaa"]
28
+ Jasmine.load_spec("spec/test")
29
+ Jasmine.config.spec_files.should == [ "spec/test" ]
30
+ Jasmine.config.helper_files.should == ["aaa"]
31
+ end
32
+ end
14
33
  end
@@ -70,7 +70,7 @@ describe Jasmine::Configuration do
70
70
  config.jasmine_files = lambda { %w(jasmine) }
71
71
  config.src_files = lambda { %w(src) }
72
72
  config.boot_files = lambda { %w(boot) }
73
- config.spec_files = lambda { %w(spec) }
73
+ config.testing_files = lambda { %w(spec) }
74
74
  config.js_files.should == %w(
75
75
  mapped_jasmine/jasmine/jasmine
76
76
  mapped_boot/boot/boot mapped_src/src/src
@@ -165,6 +165,17 @@ describe Jasmine::Formatters::Console do
165
165
  outputter_output.should match(/Randomized with seed 4325/)
166
166
  end
167
167
  end
168
+
169
+ describe 'with errors in a global afterAll' do
170
+ it 'should show the errors' do
171
+ console = Jasmine::Formatters::Console.new(outputter)
172
+ console.done({ 'failedExpectations' => [{ 'message' => 'Global Failure', 'stack' => 'more info' }] })
173
+
174
+ expect(outputter_output).to match(/Error occurred in afterAll/)
175
+ expect(outputter_output).to match(/Global Failure/)
176
+ expect(outputter_output).to match(/more info/)
177
+ end
178
+ end
168
179
  end
169
180
 
170
181
  def failing_result
@@ -0,0 +1,34 @@
1
+ require 'spec_helper'
2
+
3
+ describe Jasmine::Formatters::ExitCode do
4
+ subject(:formatter) { Jasmine::Formatters::ExitCode.new }
5
+
6
+ it 'is successful with no results' do
7
+ formatter.done({})
8
+ expect(formatter).to be_succeeded
9
+ end
10
+
11
+ it 'is unsuccessful with a failure' do
12
+ formatter.format([double(:result, failed?: true)])
13
+ formatter.done({})
14
+ expect(formatter).not_to be_succeeded
15
+ end
16
+
17
+ it 'finds a single failure to cause the error' do
18
+ formatter.format([double(failed?: false), double(failed?: false), double(failed?: true), double(failed?: false)])
19
+ formatter.done({})
20
+ expect(formatter).not_to be_succeeded
21
+ end
22
+
23
+ it 'is unsuccessful with a failedExpectation in done' do
24
+ formatter.done({
25
+ 'failedExpectations' => [{}]
26
+ })
27
+ expect(formatter).not_to be_succeeded
28
+ end
29
+
30
+ it 'is still successful with empty failedExpectations in done' do
31
+ formatter.done({ 'failedExpectations' => [] })
32
+ expect(formatter).to be_succeeded
33
+ end
34
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jasmine
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 2.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rajan Agaskar
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2015-12-03 00:00:00.000000000 Z
13
+ date: 2016-08-31 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rails
@@ -88,14 +88,14 @@ dependencies:
88
88
  requirements:
89
89
  - - "~>"
90
90
  - !ruby/object:Gem::Version
91
- version: '2.4'
91
+ version: '2.5'
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
- version: '2.4'
98
+ version: '2.5'
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: rack
101
101
  requirement: !ruby/object:Gem::Requirement
@@ -211,6 +211,7 @@ files:
211
211
  - release_notes/v2.3.0.md
212
212
  - release_notes/v2.3.1.md
213
213
  - release_notes/v2.4.0.md
214
+ - release_notes/v2.5.0.md
214
215
  - spec/application_integration_spec.rb
215
216
  - spec/application_spec.rb
216
217
  - spec/base_spec.rb
@@ -232,6 +233,7 @@ files:
232
233
  - spec/jasmine_pojs_spec.rb
233
234
  - spec/jasmine_rails_spec.rb
234
235
  - spec/lib/jasmine/formatters/console_spec.rb
236
+ - spec/lib/jasmine/formatters/exit_code_spec.rb
235
237
  - spec/lib/jasmine/formatters/multi_spec.rb
236
238
  - spec/page_spec.rb
237
239
  - spec/path_expander_spec.rb
@@ -289,6 +291,7 @@ test_files:
289
291
  - spec/jasmine_pojs_spec.rb
290
292
  - spec/jasmine_rails_spec.rb
291
293
  - spec/lib/jasmine/formatters/console_spec.rb
294
+ - spec/lib/jasmine/formatters/exit_code_spec.rb
292
295
  - spec/lib/jasmine/formatters/multi_spec.rb
293
296
  - spec/page_spec.rb
294
297
  - spec/path_expander_spec.rb