opal-rspec 0.6.1 → 0.6.2
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 +5 -5
- data/.travis.yml +11 -43
- data/CHANGELOG.md +9 -0
- data/Gemfile +1 -9
- data/Rakefile +13 -3
- data/lib/opal/rspec/rake_task.rb +72 -78
- data/lib/opal/rspec/version.rb +1 -1
- data/opal-rspec.gemspec +2 -1
- data/opal/opal/rspec/fixes/rspec/core/notifications/summary_notification.rb +3 -4
- data/opal/opal/rspec/spec_opts.rb.erb +2 -3
- data/spec/mri/unit/opal/rspec/rake_task_spec.rb +32 -27
- data/spec/rspec/core/config.rb +1 -1
- data/spec/rspec/expectations/config.rb +1 -1
- data/spec/rspec/mocks/spec_helper_opal.rb +1 -1
- data/spec/rspec/opal_rspec_spec_loader.rb +40 -43
- data/spec/rspec/shared/opal/separator_formatter.rb +14 -0
- data/spec/rspec/support/config.rb +1 -1
- metadata +19 -8
- data/Appraisals +0 -8
- data/gemfiles/opal_0.10_stable.gemfile +0 -12
- data/gemfiles/opal_master.gemfile +0 -13
- data/spec/rspec/shared/opal/progress_json_formatter.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 75ebf6988b2018f0174da74e1232e9b34fc5d7934d459e1bc58a70afac085af7
|
4
|
+
data.tar.gz: 302016b488d81915ae5d6bda8e249ee4d37eaa948a19f2037a6a2acd2cf49fe7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c665b19023aecb9310c533e418931c77a47a59b85f9b9d46db5494ad5a50556529b6d600307dcf8efd1623f9bae7d7d4a9ec43374c1350c78e1020a59ccc603
|
7
|
+
data.tar.gz: b0213c7196ef7fa86757420e8d4b4c665db2df1badd0de94fbf4d7ed6bfa85741584116082ebaee0e9275e145bcc9dd94146eae2f62163dd4c0f1b5f2a005cb7
|
data/.travis.yml
CHANGED
@@ -5,62 +5,30 @@ cache:
|
|
5
5
|
bundler: true
|
6
6
|
directories:
|
7
7
|
- node_modules
|
8
|
-
|
8
|
+
|
9
|
+
env:
|
10
|
+
global:
|
11
|
+
- OPAL_VERSION="~> 0.10.0"
|
9
12
|
|
10
13
|
matrix:
|
11
14
|
fast_finish: true
|
12
15
|
|
13
16
|
include:
|
14
|
-
- rvm: 2.
|
17
|
+
- rvm: 2.4.5
|
15
18
|
env: RUN=mri_sanity_check
|
16
|
-
- rvm: 2.3.
|
19
|
+
- rvm: 2.3.8
|
17
20
|
env: RUN=mri_sanity_check
|
18
|
-
- rvm: 2.
|
21
|
+
- rvm: 2.5.3
|
19
22
|
env: RUN=mri_sanity_check
|
20
|
-
- rvm: 2.
|
23
|
+
- rvm: 2.5.3
|
21
24
|
env: RUN=rake_only
|
22
|
-
- rvm: 2.
|
23
|
-
# PHANTOMJS env variable is not used but it makes it easier to differentiate this build in Travis
|
24
|
-
env: PHANTOMJS=2.1 RUN=rake_only
|
25
|
-
before_install:
|
26
|
-
# Attempt to work around Travis issues and Ruby 2.3 - https://github.com/vcr/vcr/issues/582
|
27
|
-
- gem update --system
|
28
|
-
- "export PATH=`pwd`/node_modules/phantomjs-prebuilt/bin:$PATH"
|
29
|
-
- "echo $PATH"
|
30
|
-
- phantomjs -v | grep 2.1 || npm install phantomjs-prebuilt # get rate limits from bitbucket download source, so get from NPM if we don't have it already
|
31
|
-
- rvm: 2.4.1
|
25
|
+
- rvm: 2.5.3
|
32
26
|
env: RUNNER=node RUN=rake_only
|
33
|
-
- rvm: 2.4.1
|
34
|
-
env: RUN=rake_only
|
35
|
-
gemfile: gemfiles/opal_master.gemfile
|
36
|
-
- rvm: 2.4.1
|
37
|
-
env: RUN=rake_only
|
38
|
-
gemfile: gemfiles/opal_0.10_stable.gemfile
|
39
|
-
|
40
|
-
allow_failures:
|
41
|
-
- gemfile: gemfiles/opal_master.gemfile
|
42
27
|
|
43
28
|
before_install:
|
44
|
-
|
45
|
-
- gem update --system
|
46
|
-
- "mkdir -p phantom20"
|
47
|
-
- "export PATH=`pwd`/phantom20:$PATH"
|
29
|
+
- "export PATH=`pwd`/node_modules/phantomjs-prebuilt/bin:$PATH"
|
48
30
|
- "echo $PATH"
|
49
|
-
-
|
50
|
-
- "ls phantomjs || curl -L -O https://s3.amazonaws.com/travis-phantomjs/phantomjs-2.0.0-ubuntu-12.04.tar.bz2"
|
51
|
-
- "ls phantomjs || tar xjvf phantomjs-2.0.0-ubuntu-12.04.tar.bz2"
|
52
|
-
- "rm -rf phantomjs-2.0.0-ubuntu-12.04.tar.bz2"
|
53
|
-
- "popd"
|
54
|
-
|
55
|
-
# before_script:
|
56
|
-
# - "export DISPLAY=:99.0"
|
57
|
-
# - "sh -e /etc/init.d/xvfb start"
|
58
|
-
# - "phantomjs -v"
|
59
|
-
# - "node -v"
|
60
|
-
# - "firefox --version"
|
61
|
-
|
62
|
-
notifications:
|
63
|
-
irc: "irc.freenode.org#opal"
|
31
|
+
- phantomjs -v | grep 2.1 || npm install phantomjs-prebuilt # get rate limits from bitbucket download source, so get from NPM if we don't have it already
|
64
32
|
|
65
33
|
script:
|
66
34
|
- "bundle exec rake $RUN"
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
## 0.6.2 - 2018-11-09
|
2
|
+
|
3
|
+
- Updated the homepage url
|
4
|
+
|
5
|
+
- Only test against Opal v0.10, v0.11 will be supported in opal-rspec v0.7
|
6
|
+
|
7
|
+
- Add support for multiple formats in `SPEC_OPTS` and allow both `--format` and `-f`
|
8
|
+
|
9
|
+
|
1
10
|
## 0.6.1 - 2017-05-25
|
2
11
|
|
3
12
|
- Fixed compatibility with Rake 12
|
data/Gemfile
CHANGED
@@ -5,15 +5,7 @@ unless Dir['rspec{,-{core,expectations,mocks,support}}'].any?
|
|
5
5
|
warn 'Run: "git submodule update --init" to get RSpec sources'
|
6
6
|
end
|
7
7
|
|
8
|
-
|
9
|
-
when 'master'
|
10
|
-
gem 'opal', github: 'opal/opal', branch: 'master'
|
11
|
-
gem 'opal-sprockets', github: 'opal/opal-sprockets'
|
12
|
-
when nil
|
13
|
-
gem 'opal' # let bundler pick a version
|
14
|
-
else
|
15
|
-
gem 'opal', opal_version
|
16
|
-
end
|
8
|
+
gem "opal", git: "https://github.com/opal/opal.git", branch: "0-10-stable"
|
17
9
|
|
18
10
|
# These need to come from our local path in order for create_requires.rb to work properly
|
19
11
|
gem 'rspec', path: 'rspec'
|
data/Rakefile
CHANGED
@@ -76,7 +76,7 @@ task :verify_rspec_specs => [
|
|
76
76
|
|
77
77
|
desc 'Verifies other_spec_dir task ran correctly'
|
78
78
|
task :verify_other_specs do
|
79
|
-
test_output = `rake other_specs`
|
79
|
+
test_output = `rake other_specs --trace`
|
80
80
|
unless /1 example, 0 failures/.match(test_output)
|
81
81
|
raise "Expected 1 passing example, but got output '#{test_output}'"
|
82
82
|
end
|
@@ -85,11 +85,21 @@ end
|
|
85
85
|
|
86
86
|
desc 'Will run a spec suite (rake opal_specs) and check for expected combination of failures and successes'
|
87
87
|
task :verify_opal_specs do
|
88
|
-
|
88
|
+
require 'tempfile'
|
89
|
+
|
90
|
+
test_output = Tempfile.create('opal_specs') do |f|
|
91
|
+
`bundle exec rake opal_specs --trace > #{f.path}`
|
92
|
+
File.read f.path
|
93
|
+
end
|
89
94
|
test_output.force_encoding 'UTF-8'
|
90
95
|
raise "Expected test runner to fail due to failed tests, but got return code of #{$?.exitstatus}" if $?.success?
|
91
96
|
count_match = /(\d+) examples, (\d+) failures, (\d+) pending/.match(test_output)
|
92
|
-
|
97
|
+
|
98
|
+
unless count_match
|
99
|
+
raise "Expected a finished count of test failures/success/etc. but did not see it\n" +
|
100
|
+
"Expected /(\d+) examples, (\d+) failures, (\d+) pending/ to match:\n\n> #{test_output.gsub("\n", "\n> ")}"
|
101
|
+
end
|
102
|
+
|
93
103
|
total, failed, pending = count_match.captures
|
94
104
|
|
95
105
|
actual_failures = []
|
data/lib/opal/rspec/rake_task.rb
CHANGED
@@ -18,47 +18,70 @@ module Opal
|
|
18
18
|
setting == :enabled
|
19
19
|
end
|
20
20
|
|
21
|
-
def launch_phantom(
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
21
|
+
def launch_phantom(sprockets_env, main, &config_block)
|
22
|
+
app = Opal::Server.new(sprockets: sprockets_env) { |server|
|
23
|
+
server.main = main
|
24
|
+
server.debug = false
|
25
|
+
config_block.call(server)
|
26
|
+
}
|
27
|
+
|
28
|
+
server = Thread.new do
|
29
|
+
require 'rack'
|
30
|
+
require 'webrick'
|
31
|
+
Thread.current.abort_on_exception = true
|
32
|
+
Rack::Server.start(
|
33
|
+
:app => app,
|
34
|
+
:Port => PORT,
|
35
|
+
:AccessLog => [],
|
36
|
+
:Logger => WEBrick::Log.new("/dev/null"),
|
37
|
+
)
|
38
|
+
end
|
26
39
|
|
27
|
-
|
40
|
+
wait_for_server
|
41
|
+
|
42
|
+
version_output = begin
|
43
|
+
`phantomjs -v`.strip
|
44
|
+
rescue
|
45
|
+
warn 'Could not find phantomjs command on path!'
|
46
|
+
exit 1
|
47
|
+
end
|
48
|
+
|
49
|
+
if version_output.to_f < 2
|
50
|
+
warn "PhantomJS >= 2.0 is required but version #{version_output} is installed!"
|
51
|
+
exit 1
|
52
|
+
end
|
53
|
+
|
54
|
+
begin
|
55
|
+
command_line = %Q{phantomjs #{RUNNER} "#{URL}"#{@timeout ? " #{@timeout}" : ''}}
|
56
|
+
puts "Running #{command_line}"
|
57
|
+
system command_line
|
58
|
+
success = $?.success?
|
59
|
+
|
60
|
+
exit 1 unless success
|
61
|
+
ensure
|
62
|
+
server.kill
|
63
|
+
end
|
28
64
|
end
|
29
65
|
|
30
66
|
def runner
|
31
67
|
((via_env = ENV['RUNNER']) && via_env.to_sym) || @runner || :phantom
|
32
68
|
end
|
33
69
|
|
34
|
-
def
|
35
|
-
sprockets
|
36
|
-
name = server.main
|
37
|
-
asset = sprockets[name]
|
38
|
-
raise "Cannot find asset: #{name}" if asset.nil?
|
39
|
-
Opal::Sprockets.load_asset name, sprockets
|
40
|
-
end
|
70
|
+
def launch_node(sprockets, main, &config_block)
|
71
|
+
Opal.paths.each { |p| sprockets.append_path(p) } # Opal::Server does this
|
41
72
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
compiled.close
|
54
|
-
end
|
55
|
-
command_line = "node #{compiled.path} 2>&1"
|
56
|
-
puts "Running #{command_line}"
|
57
|
-
system command_line
|
73
|
+
config_block.call sprockets
|
74
|
+
|
75
|
+
asset = sprockets[main]
|
76
|
+
raise "Cannot find asset: #{main} in #{sprockets.inspect}" if asset.nil?
|
77
|
+
|
78
|
+
Tempfile.create [main.to_s.gsub(/\W/, '.'), '.opal_rspec.js'] do |file|
|
79
|
+
File.write file.path, asset.to_s + Opal::Sprockets.load_asset(main)
|
80
|
+
|
81
|
+
command = "node #{file.path} 2>&1"
|
82
|
+
puts "~~> Running #{command}"
|
83
|
+
system command
|
58
84
|
exit 1 unless $?.success?
|
59
|
-
ensure
|
60
|
-
compiled.close unless compiled.closed?
|
61
|
-
compiled.unlink
|
62
85
|
end
|
63
86
|
end
|
64
87
|
|
@@ -87,56 +110,27 @@ module Opal
|
|
87
110
|
def initialize(name = 'opal:rspec', &block)
|
88
111
|
desc 'Run opal specs in phantomjs/node'
|
89
112
|
task name do
|
90
|
-
require 'rack'
|
91
|
-
require 'webrick'
|
92
|
-
|
93
113
|
sprockets_env = Opal::RSpec::SprocketsEnvironment.new
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
sprockets_env.
|
102
|
-
sprockets_env.
|
103
|
-
|
114
|
+
main = 'opal/rspec/sprockets_runner'
|
115
|
+
current_task = self
|
116
|
+
|
117
|
+
config_block = -> *args {
|
118
|
+
args.insert(1, current_task)
|
119
|
+
block.call *args if block
|
120
|
+
|
121
|
+
sprockets_env.spec_pattern = current_task.pattern if current_task.pattern
|
122
|
+
sprockets_env.spec_exclude_pattern = current_task.exclude_pattern
|
123
|
+
sprockets_env.spec_files = current_task.files
|
124
|
+
sprockets_env.default_path = current_task.default_path if current_task.default_path
|
125
|
+
raise 'Cannot supply both a pattern and files!' if current_task.files and current_task.pattern
|
104
126
|
sprockets_env.add_spec_paths_to_sprockets
|
127
|
+
Opal::Config.arity_check_enabled = arity_checking?
|
105
128
|
}
|
106
129
|
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
server = Thread.new do
|
112
|
-
Thread.current.abort_on_exception = true
|
113
|
-
Rack::Server.start(
|
114
|
-
:app => app,
|
115
|
-
:Port => PORT,
|
116
|
-
:AccessLog => [],
|
117
|
-
:Logger => WEBrick::Log.new("/dev/null"),
|
118
|
-
)
|
119
|
-
end
|
120
|
-
|
121
|
-
wait_for_server
|
122
|
-
is_phantom = runner == :phantom
|
123
|
-
if is_phantom
|
124
|
-
version_output = begin
|
125
|
-
`phantomjs -v`.strip
|
126
|
-
rescue
|
127
|
-
warn 'Could not find phantomjs command on path!'
|
128
|
-
exit 1
|
129
|
-
end
|
130
|
-
if version_output.to_f < 2
|
131
|
-
warn "PhantomJS >= 2.0 is required but version #{version_output} is installed!"
|
132
|
-
exit 1
|
133
|
-
end
|
134
|
-
end
|
135
|
-
|
136
|
-
begin
|
137
|
-
is_phantom ? launch_phantom(timeout) : launch_node(app)
|
138
|
-
ensure
|
139
|
-
server.kill
|
130
|
+
case runner
|
131
|
+
when :node then launch_node(sprockets_env, main, &config_block)
|
132
|
+
when :phantom then launch_phantom(sprockets_env, main, &config_block)
|
133
|
+
else raise "unknown runner type: #{runner.inspect}"
|
140
134
|
end
|
141
135
|
end
|
142
136
|
end
|
data/lib/opal/rspec/version.rb
CHANGED
data/opal-rspec.gemspec
CHANGED
@@ -6,7 +6,7 @@ Gem::Specification.new do |s|
|
|
6
6
|
s.version = Opal::RSpec::VERSION
|
7
7
|
s.author = 'Adam Beynon'
|
8
8
|
s.email = 'adam.beynon@gmail.com'
|
9
|
-
s.homepage = '
|
9
|
+
s.homepage = 'https://github.com/opal-rspec'
|
10
10
|
s.summary = 'RSpec for Opal'
|
11
11
|
s.description = 'Opal compatible rspec library'
|
12
12
|
|
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
|
|
17
17
|
s.add_dependency 'opal', ['>= 0.10.0', '< 0.12']
|
18
18
|
s.add_development_dependency 'rake'
|
19
19
|
s.add_development_dependency 'yard'
|
20
|
+
s.add_development_dependency 'puma'
|
20
21
|
s.add_development_dependency 'poltergeist'
|
21
22
|
s.add_development_dependency 'capybara'
|
22
23
|
s.add_development_dependency 'launchy'
|
@@ -2,11 +2,10 @@ module ::RSpec::Core::Notifications
|
|
2
2
|
# SummaryNotification is a Struct
|
3
3
|
SummaryNotification.class_eval do
|
4
4
|
def totals_line
|
5
|
+
# string mutations
|
5
6
|
summary = Formatters::Helpers.pluralize(example_count, "example")
|
6
|
-
|
7
|
-
summary
|
8
|
-
# string mutation
|
9
|
-
summary = summary + ", #{pending_count} pending" if pending_count > 0
|
7
|
+
summary += ", " + Formatters::Helpers.pluralize(failure_count, "failure")
|
8
|
+
summary += ", #{pending_count} pending" if pending_count > 0
|
10
9
|
summary
|
11
10
|
end
|
12
11
|
|
@@ -19,10 +19,9 @@
|
|
19
19
|
|
20
20
|
<% end
|
21
21
|
end
|
22
|
-
if (match =
|
23
|
-
formatter = match.captures[0]
|
22
|
+
if (match = spec_opts.scan(/(?:--format (\S+)|-f ?(\S+))/).flatten.compact).any?
|
24
23
|
%>
|
25
|
-
config.
|
24
|
+
<%= match.inspect %>.each { |f| config.add_formatter f }
|
26
25
|
<% end %>
|
27
26
|
end
|
28
27
|
<% end %>
|
@@ -6,14 +6,13 @@ require_relative 'temp_dir_helper'
|
|
6
6
|
describe Opal::RSpec::RakeTask do
|
7
7
|
include_context :temp_dir
|
8
8
|
let(:captured_opal_server) { {} }
|
9
|
+
let(:runner) { :phantom }
|
10
|
+
before { ENV['RUNNER'] = runner.to_s }
|
9
11
|
|
10
|
-
RSpec::Matchers.define :invoke_runner do |expected
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
timeout_value: timeout_value
|
15
|
-
}]
|
16
|
-
end
|
12
|
+
RSpec::Matchers.define :invoke_runner do |expected|
|
13
|
+
expected_value = [expected]
|
14
|
+
match { expect(invoked_runners).to eq(expected_value) }
|
15
|
+
failure_message { {expected: expected_value, got: invoked_runners}.inspect }
|
17
16
|
end
|
18
17
|
|
19
18
|
RSpec::Matchers.define :enable_arity_checking do
|
@@ -24,7 +23,7 @@ describe Opal::RSpec::RakeTask do
|
|
24
23
|
|
25
24
|
RSpec::Matchers.define :require_opal_specs do |matcher|
|
26
25
|
def actual
|
27
|
-
captured_opal_server[:
|
26
|
+
captured_opal_server[:sprockets].cached.get_opal_spec_requires
|
28
27
|
end
|
29
28
|
|
30
29
|
match do
|
@@ -42,7 +41,7 @@ describe Opal::RSpec::RakeTask do
|
|
42
41
|
|
43
42
|
RSpec::Matchers.define :append_opal_path do |expected_path|
|
44
43
|
def actual
|
45
|
-
captured_opal_server[:
|
44
|
+
captured_opal_server[:sprockets].paths
|
46
45
|
end
|
47
46
|
|
48
47
|
abs_expected = lambda { File.expand_path(expected_path) }
|
@@ -66,8 +65,8 @@ describe Opal::RSpec::RakeTask do
|
|
66
65
|
task.clear
|
67
66
|
task.reenable
|
68
67
|
end
|
69
|
-
allow(Rack::Server).to receive(:start) do |config|
|
70
|
-
|
68
|
+
allow(Rack::Server).to receive(:start) do |config|
|
69
|
+
# don't want to actually run specs
|
71
70
|
end
|
72
71
|
thread_double = instance_double Thread
|
73
72
|
allow(thread_double).to receive :kill
|
@@ -75,23 +74,26 @@ describe Opal::RSpec::RakeTask do
|
|
75
74
|
block.call
|
76
75
|
thread_double
|
77
76
|
end
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
77
|
+
|
78
|
+
dummy_launch = -> (runner_name, sprockets, main, &config_block) {
|
79
|
+
config_block.call
|
80
|
+
captured_opal_server[:sprockets] = sprockets
|
81
|
+
captured_opal_server[:main] = main
|
82
|
+
invoked_runners << runner_name
|
83
83
|
nil
|
84
|
+
}
|
85
|
+
|
86
|
+
allow(task_definition).to receive(:launch_phantom) do |*args, &block|
|
87
|
+
dummy_launch.call(:phantom, *args, &block)
|
84
88
|
end
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
timeout_value: nil
|
89
|
-
}
|
90
|
-
nil
|
89
|
+
|
90
|
+
allow(task_definition).to receive(:launch_node) do |*args, &block|
|
91
|
+
dummy_launch.call(:node, *args, &block)
|
91
92
|
end
|
92
|
-
expect(task_definition).to receive(:wait_for_server) if expected_to_run
|
93
93
|
end
|
94
94
|
|
95
|
+
after { raise "did not run" if invoked_runners.empty? if expected_to_run }
|
96
|
+
|
95
97
|
let(:invoked_runners) { [] }
|
96
98
|
let(:task_name) { :foobar }
|
97
99
|
let(:expected_to_run) { true }
|
@@ -112,6 +114,7 @@ describe Opal::RSpec::RakeTask do
|
|
112
114
|
end
|
113
115
|
|
114
116
|
around do |example|
|
117
|
+
expect(runner).to eq(:phantom)
|
115
118
|
# in case we're running on travis, etc.
|
116
119
|
current_env_runner = ENV['RUNNER']
|
117
120
|
ENV['RUNNER'] = nil
|
@@ -195,9 +198,8 @@ describe Opal::RSpec::RakeTask do
|
|
195
198
|
context 'ENV' do
|
196
199
|
TEST_RUNNERS.each do |runner|
|
197
200
|
context runner do
|
198
|
-
|
199
|
-
|
200
|
-
end
|
201
|
+
let(:runner) { runner }
|
202
|
+
before { ENV['RUNNER'] = runner.to_s }
|
201
203
|
|
202
204
|
include_context :explicit, runner
|
203
205
|
end
|
@@ -310,6 +312,9 @@ describe Opal::RSpec::RakeTask do
|
|
310
312
|
it { is_expected.to have_attributes pattern: nil }
|
311
313
|
it { is_expected.to append_opal_path 'spec' }
|
312
314
|
it { is_expected.to require_opal_specs eq ['something/dummy_spec'] }
|
313
|
-
it { is_expected.to invoke_runner :phantom
|
315
|
+
it { is_expected.to invoke_runner :phantom }
|
316
|
+
it 'has timeout set' do
|
317
|
+
expect(subject.timeout).to eq(40000)
|
318
|
+
end
|
314
319
|
end
|
315
320
|
end
|
data/spec/rspec/core/config.rb
CHANGED
@@ -3,7 +3,7 @@ require 'rspec/support/spec'
|
|
3
3
|
require 'rspec/support/ruby_features'
|
4
4
|
require 'opal-parser'
|
5
5
|
|
6
|
-
require 'opal/
|
6
|
+
require 'opal/separator_formatter' # verify case uses this
|
7
7
|
# Only doing this because any_instance causes the runner itself to break
|
8
8
|
CAUSES_SPECS_TO_CRASH = [
|
9
9
|
/.*allow_any_instance.*/,
|
@@ -146,7 +146,7 @@ module Opal
|
|
146
146
|
missing << path unless matching
|
147
147
|
temp_filename
|
148
148
|
end
|
149
|
-
raise "Expected to #{description} in #{fix_these_files} but we didn't find any expressions in #{missing}. Check if RSpec has been upgraded" if missing.any?
|
149
|
+
raise "~~> Expected to #{description} in #{fix_these_files} but we didn't find any expressions in #{missing}. Check if RSpec has been upgraded" if missing.any?
|
150
150
|
files_we_left_alone = starting_file_set - fix_these_files
|
151
151
|
files_we_left_alone + fixed_temp_files
|
152
152
|
end
|
@@ -162,7 +162,7 @@ module Opal
|
|
162
162
|
.source
|
163
163
|
.gsub('/', '\/')
|
164
164
|
replace = "/#{escaped}/m"
|
165
|
-
puts "Replacing multiline regex with #{replace} in new temp file #{temp_filename}"
|
165
|
+
puts "~~> Replacing multiline regex with #{replace} in new temp file #{temp_filename}"
|
166
166
|
replace
|
167
167
|
end
|
168
168
|
end
|
@@ -204,46 +204,42 @@ module Opal
|
|
204
204
|
missing << path unless found_blackslash
|
205
205
|
temp_filename
|
206
206
|
end
|
207
|
-
raise "Expected to fix blackslash continuation in #{fix_these_files} but we didn't find any backslashes in #{missing}. Check if RSpec has been upgraded (maybe those blackslashes are gone??)" if missing.any?
|
207
|
+
raise "~~> Expected to fix blackslash continuation in #{fix_these_files} but we didn't find any backslashes in #{missing}. Check if RSpec has been upgraded (maybe those blackslashes are gone??)" if missing.any?
|
208
208
|
files_we_left_alone = files - fix_these_files
|
209
209
|
files_we_left_alone + fixed_temp_files
|
210
210
|
end
|
211
211
|
|
212
212
|
def execute_specs(name)
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
}
|
221
|
-
|
222
|
-
state = :progress
|
223
|
-
IO.popen(command_line).each do |line|
|
224
|
-
line.force_encoding 'UTF-8'
|
225
|
-
case state
|
226
|
-
when :progress
|
227
|
-
puts line
|
228
|
-
when :example_info
|
229
|
-
example_info << line
|
230
|
-
end
|
231
|
-
state = case line
|
232
|
-
when /BEGIN JSON/
|
233
|
-
:example_info
|
234
|
-
else
|
235
|
-
state
|
236
|
-
end
|
237
|
-
end.close
|
213
|
+
require 'tempfile'
|
214
|
+
file = Tempfile.new([name.to_s, '.json'])
|
215
|
+
command = "SPEC_OPTS=\"--no-color --format progress --format Opal::RSpec::SeparatorFormatter --format json\" rake #{name} --trace > #{file.path}"
|
216
|
+
puts
|
217
|
+
puts "~~> Running #{command}"
|
218
|
+
|
219
|
+
# travis/keep alive
|
220
|
+
pinger = Thread.new { loop { sleep 60; print '.' } }
|
221
|
+
success = system(command)
|
238
222
|
pinger.exit
|
223
|
+
|
224
|
+
file.rewind
|
225
|
+
ouput = file.read
|
226
|
+
ouput.force_encoding 'UTF-8'
|
227
|
+
progress, example_info = ouput.split('~~~SEPARATOR~~~', 2)
|
228
|
+
|
239
229
|
{
|
240
|
-
example_info: example_info,
|
241
|
-
success:
|
230
|
+
example_info: [example_info],
|
231
|
+
success: success
|
242
232
|
}
|
243
233
|
end
|
244
234
|
|
245
235
|
def parse_results(results)
|
246
236
|
JSON.parse results[:example_info].join("\n")
|
237
|
+
rescue
|
238
|
+
warn "JSON PARSING FAILED"
|
239
|
+
warn "-------------------"
|
240
|
+
warn results[:example_info].join("\n")
|
241
|
+
warn "-------------------"
|
242
|
+
raise
|
247
243
|
end
|
248
244
|
|
249
245
|
def rake_tasks_for(name)
|
@@ -254,7 +250,8 @@ module Opal
|
|
254
250
|
task.files = sub_in_files
|
255
251
|
task.default_path = default_path
|
256
252
|
append_additional_load_paths server
|
257
|
-
|
253
|
+
|
254
|
+
server.debug = ENV['OPAL_DEBUG'] if server.respond_to?(:debug=)
|
258
255
|
end
|
259
256
|
|
260
257
|
desc "Verifies that #{name} work correctly"
|
@@ -312,23 +309,23 @@ module Opal
|
|
312
309
|
passing = total - failed - pending
|
313
310
|
percentage = ((passing.to_f / total) * 100).round(1)
|
314
311
|
if reasons.empty?
|
315
|
-
puts 'Test successful!'
|
316
|
-
puts "#{total} total specs, #{failed} expected failures, #{pending} expected pending"
|
317
|
-
puts "Passing percentage: #{percentage}%"
|
312
|
+
puts '~~> Test successful!'
|
313
|
+
puts "~~> #{total} total specs, #{failed} expected failures, #{pending} expected pending"
|
314
|
+
puts "~~> Passing percentage: #{percentage}%"
|
318
315
|
else
|
319
|
-
puts "Test FAILED for the following reasons:\n"
|
316
|
+
puts "~~> Test FAILED for the following reasons:\n"
|
320
317
|
puts reasons.join "\n\n"
|
321
318
|
if remaining_failures.any?
|
322
319
|
puts
|
323
|
-
puts "Unexpected failures:\n\n#{remaining_failures.join("\n")}\n"
|
320
|
+
puts "~~> Unexpected failures:\n\n#{remaining_failures.join("\n")}\n"
|
324
321
|
end
|
325
|
-
puts '-----------Summary-----------'
|
326
|
-
puts "Total passed count: #{passing}"
|
327
|
-
puts "Pending count #{pending}"
|
328
|
-
puts "Total 'failure' count: #{actual_failures.length}"
|
329
|
-
puts "Passing percentage: #{percentage}%"
|
330
|
-
puts "Unexpected failure count: #{remaining_failures.length}"
|
331
|
-
raise 'Test failed!'
|
322
|
+
puts '~~> -----------Summary-----------'
|
323
|
+
puts "~~> Total passed count: #{passing}"
|
324
|
+
puts "~~> Pending count #{pending}"
|
325
|
+
puts "~~> Total 'failure' count: #{actual_failures.length}"
|
326
|
+
puts "~~> Passing percentage: #{percentage}%"
|
327
|
+
puts "~~> Unexpected failure count: #{remaining_failures.length}"
|
328
|
+
raise '~~> Test failed!'
|
332
329
|
end
|
333
330
|
end
|
334
331
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Opal::RSpec
|
2
|
+
# a good compromise between not mucking with the code we're testing but making it more machine readable
|
3
|
+
class SeparatorFormatter < ::RSpec::Core::Formatters::BaseFormatter
|
4
|
+
::RSpec::Core::Formatters.register self, :close
|
5
|
+
SEP = "~~~SEPARATOR~~~"
|
6
|
+
|
7
|
+
def close(_notification)
|
8
|
+
output.puts # our dots will not have closed out with a CR
|
9
|
+
output.puts SEP
|
10
|
+
output.sync = true
|
11
|
+
output.puts # Need a CR for popen to know we're done
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: opal-rspec
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Beynon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-11-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: opal
|
@@ -58,6 +58,20 @@ dependencies:
|
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '0'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: puma
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - ">="
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0'
|
61
75
|
- !ruby/object:Gem::Dependency
|
62
76
|
name: poltergeist
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
@@ -126,7 +140,6 @@ files:
|
|
126
140
|
- ".rspec"
|
127
141
|
- ".travis.yml"
|
128
142
|
- ".yardopts"
|
129
|
-
- Appraisals
|
130
143
|
- CHANGELOG.md
|
131
144
|
- Gemfile
|
132
145
|
- README.md
|
@@ -137,8 +150,6 @@ files:
|
|
137
150
|
- example/Rakefile
|
138
151
|
- example/opal/user.rb
|
139
152
|
- example/spec/user_spec.rb
|
140
|
-
- gemfiles/opal_0.10_stable.gemfile
|
141
|
-
- gemfiles/opal_master.gemfile
|
142
153
|
- lib/opal-rspec.rb
|
143
154
|
- lib/opal/rspec.rb
|
144
155
|
- lib/opal/rspec/cached_environment.rb
|
@@ -764,7 +775,7 @@ files:
|
|
764
775
|
- spec/rspec/opal_rspec_spec_loader.rb
|
765
776
|
- spec/rspec/shared/opal/fixes/deprecation_helpers.rb
|
766
777
|
- spec/rspec/shared/opal/fixes/rspec_helpers.rb
|
767
|
-
- spec/rspec/shared/opal/
|
778
|
+
- spec/rspec/shared/opal/separator_formatter.rb
|
768
779
|
- spec/rspec/support/config.rb
|
769
780
|
- spec/rspec/support/config.ru
|
770
781
|
- spec/rspec/support/filter/bugs/recursive_const_methods.txt
|
@@ -781,7 +792,7 @@ files:
|
|
781
792
|
- spec/rspec/support/support_spec_loader.rb
|
782
793
|
- util/create_requires.rb
|
783
794
|
- vendor/spec_runner.js
|
784
|
-
homepage:
|
795
|
+
homepage: https://github.com/opal-rspec
|
785
796
|
licenses: []
|
786
797
|
metadata: {}
|
787
798
|
post_install_message:
|
@@ -800,7 +811,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
800
811
|
version: '0'
|
801
812
|
requirements: []
|
802
813
|
rubyforge_project:
|
803
|
-
rubygems_version: 2.
|
814
|
+
rubygems_version: 2.7.7
|
804
815
|
signing_key:
|
805
816
|
specification_version: 4
|
806
817
|
summary: RSpec for Opal
|
data/Appraisals
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "opal", git: "https://github.com/opal/opal.git", branch: "0-10-stable"
|
6
|
-
gem "rspec", path: "../rspec"
|
7
|
-
gem "rspec-support", path: "../rspec-support"
|
8
|
-
gem "rspec-core", path: "../rspec-core"
|
9
|
-
gem "rspec-mocks", path: "../rspec-mocks"
|
10
|
-
gem "rspec-expectations", path: "../rspec-expectations"
|
11
|
-
|
12
|
-
gemspec path: "../"
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "opal", git: "https://github.com/opal/opal.git"
|
6
|
-
gem "rspec", path: "../rspec"
|
7
|
-
gem "rspec-support", path: "../rspec-support"
|
8
|
-
gem "rspec-core", path: "../rspec-core"
|
9
|
-
gem "rspec-mocks", path: "../rspec-mocks"
|
10
|
-
gem "rspec-expectations", path: "../rspec-expectations"
|
11
|
-
gem "opal-sprockets", github: "opal/opal-sprockets"
|
12
|
-
|
13
|
-
gemspec path: "../"
|
@@ -1,29 +0,0 @@
|
|
1
|
-
module Opal::RSpec
|
2
|
-
# a good compromise between not mucking with the code we're testing but making it more machine readable
|
3
|
-
class ProgressJsonFormatter < ::RSpec::Core::Formatters::JsonFormatter
|
4
|
-
::RSpec::Core::Formatters.register self, :message, :dump_summary, :dump_profile, :example_passed, :example_pending, :example_failed, :close, :stop
|
5
|
-
|
6
|
-
def example_passed(_notification)
|
7
|
-
output.print ::RSpec::Core::Formatters::ConsoleCodes.wrap('.', :success)
|
8
|
-
end
|
9
|
-
|
10
|
-
def example_pending(_notification)
|
11
|
-
output.print ::RSpec::Core::Formatters::ConsoleCodes.wrap('*', :pending)
|
12
|
-
end
|
13
|
-
|
14
|
-
def example_failed(_notification)
|
15
|
-
output.print ::RSpec::Core::Formatters::ConsoleCodes.wrap('F', :failure)
|
16
|
-
end
|
17
|
-
|
18
|
-
def start_dump(_notification)
|
19
|
-
output.puts
|
20
|
-
end
|
21
|
-
|
22
|
-
def close(_notification)
|
23
|
-
output.puts # our dots will not have closed out with a CR
|
24
|
-
output.puts 'BEGIN JSON'
|
25
|
-
super
|
26
|
-
output.puts # Need a CR for popen to know we're done
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|