jasmine-headless-webkit 0.8.4 → 0.9.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +16 -8
- data/Guardfile +6 -1
- data/Rakefile +2 -1
- data/config/cucumber.yml +2 -0
- data/ext/jasmine-webkit-specrunner/Page.cpp +2 -3
- data/ext/jasmine-webkit-specrunner/Page.h +1 -0
- data/ext/jasmine-webkit-specrunner/Runner.cpp +37 -16
- data/ext/jasmine-webkit-specrunner/Runner.h +15 -5
- data/ext/jasmine-webkit-specrunner/specrunner.cpp +17 -7
- data/features/bin/failure.feature +7 -0
- data/features/bin/files.feature +7 -0
- data/features/bin/filtered_run/both_runs.feature +18 -0
- data/features/bin/filtered_run/no_full_run.feature +14 -0
- data/features/bin/help.feature +7 -0
- data/features/bin/quiet_messages.feature +8 -0
- data/features/bin/runner_out.feature +8 -0
- data/features/bin/spec_files_with_same_basename.feature +7 -0
- data/features/bin/success.feature +20 -0
- data/features/bin/success_with_js_error.feature +5 -0
- data/features/bin/tries_to_leave_page.feature +7 -0
- data/features/bin/try_to_click_a_button.feature +7 -0
- data/features/bin/two_files_from_src_files.feature +11 -0
- data/features/bin/with_coffeescript_error.feature +7 -0
- data/features/bin/with_console_log.feature +7 -0
- data/features/bin/with_server.feature +7 -0
- data/features/bin/with_window_prompt.feature +7 -0
- data/features/reporters.feature +24 -0
- data/features/runner.feature +34 -0
- data/features/steps/given/i_have_test_suite.rb +2 -0
- data/features/steps/given/no_existing_file.rb +4 -0
- data/features/steps/given/options/i_have_defaults.rb +4 -0
- data/features/steps/given/options/i_have_reporters.rb +10 -0
- data/features/steps/given/options/i_have_runner_options.rb +3 -0
- data/features/steps/then/bin/exit_status_should_be.rb +3 -0
- data/features/steps/then/bin/file_should_contain_runner.rb +4 -0
- data/features/steps/then/bin/following_files_loaded_in_order.rb +10 -0
- data/features/steps/then/bin/i_should_get_help_output.rb +4 -0
- data/features/steps/then/bin/output_should_include.rb +3 -0
- data/features/steps/then/bin/output_should_not_include.rb +4 -0
- data/features/steps/then/reporting/report_does_not_exist.rb +4 -0
- data/features/steps/then/reporting/report_should_exist.rb +3 -0
- data/features/steps/then/reporting/report_should_have.rb +7 -0
- data/features/steps/then/reporting/report_should_have_seed.rb +4 -0
- data/features/steps/then/runner/it_should_have_exit_status.rb +3 -0
- data/features/steps/then/runner/it_should_include_report_file.rb +4 -0
- data/features/steps/then/runner/it_should_not_include_report_file.rb +3 -0
- data/features/steps/then/templates/it_should_use_reporter.rb +6 -0
- data/features/steps/when/i_delete_file.rb +3 -0
- data/features/steps/when/i_get_runner.rb +4 -0
- data/features/steps/when/i_get_template_writer.rb +4 -0
- data/features/steps/when/i_run_executable.rb +4 -0
- data/features/steps/when/i_run_runner.rb +4 -0
- data/features/support/env.rb +7 -0
- data/lib/jasmine/headless/file_checker.rb +7 -3
- data/lib/jasmine/headless/files_list.rb +46 -19
- data/lib/jasmine/headless/options.rb +113 -5
- data/lib/jasmine/headless/report.rb +6 -1
- data/lib/jasmine/headless/report_message/console.rb +2 -4
- data/lib/jasmine/headless/report_message/seed.rb +14 -0
- data/lib/jasmine/headless/report_message/spec.rb +3 -5
- data/lib/jasmine/headless/report_message.rb +1 -0
- data/lib/jasmine/headless/runner.rb +169 -28
- data/lib/jasmine/headless/task.rb +0 -14
- data/lib/jasmine/headless/template_writer.rb +28 -4
- data/lib/jasmine/headless/unique_asset_list.rb +1 -1
- data/lib/jasmine/headless/version.rb +1 -1
- data/lib/jasmine/headless.rb +18 -0
- data/lib/jasmine-headless-webkit.rb +0 -4
- data/script/hooks/post-commit +4 -0
- data/script/hooks/pre-commit +2 -2
- data/script/initialize-environment +1 -1
- data/skel/template.html.erb +31 -2
- data/spec/jasmine/noisy/file.js.erb +0 -0
- data/spec/jasmine/noisy/noisy.yml +8 -0
- data/spec/jasmine/noisy/other_file.js +2 -0
- data/spec/jasmine/two_files_from_src_files/app/app-file.js +0 -0
- data/spec/jasmine/two_files_from_src_files/app/app.js +2 -0
- data/spec/jasmine/two_files_from_src_files/jasmine.yml +7 -0
- data/spec/jasmine/two_files_from_src_files/vendor/vendor-file.js +0 -0
- data/spec/jasmine/two_files_from_src_files/vendor/vendor.js +2 -0
- data/spec/jasmine/two_spec_files_same_basename/jasmine.yml +6 -0
- data/spec/jasmine/two_spec_files_same_basename/spec.coffee +4 -0
- data/spec/jasmine/two_spec_files_same_basename/spec.js +6 -0
- data/spec/jasmine/window_prompt/source.js +2 -0
- data/spec/jasmine/window_prompt/window_prompt.yml +4 -0
- data/spec/javascripts/headless_reporter_result_spec.coffee +22 -6
- data/spec/javascripts/helpers/spec_helper.coffee +2 -0
- data/spec/javascripts/{jasmine.HeadlessConsoleReporter_spec.coffee → jasmine-extensions_spec.coffee} +0 -35
- data/spec/javascripts/jasmine.HeadlessReporter.ConsoleBase_spec.coffee +35 -0
- data/spec/javascripts/jasmine.HeadlessReporter.Console_spec.coffee +3 -0
- data/spec/javascripts/jasmine.HeadlessReporter.Tap_spec.coffee +19 -0
- data/spec/javascripts/jasmine.HeadlessReporter_spec.coffee +27 -0
- data/spec/javascripts/support/jasmine.yml +6 -5
- data/spec/lib/jasmine/headless/file_checker_spec.rb +25 -9
- data/spec/lib/jasmine/headless/files_list_spec.rb +132 -158
- data/spec/lib/jasmine/headless/options_spec.rb +77 -0
- data/spec/lib/jasmine/headless/report_message/seed_spec.rb +18 -0
- data/spec/lib/jasmine/headless/report_spec.rb +16 -0
- data/spec/lib/jasmine/headless/runner_spec.rb +110 -33
- data/spec/lib/jasmine/headless/template_writer_spec.rb +31 -27
- data/spec/lib/jasmine/headless/unique_asset_list_spec.rb +3 -3
- data/spec/lib/jasmine/headless_spec.rb +36 -0
- data/spec/skel/template.html.erb_spec.rb +8 -0
- data/vendor/assets/coffeescripts/prolog.coffee +48 -21
- data/vendor/assets/javascripts/headless_reporter_result.js +3 -0
- data/vendor/assets/{coffeescripts → javascripts}/intense.coffee +0 -0
- data/vendor/assets/{coffeescripts → javascripts}/jasmine-extensions.coffee +4 -10
- data/vendor/assets/javascripts/jasmine.HeadlessReporter.Console.coffee +8 -0
- data/vendor/assets/javascripts/jasmine.HeadlessReporter.ConsoleBase.coffee +92 -0
- data/vendor/assets/javascripts/jasmine.HeadlessReporter.File.coffee +24 -0
- data/vendor/assets/javascripts/jasmine.HeadlessReporter.Tap.coffee +28 -0
- data/vendor/assets/javascripts/jasmine.HeadlessReporter.Verbose.coffee +64 -0
- data/vendor/assets/javascripts/jasmine.HeadlessReporter.coffee +58 -0
- data/vendor/assets/javascripts/prolog.js +44 -27
- metadata +157 -31
- data/ext/jasmine-webkit-specrunner/jasmine-webkit-specrunner.pro +0 -19
- data/lib/digest/jasmine_test.rb +0 -20
- data/spec/bin/jasmine-headless-webkit_spec.rb +0 -142
- data/vendor/assets/coffeescripts/jasmine.HeadlessConsoleReporter.coffee +0 -118
- data/vendor/assets/javascripts/intense.js +0 -44
- data/vendor/assets/javascripts/jasmine-extensions.js +0 -129
- data/vendor/assets/javascripts/jasmine.HeadlessConsoleReporter.js +0 -136
@@ -0,0 +1,19 @@
|
|
1
|
+
describe 'jasmine.HeadlessReporter.Tap', ->
|
2
|
+
beforeEach ->
|
3
|
+
@reporter = new jasmine.HeadlessReporter.Tap()
|
4
|
+
|
5
|
+
describe '#reportRunnerResults', ->
|
6
|
+
it 'should write nothing for nothing', ->
|
7
|
+
@reporter.output = []
|
8
|
+
|
9
|
+
@reporter.reportRunnerResults(null)
|
10
|
+
|
11
|
+
expect(@reporter.output[0]).not.toBeDefined()
|
12
|
+
|
13
|
+
it 'should report the length right', ->
|
14
|
+
@reporter.output = [ 'test' ]
|
15
|
+
|
16
|
+
@reporter.reportRunnerResults(null)
|
17
|
+
|
18
|
+
expect(@reporter.output[0]).toEqual('1..1')
|
19
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
describe 'jasmine.HeadlessReporter', ->
|
2
|
+
reporter = null
|
3
|
+
|
4
|
+
beforeEach ->
|
5
|
+
reporter = new jasmine.HeadlessReporter()
|
6
|
+
|
7
|
+
it 'should stop running specs if there are errors reported', ->
|
8
|
+
# otherwise it gets really confusing!
|
9
|
+
|
10
|
+
suite = { finish: -> null }
|
11
|
+
spec = new jasmine.Spec("env", suite, "test")
|
12
|
+
|
13
|
+
spyOn(reporter, 'hasError').andReturn(true)
|
14
|
+
spyOn(spec, 'finish')
|
15
|
+
spyOn(suite, 'finish')
|
16
|
+
|
17
|
+
reporter.reportSpecStarting(spec)
|
18
|
+
|
19
|
+
expect(spec.finish).toHaveBeenCalled()
|
20
|
+
expect(suite.finish).toHaveBeenCalled()
|
21
|
+
|
22
|
+
describe '#reportRunnerStarting', ->
|
23
|
+
it 'should start getting time', ->
|
24
|
+
expect(reporter.startTime).not.toBeDefined()
|
25
|
+
reporter.reportRunnerStarting("runner")
|
26
|
+
expect(reporter.startTime).toBeDefined()
|
27
|
+
|
@@ -1,8 +1,9 @@
|
|
1
1
|
src_files:
|
2
|
-
- '
|
3
|
-
- 'vendor/assets/coffeescripts/*.coffee'
|
2
|
+
- '**/*'
|
4
3
|
|
5
|
-
spec_files: [ '
|
6
|
-
src_dir:
|
7
|
-
spec_dir:
|
4
|
+
spec_files: [ '**/*_spec.coffee' ]
|
5
|
+
src_dir: vendor/assets/javascripts
|
6
|
+
spec_dir: spec/javascripts
|
7
|
+
helpers:
|
8
|
+
- 'helpers/**.*'
|
8
9
|
|
@@ -1,25 +1,41 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
3
|
describe Jasmine::Headless::FileChecker do
|
4
|
-
include FakeFS::SpecHelpers
|
5
|
-
|
6
4
|
let(:test_class) do
|
7
5
|
object = Object.new
|
8
6
|
object.class.send(:include, Jasmine::Headless::FileChecker)
|
9
7
|
object
|
10
8
|
end
|
11
9
|
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
describe "#bad_format?" do
|
11
|
+
subject { test_class.bad_format?(file) }
|
12
|
+
|
13
|
+
before do
|
14
|
+
test_class.stubs(:excluded_formats).returns(%w{erb string})
|
15
|
+
end
|
16
|
+
|
17
|
+
context 'nil' do
|
18
|
+
let(:file) { nil }
|
19
|
+
|
20
|
+
it { should be_nil }
|
15
21
|
end
|
16
22
|
|
17
|
-
|
18
|
-
|
23
|
+
context 'allowed format' do
|
24
|
+
let(:file) { 'foobar.js' }
|
25
|
+
|
26
|
+
it { should be_false }
|
19
27
|
end
|
20
28
|
|
21
|
-
|
22
|
-
|
29
|
+
context 'unallowed format' do
|
30
|
+
let(:file) { 'foobar.erb' }
|
31
|
+
|
32
|
+
it { should be_true }
|
33
|
+
end
|
34
|
+
|
35
|
+
context 'check whole extension' do
|
36
|
+
let(:file) { 'foobar.string.js' }
|
37
|
+
|
38
|
+
it { should be_true }
|
23
39
|
end
|
24
40
|
end
|
25
41
|
end
|
@@ -5,50 +5,6 @@ require 'coffee-script'
|
|
5
5
|
describe Jasmine::Headless::FilesList do
|
6
6
|
let(:files_list) { described_class.new }
|
7
7
|
|
8
|
-
describe '#initialize' do
|
9
|
-
it "should have default files" do
|
10
|
-
files_list.files.should == [
|
11
|
-
File.join(Jasmine::Core.path, "jasmine.js"),
|
12
|
-
File.join(Jasmine::Core.path, "jasmine-html.js"),
|
13
|
-
File.join(Jasmine::Core.path, "jasmine.css"),
|
14
|
-
File.expand_path('vendor/assets/javascripts/jasmine-extensions.js'),
|
15
|
-
File.expand_path('vendor/assets/javascripts/intense.js'),
|
16
|
-
File.expand_path('vendor/assets/javascripts/headless_reporter_result.js'),
|
17
|
-
File.expand_path('vendor/assets/javascripts/jasmine.HeadlessConsoleReporter.js'),
|
18
|
-
File.expand_path('vendor/assets/javascripts/jsDump.js'),
|
19
|
-
File.expand_path('vendor/assets/javascripts/beautify-html.js'),
|
20
|
-
]
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.no_default_files!
|
25
|
-
before do
|
26
|
-
described_class.stubs(:default_files).returns([])
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
it 'should have tests for #use_config!'
|
31
|
-
it 'should have tests for #add_files'
|
32
|
-
|
33
|
-
describe '#spec_file_line_numbers' do
|
34
|
-
include FakeFS::SpecHelpers
|
35
|
-
|
36
|
-
no_default_files!
|
37
|
-
|
38
|
-
before do
|
39
|
-
files_list.stubs(:spec_files).returns(['test.coffee', 'test2.coffee'])
|
40
|
-
|
41
|
-
File.open('test.coffee', 'w') { |fh| fh.print "describe('cat')\ndescribe('cat')" }
|
42
|
-
File.open('test2.coffee', 'w') { |fh| fh.print "no matches" }
|
43
|
-
end
|
44
|
-
|
45
|
-
it 'should generate filenames and line number info' do
|
46
|
-
files_list.spec_file_line_numbers.should == {
|
47
|
-
'test.coffee' => { 'cat' => [ 1, 2 ] }
|
48
|
-
}
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
8
|
describe '.get_paths_from_gemspec' do
|
53
9
|
include FakeFS::SpecHelpers
|
54
10
|
|
@@ -72,177 +28,195 @@ describe Jasmine::Headless::FilesList do
|
|
72
28
|
it { should =~ paths }
|
73
29
|
end
|
74
30
|
|
75
|
-
describe '
|
76
|
-
|
77
|
-
|
78
|
-
let(:files_list) { described_class.new(:config => config) }
|
31
|
+
describe '.asset_paths' do
|
32
|
+
include FakeFS::SpecHelpers
|
79
33
|
|
80
|
-
let(:
|
81
|
-
|
82
|
-
'spec_dir' => spec_dir,
|
83
|
-
'asset_paths' => asset_paths
|
84
|
-
} }
|
34
|
+
let(:dir_one) { 'dir_one' }
|
35
|
+
let(:dir_two) { 'dir_two' }
|
85
36
|
|
86
|
-
let(:
|
87
|
-
let(:
|
88
|
-
let(:asset_paths) { [] }
|
89
|
-
let(:path) { 'path' }
|
37
|
+
let(:gem_one) { stub(:gem_dir => dir_one) }
|
38
|
+
let(:gem_two) { stub(:gem_dir => dir_two) }
|
90
39
|
|
91
40
|
before do
|
92
|
-
|
41
|
+
described_class.instance_variable_set(:@asset_paths, nil)
|
42
|
+
FileUtils.mkdir_p File.join(dir_two, 'vendor/assets/javascripts')
|
43
|
+
|
44
|
+
Gem::Specification.stubs(:_all).returns([gem_one, gem_two])
|
93
45
|
end
|
94
46
|
|
95
|
-
|
47
|
+
it 'should return all matching gems with vendor/assets/javascripts directories' do
|
48
|
+
described_class.asset_paths.should == [ File.join(dir_two, 'vendor/assets/javascripts') ]
|
49
|
+
end
|
50
|
+
end
|
96
51
|
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
end
|
52
|
+
describe '#initialize' do
|
53
|
+
before do
|
54
|
+
described_class.any_instance.stubs(:load_initial_assets)
|
101
55
|
end
|
102
56
|
|
103
|
-
|
57
|
+
describe '#spec_file_line_numbers' do
|
58
|
+
include FakeFS::SpecHelpers
|
59
|
+
|
104
60
|
before do
|
105
|
-
|
61
|
+
files_list.stubs(:spec_files).returns(['test.coffee', 'test2.coffee'])
|
62
|
+
|
63
|
+
File.open('test.coffee', 'w') { |fh| fh.print "describe('cat')\ndescribe('cat')" }
|
64
|
+
File.open('test2.coffee', 'w') { |fh| fh.print "no matches" }
|
106
65
|
end
|
107
66
|
|
108
|
-
it 'should
|
109
|
-
files_list.
|
67
|
+
it 'should generate filenames and line number info' do
|
68
|
+
files_list.spec_file_line_numbers.should == {
|
69
|
+
'test.coffee' => { 'cat' => [ 1, 2 ] }
|
70
|
+
}
|
110
71
|
end
|
111
72
|
end
|
112
73
|
|
113
|
-
|
114
|
-
let(:
|
115
|
-
let(:dir_2) { 'dir 2' }
|
74
|
+
describe '#search_paths' do
|
75
|
+
let(:files_list) { described_class.new(:config => config) }
|
116
76
|
|
117
|
-
|
118
|
-
|
77
|
+
let(:config) { {
|
78
|
+
'src_dir' => src_dir,
|
79
|
+
'spec_dir' => spec_dir,
|
80
|
+
'asset_paths' => asset_paths
|
81
|
+
} }
|
119
82
|
|
120
|
-
|
121
|
-
|
122
|
-
|
83
|
+
let(:src_dir) { 'src dir' }
|
84
|
+
let(:spec_dir) { 'spec dir' }
|
85
|
+
let(:asset_paths) { [] }
|
86
|
+
let(:path) { 'path' }
|
87
|
+
|
88
|
+
before do
|
89
|
+
Jasmine::Headless::FilesList.stubs(:asset_paths).returns([])
|
123
90
|
end
|
124
91
|
|
125
|
-
|
126
|
-
let(:src_dir) { dir_1 }
|
127
|
-
let(:asset_paths) { [ dir_2 ] }
|
92
|
+
let(:vendor_path) { Jasmine::Headless.root.join('vendor/assets/javascripts').to_s }
|
128
93
|
|
94
|
+
context 'no vendored gem paths' do
|
129
95
|
it 'should take the src dir and spec dirs' do
|
130
|
-
files_list.search_paths.should == [ Jasmine::Core.path, vendor_path, File.expand_path(
|
96
|
+
files_list.search_paths.should == [ Jasmine::Core.path, vendor_path, File.expand_path(src_dir), File.expand_path(spec_dir) ]
|
131
97
|
end
|
132
98
|
end
|
133
|
-
end
|
134
|
-
end
|
135
99
|
|
136
|
-
|
137
|
-
|
100
|
+
context 'vendored gem paths' do
|
101
|
+
before do
|
102
|
+
Jasmine::Headless::FilesList.stubs(:asset_paths).returns([ path ])
|
103
|
+
end
|
138
104
|
|
139
|
-
|
140
|
-
|
105
|
+
it 'should add the vendor gem paths to the list' do
|
106
|
+
files_list.search_paths.should == [ Jasmine::Core.path, vendor_path, path, File.expand_path(src_dir), File.expand_path(spec_dir) ]
|
107
|
+
end
|
108
|
+
end
|
141
109
|
|
142
|
-
|
143
|
-
|
110
|
+
context 'multiple dirs' do
|
111
|
+
let(:dir_1) { 'dir 1' }
|
112
|
+
let(:dir_2) { 'dir 2' }
|
144
113
|
|
145
|
-
|
146
|
-
|
114
|
+
context 'src_dir is an array' do
|
115
|
+
let(:src_dir) { [ dir_1, dir_2 ] }
|
147
116
|
|
148
|
-
|
117
|
+
it 'should take the src dir and spec dirs' do
|
118
|
+
files_list.search_paths.should == [ Jasmine::Core.path, vendor_path, File.expand_path(dir_1), File.expand_path(dir_2), File.expand_path(spec_dir) ]
|
119
|
+
end
|
120
|
+
end
|
149
121
|
|
150
|
-
|
151
|
-
|
122
|
+
context 'asset_paths has entries' do
|
123
|
+
let(:src_dir) { dir_1 }
|
124
|
+
let(:asset_paths) { [ dir_2 ] }
|
152
125
|
|
153
|
-
|
154
|
-
|
126
|
+
it 'should take the src dir and spec dirs' do
|
127
|
+
files_list.search_paths.should == [ Jasmine::Core.path, vendor_path, File.expand_path(dir_1), File.expand_path(dir_2), File.expand_path(spec_dir) ]
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
155
131
|
end
|
156
|
-
end
|
157
|
-
|
158
|
-
describe '#files' do
|
159
|
-
let(:path_one) { 'one' }
|
160
|
-
let(:path_two) { 'two' }
|
161
|
-
let(:path_three) { 'three' }
|
162
132
|
|
163
|
-
|
164
|
-
|
133
|
+
describe '#files' do
|
134
|
+
let(:path_one) { 'one' }
|
135
|
+
let(:path_two) { 'two' }
|
136
|
+
let(:path_three) { 'three' }
|
165
137
|
|
166
|
-
|
167
|
-
|
168
|
-
let(:asset_three) { stub(:pathname => Pathname(path_three), :to_ary => nil) }
|
138
|
+
let(:file_one) { stub(:to_a => [ asset_one, asset_two ] ) }
|
139
|
+
let(:file_two) { stub(:to_a => [ asset_two, asset_three ] ) }
|
169
140
|
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
subject { files_list.files }
|
141
|
+
let(:asset_one) { stub(:pathname => Pathname(path_one), :to_ary => nil) }
|
142
|
+
let(:asset_two) { stub(:pathname => Pathname(path_two), :to_ary => nil) }
|
143
|
+
let(:asset_three) { stub(:pathname => Pathname(path_three), :to_ary => nil) }
|
175
144
|
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
describe '#filtered_files' do
|
180
|
-
let(:spec_dir) { 'spec' }
|
145
|
+
before do
|
146
|
+
files_list.stubs(:required_files).returns(Jasmine::Headless::UniqueAssetList.new([ file_one, file_two ]))
|
147
|
+
end
|
181
148
|
|
182
|
-
|
183
|
-
let(:file_two) { "#{spec_dir}/two" }
|
184
|
-
let(:file_three) { "#{spec_dir}/three" }
|
185
|
-
let(:file_four) { 'other/four' }
|
149
|
+
subject { files_list.files }
|
186
150
|
|
187
|
-
|
188
|
-
files_list.stubs(:files).returns([
|
189
|
-
file_one,
|
190
|
-
file_two,
|
191
|
-
file_three,
|
192
|
-
file_four
|
193
|
-
])
|
194
|
-
|
195
|
-
files_list.stubs(:potential_files_to_filter).returns([ file_one, file_two, file_three ])
|
151
|
+
it { should == [ path_one, path_two, path_three ] }
|
196
152
|
end
|
197
153
|
|
198
|
-
|
154
|
+
describe '#filtered_files' do
|
155
|
+
let(:spec_dir) { 'spec' }
|
156
|
+
|
157
|
+
let(:file_one) { "#{spec_dir}/one" }
|
158
|
+
let(:file_two) { "#{spec_dir}/two" }
|
159
|
+
let(:file_three) { "#{spec_dir}/three" }
|
160
|
+
let(:file_four) { 'other/four' }
|
199
161
|
|
200
|
-
context 'empty filter' do
|
201
162
|
before do
|
202
|
-
files_list.stubs(:
|
163
|
+
files_list.stubs(:files).returns([
|
164
|
+
file_one,
|
165
|
+
file_two,
|
166
|
+
file_three,
|
167
|
+
file_four
|
168
|
+
])
|
169
|
+
|
170
|
+
files_list.stubs(:potential_files_to_filter).returns([ file_one, file_two, file_three ])
|
203
171
|
end
|
204
172
|
|
205
|
-
|
206
|
-
end
|
173
|
+
subject { files_list.filtered_files }
|
207
174
|
|
208
|
-
|
209
|
-
|
210
|
-
|
175
|
+
context 'empty filter' do
|
176
|
+
before do
|
177
|
+
files_list.stubs(:spec_filter).returns([])
|
178
|
+
end
|
179
|
+
|
180
|
+
it { should == [ file_one, file_two, file_three, file_four ] }
|
211
181
|
end
|
212
182
|
|
213
|
-
|
183
|
+
context 'with filter' do
|
184
|
+
before do
|
185
|
+
files_list.stubs(:spec_filter).returns([ "#{spec_dir}/one", '**/tw*' ])
|
186
|
+
end
|
187
|
+
|
188
|
+
it { should == [ file_one, file_two, file_four ] }
|
189
|
+
end
|
214
190
|
end
|
215
|
-
end
|
216
191
|
|
217
|
-
|
218
|
-
|
192
|
+
describe '#add_files' do
|
193
|
+
let(:files_list) { described_class.new(:seed => 100) }
|
219
194
|
|
220
|
-
|
195
|
+
let(:dir) { 'tmp' }
|
221
196
|
|
222
|
-
|
197
|
+
before do
|
198
|
+
FileUtils.mkdir_p dir
|
223
199
|
|
224
|
-
|
225
|
-
|
200
|
+
10.times do |index|
|
201
|
+
File.open(File.join(dir, "file-#{index}.js"), 'wb')
|
202
|
+
end
|
226
203
|
|
227
|
-
|
228
|
-
File.open(File.join(dir, "file-#{index}.js"), 'wb')
|
204
|
+
File.open(File.join(dir, 'file.js.erb'), 'wb')
|
229
205
|
end
|
230
206
|
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
before do
|
235
|
-
files_list.send(:add_files, [ '*' ], 'spec_files', [ dir ])
|
236
|
-
end
|
207
|
+
before do
|
208
|
+
files_list.send(:add_files, [ '*' ], 'spec_files', [ dir ])
|
209
|
+
end
|
237
210
|
|
238
|
-
|
239
|
-
|
211
|
+
it 'should load spec files in a random order' do
|
212
|
+
files_list.files.collect { |name| name[%r{\d+}] }.should == %w{6 7 1 0 5 3 4 8 2 9}
|
240
213
|
|
241
|
-
|
242
|
-
|
214
|
+
FileUtils.rm_rf dir
|
215
|
+
end
|
243
216
|
|
244
|
-
|
245
|
-
|
217
|
+
it 'should not load an excluded format' do
|
218
|
+
files_list.files.any? { |file| file['.erb'] }.should be_false
|
219
|
+
end
|
246
220
|
end
|
247
221
|
end
|
248
222
|
end
|
@@ -43,6 +43,35 @@ describe Jasmine::Headless::Options do
|
|
43
43
|
options[:colors].should be_true
|
44
44
|
options[:jasmine_config].should == 'test'
|
45
45
|
end
|
46
|
+
|
47
|
+
context 'legacy reporter' do
|
48
|
+
let(:file) { 'file' }
|
49
|
+
|
50
|
+
before do
|
51
|
+
options.expects(:warn)
|
52
|
+
end
|
53
|
+
|
54
|
+
it 'should add a legacy reporter' do
|
55
|
+
options[:reporters] = []
|
56
|
+
|
57
|
+
options.process_option("--report", file)
|
58
|
+
|
59
|
+
options[:reporters].should == [ [ 'File', file ], [ 'Console' ] ]
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
context 'short reporter' do
|
64
|
+
let(:reporter) { 'reporter' }
|
65
|
+
let(:file) { 'file' }
|
66
|
+
|
67
|
+
it 'should add a reporter' do
|
68
|
+
options[:reporters] = []
|
69
|
+
|
70
|
+
options.process_option("--format", "#{reporter}:#{file}")
|
71
|
+
|
72
|
+
options[:reporters].should == [ [ reporter, file ] ]
|
73
|
+
end
|
74
|
+
end
|
46
75
|
end
|
47
76
|
|
48
77
|
describe '#read_defaults_files' do
|
@@ -110,8 +139,56 @@ describe Jasmine::Headless::Options do
|
|
110
139
|
end
|
111
140
|
end
|
112
141
|
|
142
|
+
let(:test_reporter) { 'TestReporter' }
|
143
|
+
let(:file) { 'file' }
|
144
|
+
|
145
|
+
context 'no reporters' do
|
146
|
+
it 'should have the default reporter' do
|
147
|
+
options[:reporters].should == [ [ 'Console' ] ]
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
context 'one reporter' do
|
152
|
+
context 'stdout' do
|
153
|
+
before do
|
154
|
+
ARGV.replace([ "--format", test_reporter ])
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'should have the new reporter on stdout' do
|
158
|
+
options[:reporters].should == [ [ test_reporter ] ]
|
159
|
+
|
160
|
+
options.reporters.should == [ [ test_reporter, 'stdout' ] ]
|
161
|
+
end
|
162
|
+
end
|
163
|
+
|
164
|
+
context 'file' do
|
165
|
+
before do
|
166
|
+
ARGV.replace([ "--format", test_reporter, '--out', file ])
|
167
|
+
end
|
168
|
+
|
169
|
+
it 'should have the new reporter on stdout' do
|
170
|
+
options[:reporters].should == [ [ test_reporter, file ] ]
|
171
|
+
|
172
|
+
options.reporters.should == [ [ test_reporter, 'report:0', file ] ]
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
113
177
|
after do
|
114
178
|
ARGV.replace(@argv)
|
115
179
|
end
|
116
180
|
end
|
181
|
+
|
182
|
+
describe '#file_reporters' do
|
183
|
+
subject { options.file_reporters }
|
184
|
+
|
185
|
+
let(:stdout_reporter) { [ 'Console', 'stdout' ] }
|
186
|
+
let(:file_reporter) { [ 'File', 'report:0', 'file' ] }
|
187
|
+
|
188
|
+
before do
|
189
|
+
options.stubs(:reporters).returns([ stdout_reporter, file_reporter ])
|
190
|
+
end
|
191
|
+
|
192
|
+
it { should == [ file_reporter ] }
|
193
|
+
end
|
117
194
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Jasmine::Headless::ReportMessage::Seed do
|
4
|
+
let(:seed) { described_class.new(seed_value) }
|
5
|
+
let(:seed_value) { '1' }
|
6
|
+
|
7
|
+
subject { seed }
|
8
|
+
|
9
|
+
its(:seed) { should == seed_value.to_i }
|
10
|
+
|
11
|
+
describe '.new_from_parts' do
|
12
|
+
subject { described_class.new_from_parts(parts) }
|
13
|
+
|
14
|
+
let(:parts) { [ seed_value ] }
|
15
|
+
|
16
|
+
its(:seed) { should == seed_value.to_i }
|
17
|
+
end
|
18
|
+
end
|
@@ -2,6 +2,9 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Jasmine::Headless::Report do
|
4
4
|
include FakeFS::SpecHelpers
|
5
|
+
|
6
|
+
let(:report) { described_class.new(file) }
|
7
|
+
let(:file) { 'file' }
|
5
8
|
|
6
9
|
let(:file) { 'report.txt' }
|
7
10
|
|
@@ -75,5 +78,18 @@ REPORT
|
|
75
78
|
end
|
76
79
|
end
|
77
80
|
end
|
81
|
+
|
82
|
+
describe '#seed' do
|
83
|
+
subject { report.seed }
|
84
|
+
|
85
|
+
let(:seed) { stub(:seed => seed_number) }
|
86
|
+
let(:seed_number) { 1 }
|
87
|
+
|
88
|
+
before do
|
89
|
+
report.stubs(:report).returns([ seed ])
|
90
|
+
end
|
91
|
+
|
92
|
+
it { should == seed_number }
|
93
|
+
end
|
78
94
|
end
|
79
95
|
|